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

[Tutorial] Survive Rounds To Open Doors [Update: 1-7-2015]

broken avatar :(
Created 9 years ago
by alaurenc9
0 Members and 1 Guest are viewing this topic.
4,463 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2012
Last active: 9 months ago
Posts
577
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Signature
My preferred name is "xSanchez78".
Check me out here: www.steamcommunity.com/id/xSanchez78
×
alaurenc9'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.
alaurenc9's Contact & Social LinksxSanchez78xSanchez78xSanchez78xSanchez78xSanchez78xSanchez78
Hello guys.
Today I have made an awesome script.
It is where you use a trigger, survive rounds, and then a door opens.
Here is how to use it.

Here is the script:
Code Snippet
Plaintext
//================================================================================================
// Script Name  : Door That Opens After Rounds Are Survived
// Author : xSanchez78
// Notes : call "maps\_survive_rounds::main();" before "maps\_zombiemode::main();" in "mapname.gsc".
//================================================================================================
#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;
#using_animtree( "generic_human" );

main()
{
level.running_a_round = false;
door_trigger = GetEntArray("rounds_survive_doors", "targetname");
array_thread( door_trigger, ::init_flags );
array_thread( door_trigger, ::door_think );
}

init_flags()
{
if( isdefined( self.script_flag ) && !IsDefined( level.flag[self.script_flag] ) )
{
flag_init( self.script_flag );
}
}

door_think()
{
door_array = "";
if( isDefined( self.target ) )
{
door_array = self.target;
}
flag_to_set = "";
if( isdefined( self.script_flag ) )
{
flag_to_set = self.script_flag;
}
rounds_to_survive = 0;
if( isDefined( self.script_noteworthy ) )
{
rounds_to_survive = self.script_noteworthy;
}
cost = 0;
if( isDefined( self.zombie_cost ) )
{
cost = self.zombie_cost;
}
hint = "Press &&1 to Activate 'Survive " + rounds_to_survive + " Rounds' Mode";
if( cost != 0 )
{
hint = "Press &&1 to Activate 'Survive " + rounds_to_survive + " Rounds' Mode [Cost: " + cost + "]";
}
targets = GetEntArray( door_array, "targetname" );
for( i = 0; i < targets.size; i++ )
{
targets[i] disconnectpaths();
if( IsDefined( targets[i].script_noteworthy ) && targets[i].script_noteworthy == "clip" )
{
self.clip = targets[i];
self.script_string = "clip";
}
else if( !IsDefined( targets[i].script_string ) )
{
if( IsDefined( targets[i].script_angles ) )
{
targets[i].script_string = "rotate";
}
else if( IsDefined( targets[i].script_vector ) )
{
targets[i].script_string = "move";
}
}
else
{
if ( targets[i].script_string == "anim" )
{
AssertEx( IsDefined( targets[i].script_animname ), "Blocker_init: You must specify a script_animname for "+targets[i].targetname );
AssertEx( IsDefined( level.scr_anim[ targets[i].script_animname ] ), "Blocker_init: You must define a level.scr_anim for script_anim -> "+targets[i].script_animname );
AssertEx( IsDefined( level.blocker_anim_func ), "Blocker_init: You must define a level.blocker_anim_func" );
}
}
}
self.doors = targets;
self setHintString( hint );
self SetCursorHint( "HINT_NOICON" );
self UseTriggerRequireLookAt();
while(1)
{
self waittill("trigger", player);
if(level.running_a_round)
{
iprintlnbold ( "You're In The Middle Of Surviving A Set Of Rounds" );
continue;
}
if( player in_revive_trigger() )
{
continue;
}
if( !is_player_valid( player ) )
{
continue;
}
if( cost != 0 )
{
if(player.score < cost)
{
player playsound("deny");
continue;
}
player playsound("cha_ching");
player maps\_zombiemode_score::minus_to_player_score( cost );
}
self setHintString( "" );
break;
}
level.running_a_round = true;
if( rounds_to_survive != 0 )
{
iprintlnbold ( "Survive " + rounds_to_survive + " Rounds To Open The Doors" );
texthud = newHudElem();
texthud.foreground = true;
        texthud.sort = 1;
        texthud.hidewheninmenu = false;
texthud.alignX = "center";
texthud.alignY = "top";
texthud.horzAlign = "center";
texthud.vertAlign = "top";
texthud.x = 0;
texthud.y =  18;
texthud.fontscale = 1.5;
texthud.color = ( 1.0, 1.0, 1.0 );
texthud.alpha = 1;
for( rounds_survived = 0; rounds_survived < rounds_to_survive; rounds_survived++ )
{
texthud setText("Rounds to Survive: " + (rounds_to_survive - rounds_survived));
wait_a_round();
}
texthud Destroy();
iprintlnbold (rounds_to_survive + " Rounds Survived, Doors Have Been Opened");
}
level.running_a_round = false;
for( i = 0; i < self.doors.size; i++ )
{
self.doors[i] NotSolid();
self.doors[i] connectpaths();
if( IsDefined( self.doors[i].door_moving ) )
{
continue;
}
self.doors[i].door_moving = 1;
if( ( IsDefined( self.doors[i].script_noteworthy ) && self.doors[i].script_noteworthy == "clip" ) || ( IsDefined( self.doors[i].script_string ) && self.doors[i].script_string == "clip" ) )
{
continue;
}
if( IsDefined( self.doors[i].script_sound ) )
{
play_sound_at_pos( self.doors[i].script_sound, self.doors[i].origin );
}
else
{
play_sound_at_pos( "door_slide_open", self.doors[i].origin );
}
time = 2;
if( IsDefined( self.doors[i].script_transition_time ) )
{
time = self.doors[i].script_transition_time;
}
switch( self.doors[i].script_string )
{
case "rotate":
if(isDefined(self.doors[i].script_angles))
{
self.doors[i] RotateTo( self.doors[i].script_angles, time, 0, 0 );
self.doors[i] thread door_solid_thread();
}
wait(randomfloat(.15));
break;

case "move":
case "slide_apart":
if(isDefined(self.doors[i].script_vector))
{
self.doors[i] MoveTo( self.doors[i].origin + self.doors[i].script_vector, time, time * 0.25, time * 0.25 );
self.doors[i] thread door_solid_thread();
}
wait(randomfloat(.15));
break;

case "anim":
self.doors[i] [[ level.blocker_anim_func ]]( self.doors[i].script_animname );
self.doors[i] thread door_solid_thread_anim();
wait(randomfloat(.15));
break;
}
if( isDefined( self.doors[i].target ) )
{
self.doors[i] maps\_zombiemode_blockers_new::add_new_zombie_spawners();
}
}
if( flag_to_set != "" )
{
flag_set( flag_to_set );
}
all_trigs = getentarray( door_array, "target" );
for( i = 0; i < all_trigs.size; i++ )
{
all_trigs[i] delete();
}
}

wait_a_round()
{
next_round = level.round_number + 1;
while(1)
{
if(next_round == level.round_number)
{
break;
}
wait 1;
}
}

door_solid_thread()
{
self waittill_either( "rotatedone", "movedone" );
while( 1 )
{
players = get_players();
player_touching = false;
for( i = 0; i < players.size; i++ )
{
if( players[i] IsTouching( self ) )
{
player_touching = true;
break;
}
}
if( !player_touching )
{
self Solid();
return;
}
wait( 1 );
}
}

door_solid_thread_anim()
{
self waittillmatch( "door_anim", "end" );
while( 1 )
{
players = get_players();
player_touching = false;
for( i = 0; i < players.size; i++ )
{
if( players[i] IsTouching( self ) )
{
player_touching = true;
break;
}
}
if( !player_touching )
{
self Solid();
return;
}
wait( 1 );
}
}


Go into "mapname.gsc" and underneath "maps\_zombiemode::main();" add "maps\_survive_rounds::main();".
Make a new ".gsc" file and place the script above into it.
Call it "_survive_rounds.gsc".
Place the script into "Root/mods/mapname/maps".
Then go into Radiant and open your map.
Everything will be set up using KVP's, like a real zombie_door.
It may get a bit complex, but I'll try to do my best to explain.
First make a trigger_use.
Give it this initial KVP.
          targetname = rounds_survive_doors

First add "script_noteworthy".
Now all you need to add in this KVP is the number of rounds you need to survive for this trigger.
Now if you want cost, add this as another KVP: "zombie_cost".
Set any value for a cost, and the hintstring will adjust.
If you dont want cost, DONT add this KVP at ALL.
That way the hintstring will not have any cost listed on it and will not play the "cha-ching" sound on use.
Next if you want a flag to set after the door is open like to activate a zone, add "script_flag" as a KVP.
Then type the name of the flag you want to be set.
Finally add the KVP "target".
Then type a Key you will remember to array to the doors that will open.
Once you use one trigger in game, all other triggers will disable so you cannot activate multiple "survive round" modes at once.
They all re-enable once there is no "survive rounds" mode active.
Now to set up the doors.
Each trigger can open as many doors at once as you want.
Each door you want to be opened will be targeted by the trigger.
That means the door's initial KVP will be this:
          targetname = (TRIGGER'S_TARGET_KVP)

I hope that makes sense, because I can't think of a better way to say that.
Now to set up how the door will open once told to open.
If you want the door to just delete without doing anything, just leave it alone after adding the targetname.
If you want the door to look more professional and move on open, do the following.
Add a new KVP called "script_vector".
Now type in this "0 0 0".
This is just like setting up a normal door's script_vector.
The first "0" will be the door's X-Axis Move.
You can type negative or positive numbers to make the door move forward or backward.
The middle "0" will be the doors Y-Axis Move.
You can type negative or positive numbers to make the door move left or right.
The last "0" will be the door's Z-Axis Move.
You can type negative or positive numbers to make the door move up or down.
After setting your values make sure there is only one space between each number and no spaces before or after.
I hope that made sense to you, I dont know a better way to explain it.
Now add a new KVP called "script_transition_time".
Set it to how long you want it to take for your door to open.
If you dont set this KVP, the time will default to 2 seconds for sound sync.
Now add a new KVP called "script_noteworthy".
Here you will either set it to "solid" or "delete".
If you set it to "solid", after the door is done moving, it will just remain solid where it is on your map.
If you set it to "delete", after the door is done moving, it will delete of your map.

That's all.
Remember if you dont set a "script_vector" for your door, it will just delete on open.
You can make as many trigger's and doors for the trigger's to open as you want.
I hope this tutorial made sense since there is so much to explain.
Remember in Mod Builder, Select the following before you Build Mod:
          maps/_survive_rounds.gsc
          maps/mapname.gsc

Remember to credit me if you use this.
Thanks and peace out.
By the way for those wondering, my real preferred name is xSanchez78.
Last Edit: January 15, 2015, 10:20:44 pm by alaurenc9
broken avatar :(
×
broken avatar :(
Relentless Mapper
Location: al
Date Registered: 21 August 2011
Last active: 3 weeks ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
Nuclear
My Groups
More
×
KDXDARK's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Nuclear
Nuclear
DARKLEGION's requested title
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
KDXDARK's Contact & Social Links
and why in the script say:
Code Snippet
Plaintext
//================================================================================================
// Script Name  : Door That Opens After Rounds Are Survived
// Author : xSanchez78
// Notes : call "maps\_survive_rounds::main();" before "maps\_zombiemode::main();" in "mapname.gsc".
//================================================================================================

it must be your name or i am wrong?  :o
broken avatar :(
×
broken avatar :(
Constants and Variables
Location: us
Date Registered: 18 August 2013
Last active: 2 years ago
Posts
889
Respect
Forum Rank
The Decider
Primary Group
Box Mappers Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
The Worst Secret Agent Ever
Signature
×
MAK911's Groups
Box Mappers Elite
Box Mappers Elite
Banned Elite
Banned Elite
MAK911's Contact & Social Linksmkramrtmkramrt
and why in the script say:
Code Snippet
Plaintext
//================================================================================================
// Script Name  : Door That Opens After Rounds Are Survived
// Author : xSanchez78
// Notes : call "maps\_survive_rounds::main();" before "maps\_zombiemode::main();" in "mapname.gsc".
//================================================================================================

it must be your name or i am wrong?  :o
Lying on the Internet? Impossible!
broken avatar :(
×
broken avatar :(
Location: deDeutschland
Date Registered: 26 August 2013
Last active: 2 months ago
Posts
132
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Stop Bleeding!
×
Psy0ch's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Psy0ch's Contact & Social LinksPsy0chPsy0chxPsy0chwww.callofdutyplayers.de
and why in the script say:
Code Snippet
Plaintext
//================================================================================================
// Script Name  : Door That Opens After Rounds Are Survived
// Author : xSanchez78
// Notes : call "maps\_survive_rounds::main();" before "maps\_zombiemode::main();" in "mapname.gsc".
//================================================================================================

it must be your name or i am wrong?  :o

look on his profile:
http://ugx-mods.com/forum/index.php?action=profile;u=651

the linked steam profil has the name xSanchez
i guess its his second name or smth like that
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2012
Last active: 9 months ago
Posts
577
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
alaurenc9'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.
alaurenc9's Contact & Social LinksxSanchez78xSanchez78xSanchez78xSanchez78xSanchez78xSanchez78
Yeah guys "xSanchez78" is my second name, on steam and on ps3. Sorry i didnt make that very clear.

 
Loading ...