Modme Forums

Help with zoning and spawning via script?

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: CrossScissors
Hey everyone, I hope I'm clear on what I'm saying but I made a working portal script for my map but I tried to make it that when you warp to the new zone, all the zombies dies in the last zone you were in and respawns to the location you're in right now.



Problem is, when I teleport, every zombies dies (like it should) but instead of respawning them to my location, it skips the round like if a player killed them and when the round begins, the zombies only spawns in the first zone but still dies there so the round keeps skipping and no zombies spawns in the new zone :/



I know that the new zone is activated because I don't hear the Samantha laugh when I'm there and I'm not dying...

I also know that the first zone remains activated because when I noclip there, I can't hear the laugh either.



I'm using

init_zones[0] = "city_zone";

to enable the zone called "city_zone" and I'm using the "trigger_hurt" object to kill zombies if that can bring any help.

I can also post a video/the script if necessary





How do I make it so that when every player are in the new zone, it disables the first zone (to prevent zombies from spawning there) and teleports all the remaining zombies to the new zone?


ModmeBot:

Reply By: natesmithzombies
I wouldn't go about it the way you are. I would do something along these lines (at least at first thought):



1) Check to see if player is touching a trigger_box defined as the zone for the teleporter

2) Player SetOrigin(new_origin); then at this point the zombies will go to the last known origin of the player

3) Then check if the zombies are touching that same trigger zom ForceTeleport(new_origin);



You introduce a new level of difficulty by killing the zombies. There is a way to way to stop the subtraction of the zombies by doing level.zombie_total++; before you kill them though.



As for the zones, I would need to look into this a bit more. From a glimpse it appears level.zones[zone_name].is_enabled = false or level.zones[zone_name].is_active = false might solve your problem, but I would have to look into it more to really understand. At some point I will be looking at a teleportation system like SOE or Revelations, but for now I am focused on AI. Check out _zm_zonemgr.gsc to see the syntax they use for zones.


ModmeBot:

Reply By: CrossScissors

natesmithzombiesI wouldn't go about it the way you are. I would do something along these lines (at least at first thought):



1) Check to see if player is touching a trigger_box defined as the zone for the teleporter

2) Player SetOrigin(new_origin); then at this point the zombies will go to the last known origin of the player

3) Then check if the zombies are touching that same trigger zom ForceTeleport(new_origin);



You introduce a new level of difficulty by killing the zombies. There is a way to way to stop the subtraction of the zombies by doing level.zombie_total++; before you kill them though.



As for the zones, I would need to look into this a bit more. From a glimpse it appears level.zones[zone_name].is_enabled = false or level.zones[zone_name].is_active = false might solve your problem, but I would have to look into it more to really understand. At some point I will be looking at a teleportation system like SOE or Revelations, but for now I am focused on AI. Check out _zm_zonemgr.gsc to see the syntax they use for zones.


Thanks for the reply! Sorry if the wall of text below is long...

I already did the 2 first steps here if you want to take a look at it: (at line 1 and 14-17)

tele_1 waittill("trigger", player);   //check if player is touching the trigger
		
		if(level.teleporting == 0)        //if 0 players are teleporting
		{
		
		  level.teleporting++;    //tell the game that +1 player is tping
		 
		  player DisableWeapons();
		  player DisableOffhandWeapons();
		
		  wait(0.2);

		  player FreezeControls(true);                       //teleport player to black box + disables controls and weapons
	          player SetOrigin(intermission.origin);  
	   	  player setplayerangles(intermission.angles);
		  
		  level.main_zone_population++;
		  level.teleporter_zone_population--;
		  
		  thread enable_city();        //enables city_zone
                  thread check_population();        //check how many players are in the zones
		
		  player playsound("teleport_start");	
		  wait(2.41);

		  player FreezeControls(false);         //teleport player to outpout portal + enables controls and weapons
	          player SetOrigin(nachtport.origin);
		  player setplayerangles(nachtport.angles);
		
		  player playsound("teleport_end");
		  wait(0.8);
		
		  player EnableWeapons();
		  player EnableOffhandWeapons();
	
		  level.teleporting--;	   //tell game that player is no longer tping

		  thread teleporting_done();          //debug message
		}



and this for zoning

function enable_city()
{
	while(1)
	{
		self waittill(level.teleporter_zone_population >= 1); //check if the city_zone is populated by at least 1 player

		if(level.teleporter_zone_population >= 1) //same as above
		{
			IPrintLn("city zone enabled");                   //Debug message
			level flag::init( "death_spawn" );               //Flags for the trigger_hurt
			level flag::init( "death_city" );
			level flag::init( "no_death_city" );
			level flag::init( "no_death_spawn" );
			level flag::set("death_spawn");
			level flag::set("no_death_city");
			level flag::delete( "death_city_set" );
			level flag::delete( "no_death_spawn_set" );
	        init_zones[0] = "city_zone";                             //enables the zones
	        init_zones[1] = "start_zone";
	        level thread zm_zonemgr::manage_zones( init_zones );
	        level flag::init( "always_on" );
	        level flag::set( "always_on" );
		}

		break;
	}
}

