UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Losing Electric Cherry when Down

broken avatar :(
Created 10 years ago
by nabaro
0 Members and 1 Guest are viewing this topic.
1,736 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
2 problems: I don't lose Cherry when I down and I experience extreme lag (almost freezing) when the game starts. Here is my Cherry script. Thanks in advance.

Code Snippet
Plaintext
#include maps\_anim; 
#include maps\_utility;
#include common_scripts\utility;
#include maps\_music;
#include maps\_zombiemode_utility;

main()
{
flag_wait("all_players_connected");
wait(1);
players = get_players();
for(i = 0; i < players.size; i++)
{
players[i] thread cherry_effect();
players[i] thread cherry_down();
}
}

cherry_effect()

while(1)
{
self waittill( "reload_start" );
if( self HasPerk("specialty_boost"))
{
cherry_weapon = self GetCurrentWeapon();
ammo_left = self GetWeaponAmmoClip( cherry_weapon );
clip_size = WeaponClipSize( cherry_weapon );
ratio = ammo_left / clip_size;
damage = 1200 - (ratio * 1200);
iprintln( damage );
touching_check = spawn("trigger_radius",self.origin,1,200,200);
zombies = getaispeciesarray("axis","all");
for(j = 0; j < zombies.size; j++)
{
if(zombies[j] IsTouching( touching_check ))
{
zombies[j] maps\_zombiemode_tesla::tesla_play_death_fx( 1 );
zombies[j] SetFlashBanged( true, 1 );
}
else
{
continue;
}
}
touching_check delete();
SetPlayerIgnoreRadiusDamage( true );
RadiusDamage( self.origin, 200, damage, 50, self );
wait(5);
}
else
{
}
}
}

cherry_down()
{
while(1)
{
if(self HasPerk("specialty_boost"))
{
while(1)
{
self waittill_any( "fake_death", "death", "player_downed" );
touching_check = spawn("trigger_radius",self.origin,1,200,200);
zombies = getaispeciesarray("axis","all");
for(j = 0; j < zombies.size; j++)
{
if(zombies[j] IsTouching( touching_check ))
{
zombies[j] maps\_zombiemode_tesla::tesla_play_death_fx( 1 );
zombies[j] SetFlashBanged( true, 1 );
}
else
{
continue;
}
}
touching_check delete();
SetPlayerIgnoreRadiusDamage( true );
RadiusDamage( self.origin, 150, 1200, 50, self );
self UnSetPerk("specialty_boost");
break;
}
}
else
{
continue;
}
}
}

broken avatar :(
×
broken avatar :(
Location: usYork, SC
Date Registered: 15 March 2014
Last active: 5 years ago
Posts
214
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
WaW Scriptor
Signature
WaW Scriptor
×
PROxFTW's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
PROxFTW's Contact & Social LinksPROxFTWPROxFTWPROxFTWPROxFTW
For the lag I might be able to help
However for the death check right after self UnsetPerk
Do a notify
Then right above the while(1) in cherry_effect
Do an Endon

Let me know how this works out

As for the lag did it start when you added the script or sometime before?
Marked as best answer by nabaro 10 years ago
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
You don't have any wait() in your outermost while loop in cherry_down().

- Phil.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
2 things: adding the wait didn't help, unless I misinterpreted your statement. Also, I realized that the innermost while loop in cherry_down() was useless, so I removed it. Here is the current script:
Code Snippet
Plaintext
#include maps\_anim; 
#include maps\_utility;
#include common_scripts\utility;
#include maps\_music;
#include maps\_zombiemode_utility;

main()
{
flag_wait("all_players_connected");
wait(1);
players = get_players();
for(i = 0; i < players.size; i++)
{
players[i] thread cherry_effect();
players[i] thread cherry_down();
}
}

cherry_effect()

while(1)
{
self waittill( "reload_start" );
if( self HasPerk("specialty_boost"))
{
cherry_weapon = self GetCurrentWeapon();
ammo_left = self GetWeaponAmmoClip( cherry_weapon );
clip_size = WeaponClipSize( cherry_weapon );
ratio = ammo_left / clip_size;
damage = 1200 - (ratio * 1200);
iprintln( damage );
touching_check = spawn("trigger_radius",self.origin,1,200,200);
zombies = getaispeciesarray("axis","all");
for(j = 0; j < zombies.size; j++)
{
if(zombies[j] IsTouching( touching_check ))
{
zombies[j] maps\_zombiemode_tesla::tesla_play_death_fx( 1 );
zombies[j] SetFlashBanged( true, 1 );
}
else
{
continue;
}
}
touching_check delete();
SetPlayerIgnoreRadiusDamage( true );
RadiusDamage( self.origin, 200, damage, 50, self );
wait(5);
}
else
{
}
}
}

cherry_down()
{
while(1)
{
if(self HasPerk("specialty_boost"))
{
self waittill_any( "fake_death", "death", "player_downed" );
touching_check = spawn("trigger_radius",self.origin,1,200,200);
zombies = getaispeciesarray("axis","all");
for(j = 0; j < zombies.size; j++)
{
if(zombies[j] IsTouching( touching_check ))
{
zombies[j] maps\_zombiemode_tesla::tesla_play_death_fx( 1 );
zombies[j] SetFlashBanged( true, 1 );
}
else
{
continue;
}
}
touching_check delete();
SetPlayerIgnoreRadiusDamage( true );
RadiusDamage( self.origin, 150, 1200, 50, self );
self UnSetPerk("specialty_boost");
wait(5);
}
else
{
continue;
}
}
}
Also, wouldn't using a notify never allow for me to use the effects of cherry after my first down?

Post Merge: April 25, 2014, 08:40:16 pm
One more thing, using developer 1 in game shows that, at the time of the lag, there is a script runtime error: potential infinite loop: killing thread.
Last Edit: April 25, 2014, 08:40:16 pm by nabaro
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
You put the wait in the wrong position, you should be waiting in the else clause, because if you don't, the loop will be terminated by the engine when you don't have the perk as it creates an "infinite loop" error.

- Phil.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
Like this?

Code Snippet
Plaintext
else
{
wait(0.05);
continue;
}

Post Merge: April 25, 2014, 08:44:13 pm
Yep, it works perfectly! Thanks Phil!
Last Edit: April 25, 2014, 08:44:13 pm by nabaro
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
I don't suppose it is necessary to wait for such a short time only, something a little longer should work too.

- Phil.

 
Loading ...