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

killing zombies script issue

broken avatar :(
Created 10 years ago
by Ege115
0 Members and 1 Guest are viewing this topic.
3,319 views
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 1 month ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
This is a script that will check if the zombies are touching a trigger and then will kill the zombies.
And the purpose of this is that it will only kill the zombies that are touching the trigger, bu tinstead if only ONE zombie has touched the trigger, then all zombies dies.

I only want the zombies that touches the trigger to die, then why doesn't it do that?
Code Snippet
Plaintext
#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;
#using_animtree( "generic_human" );

thors_thunder()
{
  thors_hammer = getent ("thors_hammer", "targetname");
  thread thors_hammer_throw(thors_hammer);
}

thors_hammer_throw(thors_hammer)
{
self endon( "disconnect" );

level._effect["thunder"] = loadfx("maps/fly/fx_lightning_clouds_low");
level._effect["thunder_hit"] = loadfx("maps/zombie/fx_zombie_dog_lightning_spawn");
level._effect["elec_eye_fx"] = loadfx( "maps/zombie/fx_zombie_tesla_shock_eyes" );
level._effect["shock_fx"] = loadfx( "maps/zombie/fx_zombie_tesla_shock" );
player GiveWeapon( "thors_anger" );

    //iPrintln("Throw a grenade!");
    player waittill("grenade_fire", grenade);//,grenade, weapName);

WeapName = player GetCurrentWeapon();
if( weapName == "thors_anger" )
{
return grenade;
}
wait( 0.05 );

if( IsDefined( grenade ) )
{
players = get_players();
for(i=0;i<players.size;i++)
{
if( players[i] maps\_laststand::player_is_in_laststand() )
{
grenade delete();
continue;
}
grenade hide();
model = spawn( "script_model", grenade.origin );
model SetModel( "weapon_zombie_monkey_bomb" );
model linkTo( grenade );

forward = player geteye();
vec = anglestoforward(player getPlayerAngles());
end = (vec[0] * 100000000, vec[1] * 100000000, vec[2] * 100000000);
hammertrace = BulletTrace( forward, end, 0, player )[ "position" ];
//hammercenter2 = spawn("script_origin",hammertrace+ (0,0,60));
hammercenter2 = spawn("trigger_radius",hammertrace+ (0,0,45),73,200,200);
hammercenter = spawn("script_model", hammertrace+ (0,0,45));
hammercenter setModel("tag_origin");
hammercenter.angles = (90,0,0);

playfxontag( level._effect["thunder"], hammercenter, "tag_origin");
wait(4);
playfxontag( level._effect["thunder_hit"], hammercenter, "tag_origin");

secs = 0;
while(secs <= 140)
{
secs++;

zombs = getaispeciesarray("axis","all");
for(k=0;k<zombs.size;k++)
{
if (zombs[k] istouching(hammercenter2))
{
zombs[k] DoDamage( zombs[k].health + 666, zombs[k].origin );
iprintln( "Killing zombie..." );
zombs[k].deathanim = random( level._zombie_tesla_death[zombs[k].animname] );
zombs[k] maps\_zombiemode_tesla::tesla_play_death_fx(1);
players[i] maps\_zombiemode_score::add_to_player_score(50);

playfx( "tesla_death_fx", 2, level._effect["elec_eye_fx"], zombs[k], "J_Eyeball_LE" );
playfx( "tesla_death_fx", 2, level._effect["shock_fx"], zombs[k], "J_SpineUpper" );
zombs[k] playsound( "imp_tesla" );
}
}
      }
    }
//hammercenter2 delete();
//hammercenter delete();
//grenade delete();
//model delete();
}
}
Thanks in advance.

Edit: I know the formatting looks bad atm.
Last Edit: May 27, 2014, 05:39:55 pm by Ege115
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 21 March 2014
Last active: 2 years ago
Posts
227
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
Personal Quote
I the Mighty
×
ConvictioNDR's Groups
This zombs = getaispeciesarray("axis","all"); you could maybe try this instead  zombs = GetAiArray("axis");
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 February 2013
Last active: 6 years ago
Posts
186
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Community Scripter
My Groups
More
Personal Quote
Every map needs a Panzer Soldat
Signature
HexPieRadiBirds Magical Fun Time Water Hole
×
AwesomePieMan's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
AwesomePieMan's Contact & Social Links
Right off the bat I can see that the variable players does not seem to be defined.  Not sure why it hasn't given you a script error on map startup already.  Also, put the wait in your while loop instead of the if statement.  (I saw both of those things at first glance, so keep that in mind if it does not work instantly.)  Ill look into this more when I get to my desktop.  (Im on a laptop now that cant run w@w for me to test)

Edit: For some reason on my laptop it didn't show the whole code box, ignore what I said about things not being defined.  (I only saw part of it)
Last Edit: May 27, 2014, 07:51:46 pm by AwesomePieMan
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 1 month ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
Okey updated in the OP, that is the whole script.
Quote
This zombs = getaispeciesarray("axis","all"); you could maybe try this instead  zombs = GetAiArray("axis");
I think I actually need that the one I have. :/
getaiarray isn't for all ai "enemies" I  think, the one I have works for both zombies and dogs, if I'm not mistaken.
Last Edit: May 27, 2014, 06:19:15 pm by Ege115
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
I believe that your radius is returning undefined. From what I've experienced this makes the code ignore the if statement and run all lines of code, regardless if it actually true or not.

Just as a test, try this:

Code Snippet
Plaintext
					if (isdefined(hammercenter2) && zombs[k] istouching(hammercenter2))
{
zombs[k] DoDamage( zombs[k].health + 666, zombs[k].origin );
iprintln( "Killing zombie..." );
zombs[k].deathanim = random( level._zombie_tesla_death[zombs[k].animname] );
zombs[k] maps\_zombiemode_tesla::tesla_play_death_fx(1);
players[i] maps\_zombiemode_score::add_to_player_score(50);

playfx( "tesla_death_fx", 2, level._effect["elec_eye_fx"], zombs[k], "J_Eyeball_LE" );
playfx( "tesla_death_fx", 2, level._effect["shock_fx"], zombs[k], "J_SpineUpper" );
zombs[k] playsound( "imp_tesla" );
}
else if(!isdefined(hammercenter2) )
{
iprintln("No center defined!");
}
else if(isdefined(hammercenter2) && zombies[k] !istouching(hammercenter2) )
{
iprintln("AI are not in the center!");
}
Last Edit: May 27, 2014, 09:13:47 pm by daedra descent
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
well besides your code doesnt exactly shows what you want it to do(useless vars, undefined stuff) your doing a for loop on the zombies array inisde the players for loop.
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 1 month ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
I believe that your radius is returning undefined. From what I've experienced this makes the code ignore the if statement and run all lines of code, regardless if it actually true or not.

Just as a test, try this:

Code Snippet
Plaintext
					if (isdefined(hammercenter2) && zombs[k] istouching(hammercenter2))
{
zombs[k] DoDamage( zombs[k].health + 666, zombs[k].origin );
iprintln( "Killing zombie..." );
zombs[k].deathanim = random( level._zombie_tesla_death[zombs[k].animname] );
zombs[k] maps\_zombiemode_tesla::tesla_play_death_fx(1);
players[i] maps\_zombiemode_score::add_to_player_score(50);

playfx( "tesla_death_fx", 2, level._effect["elec_eye_fx"], zombs[k], "J_Eyeball_LE" );
playfx( "tesla_death_fx", 2, level._effect["shock_fx"], zombs[k], "J_SpineUpper" );
zombs[k] playsound( "imp_tesla" );
}
else if(!isdefined(hammercenter2) )
{
iprintln("No center defined!");
}
else if(isdefined(hammercenter2) && zombies[k] !istouching(hammercenter2) )
{
iprintln("AI are not in the center!");
}
I tried this and I changed the place of the "!" before "zombs[k]" instead of after. Becaus eit gave me a bad syntax.

Well I have tested it and when the zombies are touching the trigger, then it printed "no center defined" and it still printed that if the zombie touched it once and walked away from the trigger.
And when the zombies didn't touch the trigger then it printed, "AI are not in the center!".

But the zombes didn't die if they touched the trigger, but this is just a test as you said.
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
Here is a test to hopefully kill off only 1 zombie instead of a multiple of them.
Code Snippet
Plaintext
#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;
#using_animtree( "generic_human" );

thors_thunder()
{
  thors_hammer = getent ("thors_hammer", "targetname");
  thread thors_hammer_throw(thors_hammer);
}

thors_hammer_throw(thors_hammer)
{
self endon( "disconnect" );

level._effect["thunder"] = loadfx("maps/fly/fx_lightning_clouds_low");
level._effect["thunder_hit"] = loadfx("maps/zombie/fx_zombie_dog_lightning_spawn");
level._effect["elec_eye_fx"] = loadfx( "maps/zombie/fx_zombie_tesla_shock_eyes" );
level._effect["shock_fx"] = loadfx( "maps/zombie/fx_zombie_tesla_shock" );
player GiveWeapon( "thors_anger" );

    //iPrintln("Throw a grenade!");
    player waittill("grenade_fire", grenade);//,grenade, weapName);

WeapName = player GetCurrentWeapon();
if( weapName == "thors_anger" )
{
return grenade;
}
wait( 0.05 );

if( IsDefined( grenade ) )
{
players = get_players();
for(i=0;i<players.size;i++)
{
if( players[i] maps\_laststand::player_is_in_laststand() )
{
grenade delete();
continue;
}
grenade hide();
model = spawn( "script_model", grenade.origin );
model SetModel( "weapon_zombie_monkey_bomb" );
model linkTo( grenade );

forward = player geteye();
vec = anglestoforward(player getPlayerAngles());
end = (vec[0] * 100000000, vec[1] * 100000000, vec[2] * 100000000);
hammertrace = BulletTrace( forward, end, 0, player )[ "position" ];
//hammercenter2 = spawn("script_origin",hammertrace+ (0,0,60));
hammercenter2 = spawn("trigger_radius",hammertrace+ (0,0,45),73,200,200);
hammercenter = spawn("script_model", hammertrace+ (0,0,45));
hammercenter setModel("tag_origin");
hammercenter.angles = (90,0,0);

playfxontag( level._effect["thunder"], hammercenter, "tag_origin");
wait(4);
playfxontag( level._effect["thunder_hit"], hammercenter, "tag_origin");

zombs = getaispeciesarray("axis","all");
secs = 0;
while(secs <= 140)
{
secs++;

for(k=0;k<zombs.size;k++)
if( !IsDefined(zombs[k].DamageInit) )
zombs[k] thread DamageCode(hammercenter2, players[i]);
wait 1; // If you want the code to wait a second before ++.
    }
    for(k=0;k<zombs.size;k++)
    zombs[k] notify( "Damage" );
    }
//hammercenter2 delete();
//hammercenter delete();
//grenade delete();
//model delete();
}
}

DamageCode(hammercenter2, Player)
{
self endon( "Damage" );
self.DamageInit = true;
for(;;)
{
if (self istouching(hammercenter2))
{
self DoDamage( self.health + 666, self.origin );
iprintln( "Killing zombie..." );
self.deathanim = random( level._zombie_tesla_death[self.animname] );
self maps\_zombiemode_tesla::tesla_play_death_fx(1);
Player maps\_zombiemode_score::add_to_player_score(50);

playfx( "tesla_death_fx", 2, level._effect["elec_eye_fx"], self, "J_Eyeball_LE" );
playfx( "tesla_death_fx", 2, level._effect["shock_fx"], self, "J_SpineUpper" );
self playsound( "imp_tesla" );
}
wait .05;
}
}
Last Edit: May 28, 2014, 08:26:17 pm by PROxFTW
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 1 month ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
Here is a test to hopefully kill off only 1 zombie instead of a multiple of them.
Code Snippet
Plaintext
#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;
#using_animtree( "generic_human" );

thors_thunder()
{
  thors_hammer = getent ("thors_hammer", "targetname");
  thread thors_hammer_throw(thors_hammer);
}

thors_hammer_throw(thors_hammer)
{
self endon( "disconnect" );

level._effect["thunder"] = loadfx("maps/fly/fx_lightning_clouds_low");
level._effect["thunder_hit"] = loadfx("maps/zombie/fx_zombie_dog_lightning_spawn");
level._effect["elec_eye_fx"] = loadfx( "maps/zombie/fx_zombie_tesla_shock_eyes" );
level._effect["shock_fx"] = loadfx( "maps/zombie/fx_zombie_tesla_shock" );
player GiveWeapon( "thors_anger" );

    //iPrintln("Throw a grenade!");
    player waittill("grenade_fire", grenade);//,grenade, weapName);

WeapName = player GetCurrentWeapon();
if( weapName == "thors_anger" )
{
return grenade;
}
wait( 0.05 );

if( IsDefined( grenade ) )
{
players = get_players();
for(i=0;i<players.size;i++)
{
if( players[i] maps\_laststand::player_is_in_laststand() )
{
grenade delete();
continue;
}
grenade hide();
model = spawn( "script_model", grenade.origin );
model SetModel( "weapon_zombie_monkey_bomb" );
model linkTo( grenade );

forward = player geteye();
vec = anglestoforward(player getPlayerAngles());
end = (vec[0] * 100000000, vec[1] * 100000000, vec[2] * 100000000);
hammertrace = BulletTrace( forward, end, 0, player )[ "position" ];
//hammercenter2 = spawn("script_origin",hammertrace+ (0,0,60));
hammercenter2 = spawn("trigger_radius",hammertrace+ (0,0,45),73,200,200);
hammercenter = spawn("script_model", hammertrace+ (0,0,45));
hammercenter setModel("tag_origin");
hammercenter.angles = (90,0,0);

playfxontag( level._effect["thunder"], hammercenter, "tag_origin");
wait(4);
playfxontag( level._effect["thunder_hit"], hammercenter, "tag_origin");

zombs = getaispeciesarray("axis","all");
secs = 0;
while(secs <= 140)
{
secs++;

for(k=0;k<zombs.size;k++)
if( !IsDefined(zombs[k].DamageInit) )
zombs[k] thread DamageCode(hammercenter2, players[i]);
wait 1; // If you want the code to wait a second before ++.
    }
    for(k=0;k<zombs.size;k++)
    zombs[k] notify( "Damage" );
    }
//hammercenter2 delete();
//hammercenter delete();
//grenade delete();
//model delete();
}
}

DamageCode(hammercenter2, Player)
{
self endon( "Damage" );
self.DamageInit = true;
for(;;)
{
if (self istouching(hammercenter2))
{
self DoDamage( self.health + 666, self.origin );
iprintln( "Killing zombie..." );
self.deathanim = random( level._zombie_tesla_death[self.animname] );
self maps\_zombiemode_tesla::tesla_play_death_fx(1);
Player maps\_zombiemode_score::add_to_player_score(50);

playfx( "tesla_death_fx", 2, level._effect["elec_eye_fx"], self, "J_Eyeball_LE" );
playfx( "tesla_death_fx", 2, level._effect["shock_fx"], self, "J_SpineUpper" );
self playsound( "imp_tesla" );
}
wait .05;
}
}
Hmm, it killed all the zombies anyway. As soon as one zombie is touching the trigger, then all zombies dies. And when it does that now, it loops forever so I get unlimited points, lol.

It is something with the for loop for the zombies. The wierd thing is I do put the end bracket for the zombie loop after it has only looped one zombie and killed it. But it still kill al zombies, that is wierd.
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
×
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
Maybe this one will work if you want to try it out but can't say for sure it will work.
Code Snippet
Plaintext
#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;
#using_animtree( "generic_human" );

Init()
{
level._effect["thunder"] = loadfx("maps/fly/fx_lightning_clouds_low");
level._effect["thunder_hit"] = loadfx("maps/zombie/fx_zombie_dog_lightning_spawn");
level._effect["elec_eye_fx"] = loadfx( "maps/zombie/fx_zombie_tesla_shock_eyes" );
level._effect["shock_fx"] = loadfx( "maps/zombie/fx_zombie_tesla_shock" );

thread ThorThunder();
}

ThorThunder()
{
ThorHammer = GetEnt( "thors_hammer", "targetname" );
for( i = 0; i < GetPlayers().size; i++ )
GetPlayers()[i] thread ThorHammerThrow( ThorHammer );
}

ThorHammerThrow( ThorHammer )
{
self endon( "Disconnect" );

self GiveWeapon( "thors_anger" );
self waittill( "grenade_fire", grenade );
CurrWeap = self GetCurrentWeapon();
if( CurrWeap == "thors_anger" )
return grenade;
wait .05;
if( IsDefined( grenade ) )
{
if( self maps\_laststand::player_is_in_laststand() )
{
grenade delete();
continue;
}
grenade hide();
Model = Spawn( "script_model", grenade.origin );
Model SetModel( "weapon_zombie_monkey_bomb" );
Model LinkTo( Grenade );

End = ( AnglesToForward( self GetPlayerAngles()[0] * 100000000, self GetPlayerAngles()[1] * 100000000, self GetPlayerAngles()[2] * 100000000 ) );
HammerTrace = BulletTrace( self GetEye(), End, 0, self )["position"];
HammerCenter2 = Spawn( "trigger_radius", HammerTrace + ( 0, 0, 45 ), 73, 200, 200 );
HammerCenter = Spawn( "script_model", HammerTrace + ( 0, 0, 45 ) );
HammerCenter SetModel( "tag_origin" );
HammerCenter.angles = ( 90, 0, 0 );
PlayFXOnTag( level._effect["thunder"], HammerCenter, "tag_origin" );
wait 4;
PlayFXOnTag( level._effect["thunder_hit"], HammerCenter, "tag_origin" );
Zombs = GetAiSpeciesArray( "axis", "all" );
Sec = 0;
while( Sec <= 140 )
{
for( i = 0; i < Zombs.size; i++ )
if( Zombs[i] IsTouching( HammerCenter2 ) )
Zombs[i] thread DamageControl();
wait 1;
Sec++;
}
}
}

DamageControl()
{
self DoDamage( self.health + 666, self.origin );
iprintln( "Killing zombie..." );
self.deathanim = random( level._zombie_tesla_death[self.animname] );
self maps\_zombiemode_tesla::tesla_play_death_fx( 1 );
Player maps\_zombiemode_score::add_to_player_score( 50 );
PlayFX( "tesla_death_fx", 2, level._effect["elec_eye_fx"], self, "J_Eyeball_LE" );
PlayFX( "tesla_death_fx", 2, level._effect["shock_fx"], self, "J_SpineUpper" );
self playsound( "imp_tesla" );
}
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 1 month ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
Maybe this one will work if you want to try it out but can't say for sure it will work.
Code Snippet
Plaintext
#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;
#using_animtree( "generic_human" );

Init()
{
level._effect["thunder"] = loadfx("maps/fly/fx_lightning_clouds_low");
level._effect["thunder_hit"] = loadfx("maps/zombie/fx_zombie_dog_lightning_spawn");
level._effect["elec_eye_fx"] = loadfx( "maps/zombie/fx_zombie_tesla_shock_eyes" );
level._effect["shock_fx"] = loadfx( "maps/zombie/fx_zombie_tesla_shock" );

thread ThorThunder();
}

ThorThunder()
{
ThorHammer = GetEnt( "thors_hammer", "targetname" );
for( i = 0; i < GetPlayers().size; i++ )
GetPlayers()[i] thread ThorHammerThrow( ThorHammer );
}

ThorHammerThrow( ThorHammer )
{
self endon( "Disconnect" );

self GiveWeapon( "thors_anger" );
self waittill( "grenade_fire", grenade );
CurrWeap = self GetCurrentWeapon();
if( CurrWeap == "thors_anger" )
return grenade;
wait .05;
if( IsDefined( grenade ) )
{
if( self maps\_laststand::player_is_in_laststand() )
{
grenade delete();
continue;
}
grenade hide();
Model = Spawn( "script_model", grenade.origin );
Model SetModel( "weapon_zombie_monkey_bomb" );
Model LinkTo( Grenade );

End = ( AnglesToForward( self GetPlayerAngles()[0] * 100000000, self GetPlayerAngles()[1] * 100000000, self GetPlayerAngles()[2] * 100000000 ) );
HammerTrace = BulletTrace( self GetEye(), End, 0, self )["position"];
HammerCenter2 = Spawn( "trigger_radius", HammerTrace + ( 0, 0, 45 ), 73, 200, 200 );
HammerCenter = Spawn( "script_model", HammerTrace + ( 0, 0, 45 ) );
HammerCenter SetModel( "tag_origin" );
HammerCenter.angles = ( 90, 0, 0 );
PlayFXOnTag( level._effect["thunder"], HammerCenter, "tag_origin" );
wait 4;
PlayFXOnTag( level._effect["thunder_hit"], HammerCenter, "tag_origin" );
Zombs = GetAiSpeciesArray( "axis", "all" );
Sec = 0;
while( Sec <= 140 )
{
for( i = 0; i < Zombs.size; i++ )
if( Zombs[i] IsTouching( HammerCenter2 ) )
Zombs[i] thread DamageControl();
wait 1;
Sec++;
}
}
}

DamageControl()
{
self DoDamage( self.health + 666, self.origin );
iprintln( "Killing zombie..." );
self.deathanim = random( level._zombie_tesla_death[self.animname] );
self maps\_zombiemode_tesla::tesla_play_death_fx( 1 );
Player maps\_zombiemode_score::add_to_player_score( 50 );
PlayFX( "tesla_death_fx", 2, level._effect["elec_eye_fx"], self, "J_Eyeball_LE" );
PlayFX( "tesla_death_fx", 2, level._effect["shock_fx"], self, "J_SpineUpper" );
self playsound( "imp_tesla" );
}
It didn't work either it basically did the same thing, maybe I need to tell what I am trying to do.
I am trying to spawn a trigger at were you throw a grenade, and then those zombies who are touching the trigger will die.
The other zombies that are not touching the trigger will not get affected by it. Only the zombies that are touching the trigger will die.
And the script will check if the zombies are touching the trigger and then kill them for 14 seconds and then stop.

Edit: How did other kill the zombies in script one at a time? Like other maps I have seen, why doesn't it work for me?
Last Edit: May 29, 2014, 09:14:58 am by Ege115
Marked as best answer by Ege115 10 years ago
broken avatar :(
×
broken avatar :(
Location: gbComing up in the world
Date Registered: 26 November 2013
Last active: 9 years ago
Posts
325
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
I own the hat!
×
DuaLVII's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
DuaLVII's Contact & Social Linksthomas.gascoigne.7DuaLVIIDuaLVIITheProlonger
Code Snippet
Plaintext
thors_hammer_throw(thors_hammer)
{
self endon( "disconnect" );

level._effect["thunder"] = loadfx("maps/fly/fx_lightning_clouds_low");
level._effect["thunder_hit"] = loadfx("maps/zombie/fx_zombie_dog_lightning_spawn");
level._effect["elec_eye_fx"] = loadfx( "maps/zombie/fx_zombie_tesla_shock_eyes" );
level._effect["shock_fx"] = loadfx( "maps/zombie/fx_zombie_tesla_shock" );
player GiveWeapon( "thors_anger" );

    //iPrintln("Throw a grenade!");
    player waittill("grenade_fire", grenade);//,grenade, weapName);

WeapName = player GetCurrentWeapon();
if( weapName == "thors_anger" )
{
return grenade;
}
wait( 0.05 );

if( IsDefined( grenade ) )
{
players = get_players();
for(i=0;i<players.size;i++)
{
if( players[i] maps\_laststand::player_is_in_laststand() )
{
grenade delete();
continue;
}
grenade hide();
model = spawn( "script_model", grenade.origin );
model SetModel( "weapon_zombie_monkey_bomb" );
model linkTo( grenade );

forward = player geteye();
vec = anglestoforward(player getPlayerAngles());
end = (vec[0] * 100000000, vec[1] * 100000000, vec[2] * 100000000);
hammertrace = BulletTrace( forward, end, 0, player )[ "position" ];
//hammercenter2 = spawn("script_origin",hammertrace+ (0,0,60));
//hammercenter2 = spawn("trigger_radius",hammertrace+ (0,0,45),73,200,200);
hammer_center2 = hammertrace + (0,0,45),73,200,200
hammercenter = spawn("script_model", hammertrace+ (0,0,45));
hammercenter setModel("tag_origin");
hammercenter.angles = (90,0,0);

playfxontag( level._effect["thunder"], hammercenter, "tag_origin");
wait(4);
playfxontag( level._effect["thunder_hit"], hammercenter, "tag_origin");

secs = 0;
while(secs <= 140)
{
secs++;
zombs = getaiarray("axis");
for(k=0;k<zombs.size;k++)
{
if (distance(zombs[k].origin, )
{
zombs[k] DoDamage( zombs[k].health + 666, zombs[k].origin );
iprintln( "Killing zombie..." );
zombs[k].deathanim = random( level._zombie_tesla_death[zombs[k].animname] );
zombs[k] maps\_zombiemode_tesla::tesla_play_death_fx(1);
players[i] maps\_zombiemode_score::add_to_player_score(50);

playfx( "tesla_death_fx", 2, level._effect["elec_eye_fx"], zombs[k], "J_Eyeball_LE" );
playfx( "tesla_death_fx", 2, level._effect["shock_fx"], zombs[k], "J_SpineUpper" );
zombs[k] playsound( "imp_tesla" );
}
}
}
}
/*
hammercenter2 delete();
hammercenter delete();
grenade delete();
model delete();
*/
}
}

broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 1 month ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
Nice, it worked, thank you so much!
Now only the zombies that are near the entity dies. But why does distance check work but not istouching check with a trigger radius?
Last Edit: May 29, 2014, 11:11:03 am by Ege115

 
Loading ...