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

Closing off a room when you leave

broken avatar :(
Created 10 years ago
by rrdallas22
0 Members and 1 Guest are viewing this topic.
3,423 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 27 November 2015
Last active: 10 years ago
Posts
4
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
rrdallas22's Groups
rrdallas22's Contact & Social Links
Hey guys, I'm in the middle of working on a map, and can't quite figure something out.

So what I'm aiming for is, you get past the debris into one area, and then when you buy the next to leave that area, it blocks the entrance so you can't go back. Does anyone know of any way to do this?
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: usNUKETOWN
Date Registered: 19 February 2014
Last active: 9 years ago
Posts
177
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Zombie Specialist
Signature
×
thezombieproject's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
i remember doing this for someone a few months ago.  what do u want to happen to the zombies that get stuck on the other side after door closes? Theres a few options, make an alternative root for the zombies to go around or , waittill all zombies and players are out of the room before closing door or, kill any zombies left behind or ,  teleport zombies to a valid zone. 
I have a script for this that you can use but what do you want the zombies to do after door closes?
also


broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 27 January 2015
Last active: 10 years ago
Posts
337
Respect
Forum Rank
Perk Hacker
Primary Group
Member
Signature
×
liamsa669's Groups
liamsa669's Contact & Social Links
i remember doing this for someone a few months ago.  what do u want to happen to the zombies that get stuck on the other side after door closes? Theres a few options, make an alternative root for the zombies to go around or , waittill all zombies and players are out of the room before closing door or, kill any zombies left behind or ,  teleport zombies to a valid zone. 
I have a script for this that you can use but what do you want the zombies to do after door closes?
also
do what treyarch does for rituals in SOE. KIll all the zombies in the area and respawn them in the new area.
Code Snippet
Plaintext
func_for_debris{
level.trigger_targetname = "TARGETNAME_OF_TRIGGER_4_DEBRIS"; // replace the caps letters, this is the buy trigger
level.block_clip = "TARGETNAME_OF_MESH_TO_BLOCK"; // replace the caps letters, this is the mesh that blocks the way
level.newloc = "TARGETNAME_OF_MESH_TO_BLOCK"; // replace the caps letters, this is the script origin that the zombies that died will spawn at
level.zone_targetname = "TARGETNAME_OF_INSIDE_TRIGGER"; // replace the caps letters, this is the inside trigger

trigger = getent(level.trigger_targetname,"targetname");
//init the trigger
cost = 1000;
if( IsDefined( trigger.zombie_cost ) )
{
cost = trigger.zombie_cost;
}
trigger set_hint_string( trigger, "default_buy_debris_" + cost );
trigger SetCursorHint( "HINT_NOICON" );
if( isdefined (trigger.script_flag)  && !IsDefined( level.flag[trigger.script_flag] ) )
{
flag_init( trigger.script_flag );
}
trigger UseTriggerRequireLookAt();
//end init
while( 1 )
{
trigger waittill( "trigger", who );

if( !who UseButtonPressed() )
{
continue;
}

if( who in_revive_trigger() )
{
continue;
}

if( is_player_valid( who ) )
{
if( who.score >= trigger.zombie_cost )
{
// set the score
who maps\_zombiemode_score::minus_to_player_score( trigger.zombie_cost );
if( isDefined( level.achievement_notify_func ) )
{
level [[ level.achievement_notify_func ]]( "DLC3_ZOMBIE_ALL_DOORS" );
}
bbPrint( "zombie_uses: playername %s playerscore %d round %d cost %d name %s x %f y %f z %f type debris", who.playername, who.score, level.round_number, trigger.zombie_cost, trigger.target, trigger.origin );

// delete the stuff
junk = getentarray( trigger.target, "targetname" );

if( IsDefined( trigger.script_flag ) )
{
flag_set( trigger.script_flag );
}

play_sound_at_pos( "purchase", trigger.origin );

move_ent = undefined;
clip = undefined;
for( i = 0; i < junk.size; i++ )
{
junk[i] connectpaths();
junk[i] add_new_zombie_spawners();


level notify ("junk purchased");

if( IsDefined( junk[i].script_noteworthy ) )
{
if( junk[i].script_noteworthy == "clip" )
{
clip = junk[i];
continue;
}
}

struct = undefined;
if( IsDefined( junk[i].script_linkTo ) )
{
struct = getstruct( junk[i].script_linkTo, "script_linkname" );
if( IsDefined( struct ) )
{
move_ent = junk[i];
junk[i] thread debris_move( struct );
}
else
{
junk[i] Delete();
}
}
else
{
junk[i] Delete();
}
}

// get all trigs, we might want a trigger on both sides
// of some junk sometimes
all_trigs = getentarray( trigger.target, "target" );
for( i = 0; i < all_trigs.size; i++ )
{
all_trigs[i] delete();
}

if( IsDefined( clip ) )
{
if( IsDefined( move_ent ) )
{
move_ent waittill( "movedone" );
move_ent notsolid();
}

clip Delete();
}
newclipfunc();
break;
}
else
{
play_sound_at_pos( "no_purchase", trigger.origin );
// who thread maps\nazi_zombie_sumpf_blockers::play_no_money_purchase_dialog();
}
}
}
}
newclipfunc(){
player[0]._inzone = false;
player[1]._inzone = false;
player[2]._inzone = false;
player[3]._inzone = false;
players = get_players();
trigger = getent(level.zone_targetname,"targetname");
while(1){
for(i=0;i<players.size;i++){
if(players[i] istouching(trigger)){
player[i]._inzone = true;
if(player.size == 4){
if(player[0]._inzone && player[1]._inzone && player[2]._inzone && player[3]._inzone)
{
blockit();
}
}else if(player.size == 3){
if(player[0]._inzone && player[1]._inzone && player[2]._inzone)
{
blockit();
}
}else if(player.size == 2){
if(player[0]._inzone && player[1]._inzone)
{
blockit();
}
}else if(player.size == 1){
if(player[0]._inzone)
{
blockit();
}

}
}else{
player[i]_inzone = false;
}
}
}
}
bockit(){
level.zombies_kilt = 0;
clip = getentarray(level.block_clip,"targetname"); // targetname of the mesh(s) to block the enterence
newloc = getent(level.newloc,"targetname");
zombies1 = getEntArray( "zombie_spawner", "script_noteworthy" );
zombies1 = getEntArray( "zombie_spawner", "script_noteworthy" );
later_rounds = getentarray("later_round_spawners", "script_noteworthy" );
trigger = getent(level.zone_targetname,"targetname");
for(i=0;i<clip.size;i++){
clip[i] movez(50,1); // 50 is how many units it will move up, 1 is the speed
}
zombies = GetAiArray( "axis" , "all" );
for(i=0;i<zombies.size;i++){
if(zombies[i] !istouching(trigger))
{
level.zombies_kilt++;
}
}
for(i=0;i<level.zombies_kilt;i++){
//if(level.round_number < HIGHROUND)
/*{
zombie = spawn_zombie( later_rounds[0] );
zombie maps\_zombiemode_spawner::zombie_think();
}*/
zombie = spawn_zombie( zombies1[0] );
zombie maps\_zombiemode_spawner::zombie_think();
zombie forceTeleport(newloc.origin);
}
}
this is untested, but should work. This moves meshes up (from 50 units below) to block the path, but feel free replace it. You need a script_origin to spawn the zombies at, the debris with its trigger, the meshes to block the path, and a trigger_multiple to cover everywhere that accessable after the point is cut off. Give these all targetnames and replace the capital letters in the first few lines of the script
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 27 November 2015
Last active: 10 years ago
Posts
4
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
rrdallas22's Groups
rrdallas22's Contact & Social Links
I was thinking wait until the end of the round and then close it off. The biggest problem I ran into is deactivating the spanners, as I couldn't find any way to do that.
Marked as best answer by rrdallas22 10 years ago
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 27 January 2015
Last active: 10 years ago
Posts
337
Respect
Forum Rank
Perk Hacker
Primary Group
Member
×
liamsa669's Groups
liamsa669's Contact & Social Links
I was thinking wait until the end of the round and then close it off. The biggest problem I ran into is deactivating the spanners, as I couldn't find any way to do that.
deactivate zones instead :D this is found in the zone mananger:
Code Snippet
Plaintext
			// The zone is not active so disable the spawners
else
{
// Making an assumption that if one of the zone's spawners
// is in the array, then all of them are in the array
if ( level.zones[ zone_name ].spawners.size > 0 )
{
no_dupes = array_check_for_dupes( level.enemy_spawns, level.zones[ zone_name ].spawners[0] );
if( !no_dupes )
{
for(x=0;x<level.zones[ zone_name ].spawners.size;x++)
{
level.zones[ zone_name ].spawners[x].locked_spawner = true;
level.enemy_spawns = array_remove_nokeys(level.enemy_spawns, level.zones[ zone_name ].spawners[x]);
}
}
}

// Making an assumption that if one of the zone's spawners is in the array, then all of them are in the array
if ( level.zones[ zone_name ].dog_spawners.size > 0 )
{
no_dupes = array_check_for_dupes( level.enemy_dog_spawns, level.zones[ zone_name ].dog_spawners[0] );
if( !no_dupes )
{
for(x=0;x<level.zones[ zone_name ].dog_spawners.size;x++)
{
level.enemy_dog_spawns = array_remove_nokeys(level.enemy_dog_spawns, level.zones[ zone_name ].dog_spawners[x]);
}
}
}

// deactivate any associated dog spawn locations
if ( level.zones[ zone_name ].dog_locations.size > 0 )
{
// Making an assumption that if one of the structs is in the array, then all of them are in the array
no_dupes = array_check_for_dupes(level.enemy_dog_locations, level.zones[ zone_name ].dog_locations[0]);
if( !no_dupes )
{
for(x=0; x<level.zones[ zone_name ].dog_locations.size; x++)
{
level.zones[ zone_name ].dog_locations[x].locked_spawner = false;
level.enemy_dog_locations = array_remove_nokeys(level.enemy_dog_locations, level.zones[ zone_name ].dog_locations[x]);
}
}
}
// deactivate any associated zombie_rise locations
if ( level.zones[ zone_name ].rise_locations.size > 0 )
{
// Making an assumption that if one of the zone's spawners
// is in the array, then all of them are in the array
no_dupes = array_check_for_dupes(level.zombie_rise_spawners, level.zones[ zone_name ].rise_locations[0]);
if( !no_dupes )
{
for(x=0; x<level.zones[ zone_name ].rise_locations.size; x++)
{
level.zones[ zone_name ].rise_locations[x].locked_spawner = false;
level.zombie_rise_spawners = array_remove_nokeys(level.zombie_rise_spawners, level.zones[ zone_name ].rise_locations[x]);
}
}
}
}
}
do with it as you please
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 27 November 2015
Last active: 10 years ago
Posts
4
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
rrdallas22's Groups
rrdallas22's Contact & Social Links
So when I want to deactivate, I would just set

level.zones[ "zone_name" ].is_active = false;

and this will subsequently disable all spawners?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 27 January 2015
Last active: 10 years ago
Posts
337
Respect
Forum Rank
Perk Hacker
Primary Group
Member
×
liamsa669's Groups
liamsa669's Contact & Social Links
So when I want to deactivate, I would just set

level.zones[ "zone_name" ].is_active = false;

and this will subsequently disable all spawners?
i dont really know, I just took the code they use to disable the zone if no one is in it. Im way too tired to read it
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Signature
If you want scripts / features made for you, then contact me by PM or email / skype etc
it will cost you tho so if you have no intention of reciprocating don't even waste my time ;)
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
i dont really know, I just took the code they use to disable the zone if no one is in it. Im way too tired to read it
basically the same as the adjacent "one way" zone code

 
Loading ...