Game Modding | Call of Duty: Black Ops 3 | Scripting
ModmeBot:
Thread By: mathfag
TUTORIAL:
How to make zombies stop spawning.
You can use this for an easter egg step like in Gorod Krovi, where there are no zombies when Sophia talks
to pause spawning:
SetDvar("ai_DisableSpawn",1);
to continue spawning:
SetDvar("ai_DisableSpawn",0);
to kill all of the zombies (1/2):
zombies = zombie_utility::get_round_enemy_array();
if ( isdefined( zombies ) )
{
array::run_all( zombies, &Kill );
}
to kill all of the zombies (2/2):
#using scripts\shared\ai\zombie_utility;
#using scripts\shared\array_shared;
note:
this will stop all ai including NSZ brutus
ModmeBot:
Reply By: Abnormal202
Useful stuff. I also found you can use:
level flag::clear( "spawn_zombies" );
level flag::set( "spawn_zombies" );
ModmeBot:
Reply By: XxRaPiDK3LLERxX
But what if you want the zombies to die when using let's say, a teleporter to teleport far away? Since my map involves a lot of teleportation.
ModmeBot:
Reply By: Abnormal202
XxRaPiDK3LLERxX
But what if you want the zombies to die when using let's say, a teleporter to teleport far away? Since my map involves a lot of teleportation.
ModmeBot:
Reply By: Zombeast250
so i am just wanting to clear all the zombies (not kill) and start them spawning again/respawn them again after teleport is complete what lines of code will make this happen?
this is the code:
function player_teleporter_init()
{
player_tp = GetEntArray( "teleport_player", "targetname" );
for( i = 0; i < player_tp.size; i++ )
{
player_tpthread player_teleport();
}
}
function player_teleport()
{
destination = GetEnt( self.target, "targetname" );
while(1)
{
self waittill( "trigger", player );
player SetOrigin( destination.origin );
player SetPlayerAngles( destination.angles );
wait(0.05);
PlaySoundAtPosition( "beast_teleplayer1", player.origin ); // sound made when teleporting
//self PlaySound("beast_teleplayer1"); // not working
//player PlayLocalSound("beast_teleplayer1"); //works
}
}
ModmeBot:
Reply By: Abnormal202
Zombeast250what do you mean by clear the zombies (not kill)? You can either kill them, or stop spawning. Now, zombies will respawn if they can't find a path to the player within a certain time, so you could just keep the script how it is and just put spawns where the players teleport to, and they would start respawning there. If you wanted, you could teleport the zombies to there, that would get them there faster. If that's the case put this:
so i am just wanting to clear all the zombies (not kill) and start them spawning again/respawn them again after teleport is complete what lines of code will make this happen? this is the code: function player_teleporter_init(){ player_tp = GetEntArray( "teleport_player", "targetname" ); for( i = 0; i < player_tp.size; i++ ) { player_tpthread player_teleport(); }} function player_teleport(){ destination = GetEnt( self.target, "targetname" ); while(1) { self waittill( "trigger", player ); player SetOrigin( destination.origin ); player SetPlayerAngles( destination.angles ); wait(0.05); PlaySoundAtPosition( "beast_teleplayer1", player.origin ); // sound made when teleporting //self PlaySound("beast_teleplayer1"); // not working //player PlayLocalSound("beast_teleplayer1"); //works }}
zombies = GetAiSpeciesArray( "axis", "all" );
zombie_destinations = struct::get_array("zombie_destination","targetname");
for(i=0;i<zombies.size;i++) {="" rand="RandomIntRange(" 0,="" zombie_destinations.size="" );="" zombies[i]="" setorigin(="" zombie_destinations[rand].origin="" );="" zombies[i]="" setplayerangles(="" zombie_destinations[rand].angles="" );="" wait(0.25);="" time="" between="" zombie="" teleportation.="" don't="" put="" 0,="" as="" i'm="" worried="" it="" could="" cause="" errors.=""></zombies.size;i++)>
player SetPlayerAngles( destination.angles );
ModmeBot:
Reply By: Zombeast250
does this look right?
function player_teleport()
{
destination = GetEnt( self.target, "targetname" );
while(1)
{
self waittill( "trigger", player );
player SetOrigin( destination.origin );
player SetPlayerAngles( destination.angles );
zombies = GetAiSpeciesArray( "axis", "all" );
zombie_destinations = struct::get_array("zombie_destination","targetname");
for(i=0;i<zombies.size;i++) {="" rand="RandomIntRange(" 0,="" zombie_destinations.size="" );="" zombies[i]="" setorigin(="" zombie_destinations[rand].origin="" );="" zombies[i]="" setplayerangles(="" zombie_destinations[rand].angles="" );="" wait(0.25);="" time="" between="" zombie="" teleportation.="" don't="" put="" 0,="" as="" i'm="" worried="" it="" could="" cause="" errors.="" }="" wait(0.05);="" playsoundatposition(="" "beast_teleplayer1",="" player.origin="" );="" sound="" made="" when="" teleporting="" self="" playsound("beast_teleplayer1");="" not="" working="" player="" playlocalsound("beast_teleplayer1");="" works="" }=""></zombies.size;i++)>
ModmeBot:
Reply By: Abnormal202
tab { and } forward once
ModmeBot:
Reply By: Zombeast250
Abnormal202
tab { and } forward once
ModmeBot:
Reply By: Zombeast250
also does the trigger need to be linked (w) to the struct?
ModmeBot:
Reply By: Abnormal202
Zombeast250
also does the trigger need to be linked (w) to the struct?
{
rand = RandomIntRange( 0, zombie_destinations.size );
zombies[i] SetOrigin( zombie_destinations[rand].origin );
zombies[i] SetPlayerAngles( zombie_destinations[rand].angles );
wait(0.25); //Time between zombie teleportation. Don't put 0, as I'm worried it could cause errors.
}
{
rand = RandomIntRange( 0, zombie_destinations.size );
zombies[i] SetOrigin( zombie_destinations[rand].origin );
zombies[i] SetPlayerAngles( zombie_destinations[rand].angles );
wait(0.25); //Time between zombie teleportation. Don't put 0, as I'm worried it could cause errors.
}
ModmeBot:
Reply By: Zombeast250
sorry this is the code:
function player_teleporter_init()
{
player_tp = GetEntArray( "teleport_player", "targetname" );
for( i = 0; i < player_tp.size; i++ )
{
player_tp[i] thread player_teleport();
}
}
function player_teleport()
{
destination = GetEnt( self.target, "targetname" );
while(1)
{
self waittill( "trigger", player );
player SetOrigin( destination.origin );
player SetPlayerAngles( destination.angles );
zombies = GetAiSpeciesArray( "axis", "all" );
zombie_destinations = struct::get_array("zombie_destination","targetname");
for(i=0;i<zombies.size;i++) {="" rand="RandomIntRange(" 0,="" zombie_destinations.size="" );="" zombies[i]="" setorigin(="" zombie_destinations[rand].origin="" );="" zombies[i]="" setplayerangles(="" zombie_destinations[rand].angles="" );="" wait(0.25);="" time="" between="" zombie="" teleportation.="" don't="" put="" 0,="" as="" i'm="" worried="" it="" could="" cause="" errors.="" }="" wait(0.05);="" playsoundatposition(="" "beast_teleplayer1",="" player.origin="" );="" sound="" made="" when="" teleporting="" self="" playsound("beast_teleplayer1");="" not="" working="" player="" playlocalsound("beast_teleplayer1");="" works="" }=""></zombies.size;i++)>