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

Make zombies respawn when player walks to far away?

HOT
broken avatar :(
Created 10 years ago
by NaviLlicious
0 Members and 1 Guest are viewing this topic.
12,093 views
broken avatar :(
×
broken avatar :(
Location: usconverse tx
Date Registered: 20 June 2013
Last active: 1 year ago
Posts
85
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
NaviLlicious's Groups
NaviLlicious's Contact & Social LinksNaviLliciousNaviLlusShore
Was wondering how I would make the zombies respawn when a player walks to far away from the zombies like on Mob of the Dead, I have an elevator and a teleporter setup but when the player uses one of them It puts them In an area the zombies can't get to unless they respawn
This topic contains a post which is marked as the Best Answer. Click here to view it.
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
Get the axis(zombie) array and do the function dodamage(); on them.
broken avatar :(
×
broken avatar :(
Location: usconverse tx
Date Registered: 20 June 2013
Last active: 1 year ago
Posts
85
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
NaviLlicious's Groups
NaviLlicious's Contact & Social LinksNaviLliciousNaviLlusShore
Get the axis(zombie) array and do the function dodamage(); on them.
Which .gsc would axis(zombie) be under?
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
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
It wasn't a function. I was specifying that an zombies are on the team "axis".

http://www.zeroy.com/script/

This has most engine defined functions including dodamage();. hold ctrl + f and search for "dodamage". It'll tell you how to properly use the function.
broken avatar :(
×
broken avatar :(
Location: usconverse tx
Date Registered: 20 June 2013
Last active: 1 year ago
Posts
85
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
NaviLlicious's Groups
NaviLlicious's Contact & Social LinksNaviLliciousNaviLlusShore
So how would I apply that to the zombies and how would I edit how far the player can go before the zombie starts taking damage?
broken avatar :(
×
broken avatar :(
Location: usNC
Date Registered: 19 June 2013
Last active: 7 years ago
Posts
261
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Mapper Elite
My Groups
More
My Contact & Social Links
More
×
GrantDaddy007's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Elite Has shown excellence and experience in the area of custom mapping in the UGX-Mods community.
GrantDaddy007's Contact & Social LinksGrantDaddyGrantdaddy007
Was wondering how I would make the zombies respawn when a player walks to far away from the zombies like on Mob of the Dead, I have an elevator and a teleporter setup but when the player uses one of them It puts them In an area the zombies can't get to unless they respawn

The way I went about this with zombie train is:
Code Snippet
Plaintext
zombies = getaispeciesarray("axis");

for (i = 0; i < zombies.size; i++)
{


zombies[i] dodamage( zombies[i].health + 666, zombies[i].origin );
playsoundatposition( "nuked", zombies[i].origin );
}

What this does is kill of any remaining zombies.  I used a trigger mult...  It will end the round and start the next one.

Hope this helps!  :P
broken avatar :(
×
broken avatar :(
Location: usconverse tx
Date Registered: 20 June 2013
Last active: 1 year ago
Posts
85
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
NaviLlicious's Groups
NaviLlicious's Contact & Social LinksNaviLliciousNaviLlusShore
The way I went about this with zombie train is:
Code Snippet
Plaintext
zombies = getaispeciesarray("axis");

for (i = 0; i < zombies.size; i++)
{


zombies[i] dodamage( zombies[i].health + 666, zombies[i].origin );
playsoundatposition( "nuked", zombies[i].origin );
}

What this does is kill of any remaining zombies.  I used a trigger mult...  It will end the round and start the next one.

Hope this helps!  :P
Thanks, you said you used a trigger mult for It? I tried putting a trig multiple In and It keeps the zombies from spawning until It's activated this Is how I put It In
Code Snippet
Plaintext
{
trigger = getent ( "axisdamage", "targetname" );
zombies = getaispeciesarray("axis");
   trigger waittill ("trigger");
for (i = 0; i < zombies.size; i++)
{


zombies[i] dodamage( zombies[i].health + 666, zombies[i].origin );
playsoundatposition( "nuked", zombies[i].origin );
}
}
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
Untested Template

Code Snippet
Plaintext
run_zombie_check()
{
zombies = getaiarray("axis");
array_thread(zombies,::dist_check);
}

dist_check()
{
max_dist_for_respawn = 2000;
too_far_away = false;
all_players = GetPlayers();
while(1)
{
for(i = 0; i < all_players.size; i++)
{
zombie_distance = Distance(all_players[i].origin, self.origin);
if( zombie_distance >= max_dist_for_respawn)
{
too_far_away = true;
}
else
{
too_far_away = false;
break;
}
}
if(too_far_away == true)
{
self dodamage((self.health * 100), self.origin);
//level.zombie_total++; //May not work when the round_spawning function in zombiemode.gsc has finished it's while flow
//Could try making a seperate spawn script to spawn a zombie before killing this one which would keep the wave alive.
}
wait(1);
}
}
broken avatar :(
×
broken avatar :(
Location: usconverse tx
Date Registered: 20 June 2013
Last active: 1 year ago
Posts
85
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
NaviLlicious's Groups
NaviLlicious's Contact & Social LinksNaviLliciousNaviLlusShore
Untested Template

Code Snippet
Plaintext
run_zombie_check()
{
zombies = getaiarray("axis");
array_thread(zombies,::dist_check);
}

dist_check()
{
max_dist_for_respawn = 2000;
too_far_away = false;
all_players = GetPlayers();
while(1)
{
for(i = 0; i < all_players.size; i++)
{
zombie_distance = Distance(all_players[i].origin, self.origin);
if( zombie_distance >= max_dist_for_respawn)
{
too_far_away = true;
}
else
{
too_far_away = false;
break;
}
}
if(too_far_away == true)
{
self dodamage((self.health * 100), self.origin);
//level.zombie_total++; //May not work when the round_spawning function in zombiemode.gsc has finished it's while flow
//Could try making a seperate spawn script to spawn a zombie before killing this one which would keep the wave alive.
}
wait(1);
}
}
Sorry for the late reply, tried this script but when I get really far from the zombies they don't die/respawn
Last Edit: May 27, 2014, 10:09:10 pm by NaviLlicious
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
Did you create a new gsc for this and execute it correctly (may need to adjust max distance variable a little lower)
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 years ago
Posts
942
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
because it gets an array of the zombies of zombies once. that means i gets a list of 1 zombies at game start. then a new zombie spawn outside that array. so code wont affect it

Post Merge: May 27, 2014, 10:36:35 pm
this will work using your code but i would do this stuff using zombiemodespawner. no need of getting arrays.
Code Snippet
Plaintext
run_zombie_check()
{
while(1)
{
zombies = getaiarray("axis");
array_thread(zombies,::dist_check);
wait 10;
}
}
Last Edit: May 27, 2014, 10:36:35 pm by jjbradman
broken avatar :(
×
broken avatar :(
Location: usconverse tx
Date Registered: 20 June 2013
Last active: 1 year ago
Posts
85
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
NaviLlicious's Groups
NaviLlicious's Contact & Social LinksNaviLliciousNaviLlusShore
Did you create a new gsc for this and execute it correctly (may need to adjust max distance variable a little lower)
Yeah I made a new .gsc for It I will try to make the distance smaller

Post Merge: May 27, 2014, 10:37:29 pm
because it gets an array of the zombies of zombies once. that means i gets a list of 1 zombies at game start. then a new zombie spawn outside that array. so code wont affect it

Post Merge: May 27, 2014, 10:36:35 pm
this will work using your code but i would do this stuff using zombiemodespawner. no need of getting arrays.
Code Snippet
Plaintext
run_zombie_check()
{
while(1)
{
zombies = getaiarray("axis");
array_thread(zombies,::dist_check);
wait 10;
}
}
I will also try this thanks guys
Last Edit: May 27, 2014, 10:37:29 pm by NaviLlicious
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
Thats the thing you'd run zombie_check through a loop.

However I came up with a better idea which envoles the second function but as a defined function to an ai through round spawning in zombiemode gsc.

The previous script was just a quick knock up untested idea.



I'll post my new idea up in script form tomorrow. bit late for me right now, so I'll edit this part out.
Last Edit: May 27, 2014, 10:41:28 pm by DuaLVII
broken avatar :(
×
broken avatar :(
Location: usconverse tx
Date Registered: 20 June 2013
Last active: 1 year ago
Posts
85
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
NaviLlicious's Groups
NaviLlicious's Contact & Social LinksNaviLliciousNaviLlusShore
Thats the thing you'd run zombie_check through a loop.

However I came up with a better idea which envoles the second function but as a defined function to an ai through round spawning in zombiemode gsc.

The previous script was just a quick knock up untested idea.



I'll post my new idea up in script form tomorrow. bit late for me right now, so I'll edit this part out.
Alright I appreciate the help guys thanks a bunch
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 years ago
Posts
942
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
search self thread zombie_damage_failsafe(); in zombiemodespawner and add
Code Snippet
Plaintext
self thread check_distance();

then add this to the bottom of the file
Code Snippet
Plaintext
check_distance()
{
while(1)
{
all_players = GetPlayers();
for(i = 0; i < all_players.size; i++)
{
zombie_distance = Distance(all_players[i].origin, self.origin);
if( zombie_distance >= level.max_dist_for_respawn)
{
self.too_far_away = true;
}
else
{
self.too_far_away = false;
break;
}
}

if(self.too_far_away == true)
{

zombie = spawn_zombie( spawner );//here you need get your spawners somehow and check distance to select one close to the player
//HEY HERE!!!!
zombie.team = "axis";
zombie thread dozombiestuff();

self dodamage((self.health * 100), self.origin);
//level.zombie_total++; //May not work when the round_spawning function in zombiemode.gsc has finished it's while flow
//Could try making a seperate spawn script to spawn a zombie before killing this one which would keep the wave alive.
}

wait 1;
}
}
and add this
Code Snippet
Plaintext
	level.max_dist_for_respawn = 2000;


under this
Code Snippet
Plaintext
init()
{

edit: add this at the bottom of the file also
Code Snippet
Plaintext
dozombiestuff()
{
self thread zombie_spawn_init("zombie");
self thread zombie_think();
self thread zombie_setup_attack_properties();
//self thread find_flesh(); i dont rememebr if you need this one
}
Last Edit: May 28, 2014, 03:40:59 am by jjbradman

 
Loading ...