function check_population()       //opposite of above
{
	while(1)
	{
		self waittill(level.teleporter_zone_population <= 0); //check if city_zone has 0 players

		if(level.teleporter_zone_population <= 0) //same as above
		{
			IPrintLn("city zone disabled");      //message
			level flag::init( "death_spawn" );              //trigger_hurt flags
			level flag::init( "death_city" );
			level flag::init( "no_death_city" );
			level flag::init( "no_death_spawn" );
			level flag::set("no_death_spawn");
			level flag::set("death_city");
			level flag::delete( "no_death_city_set" );
			level flag::delete( "death_spawn_set" );
	        init_zones[0] = "start_zone";                           //zoning
	        init_zones[1] = "city_zone";
	        level thread zm_zonemgr::manage_zones( init_zones );
	    	level flag::init( "always_on" );
	        level flag::set( "always_on" );
		}

		break;
	}
}



But I haven't thought about teleporting the zombies trough the portal! Thing is, I don't really know how to set the path of zombies to the trigger (or does it do it automatically) and I don't really understand how or where to use "zom ForceTeleport(new_origin);" , does the game automatically sees "zom" as zombies or do I have to tell the game what "zom" is?



For the trigger to detect zombies, do I just put in

tele_1 waittill("trigger", zom);

?

Finally, for the zoning, I looked up _zm_zonemgr.gsc but it's not really clear on what can disable zones. It used to work before but now it won't work and I don't know why...





Again, sorry if this is too long, I'm just tired of this problem as I spent my entire weekend trying to figure out why it won't work without good results :(


ModmeBot:

Reply By: natesmithzombies
Its alright man. Its kind of hard to interpret whats going on with what you have coded. But to answer a few of your questions:

zoms = GetAISpeciesArray("axis"); // Gets an array of all of the zombies 

"zom" in my example above was just an example to show you to run the function on the zombie and yeah the zombies will go to the last known player origin if the player teleports. If you dont quite feel comfortable making sense of treyarch code you might want to give the scripting wiki I wrote a read through. It will clarify a lot of things that might seem confusing. You can find that here.


ModmeBot:

Reply By: CrossScissors

natesmithzombiesIts alright man. Its kind of hard to interpret whats going on with what you have coded. But to answer a few of your questions:

zoms = GetAISpeciesArray("axis"); // Gets an array of all of the zombies 

"zom" in my example above was just an example to show you to run the function on the zombie and yeah the zombies will go to the last known player origin if the player teleports. If you dont quite feel comfortable making sense of treyarch code you might want to give the scripting wiki I wrote a read through. It will clarify a lot of things that might seem confusing. You can find that here.


Thanks for the quick answer! Sorry if I wasn't clear enough :/

It's my first time using this language, I have done javascript, and a bit of c++ and java before but this is new territory for me so I'll be sure to check out the wiki!

last question tough, in the example you just gave me :

zoms = GetAISpeciesArray("axis");



does this line defines what zombies are? So if I used this for example:

baddies = GetAISpeciesArray("axis");



That would mean that all the zombies in the map would now be defined as "baddies" or is "axis" an example that you gave me?

I'll be sure to check out the wiki too for my future scripting needs and if I have more questions later, I'll be sure to post on here as this community seems really good when it comes to helping :)



Again, thanks in advance! I'll also make sure to add you to add you to the credits in the next update!



Edit: Okay so removing the trigger_hurt seems to have made the zoning work again, now everything should be fine only only for the fact that zombies are not going to the portal (the last known player origin), they just stand where they are and stop moving until the player goes back in the room so is there a script to set their target so they can go to the portal? I haven't found any documentation on zombies paths so any help would be appreciated!


ModmeBot:

Reply By: natesmithzombies
Hmm that is interesting because in my Kino Teleporter Script they always went to the last known origin of the player. If that isnt the case for you, use this function on the zombies to set their new goal position:


ModmeBot:

Reply By: CrossScissors

natesmithzombiesHmm that is interesting because in my Kino Teleporter Script they always went to the last known origin of the player. If that isnt the case for you, use this function on the zombies to set their new goal position:



Okay, I will try this tonight, Thanks for the help! :)


ModmeBot:

Reply By: natesmithzombies

CrossScissorsOkay, I will try this tonight, Thanks for the help! :)


No problem :D