I need this for my map, so I made the script and decided to make a tutorial for this. If there's already one I'm sorry, but I haven't found any (at least here). It's like in Grid Lock: when you finish a round you have a break to do whatever you want without zombies. The break will end when the time is out or when the host press enter (you might want to change it to other thing). I haven't tested it online, but it should work well. And please, report me any bug.
Let's start. If you have NOT done it before, go to root/raw/maps and copy _zombiemode.gsc. Then go to root/mods/YOUR_MOD_NAME/maps and paste it there.
If you already had this file there you should backup it !!
Find the "round_wait()" function and inside of it, just at the end, add this lines:
Code Snippet
Plaintext
// --- Soy-yo's round break --- \\
breakHud = createTimerHud(); roundBreak(); level notify( "round_break_finished" ); level.inRoundBreak = false; // may need it for other scripts breakHud destroy_hud();
// --- Soy-yo's round break --- \\
Finally, add these functions just bellow the "round_wait()" function (outside of it).
level notify( "round_break_started" ); // may need it for other scripts level.inRoundBreak = true; // may need it for other scripts self endon( "enter_pressed" );
level thread spectators_respawn(); // make everyone respawn first
If you want to do something when the round break starts or if you need to check if you are in the round break you can use this:
Code Snippet
Plaintext
level waittill( "round_break_started" ); // do something when break starts level waittill( "round_break_finished" ); // do something when break ends level endon( "round_break_started" ); // end your function when break starts level endon( "round_break_finished" ); // end your function when break ends
Code Snippet
Plaintext
if( isDefined( level.inRoundBreak ) && level.inRoundBreak ) // you are in round break if( !isDefined( level.inRoundBreak ) || !level.inRoundBreak ) // you are NOT in round break if( isDefined( level.inRoundBreak ) && !level.inRoundBreak ) // you are NOT in round break and NOT in round 1 if( !isDefined( level.inRoundBreak ) ) // you are in round 1 and not in a break if( isDefined( level.inRoundBreak ) ) // you are in round break or not, but not in round 1
If you use it in your map, please give credit to me. Enjoy it.
Last Edit: October 18, 2015, 12:12:21 pm by Soy-Yo
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
if ( isDefined( level.inRoundBreak ) && level.inRoundBreak ) { // if round break is defined "and" is true } else { // otherwise its false "or" undefined }
that would resolve your round 1 issue
Last Edit: October 10, 2015, 11:05:06 pm by Harry Bo21
if ( isDefined( level.inRoundBreak ) && level.inRoundBreak ) { // if round break is defined "and" is true } else { // otherwise its false "or" undefined }
that would resolve your round 1 issue
Maybe I didn't understand you, but I wouldn't need to change anything then, right? Because in round 1 the variable isn't defined yet, so it'll return undefined (I said null in the post, I'll change it). And then, during any other round, the variable will be false. Did you mean to change this line...
instead of setting it false after, set it back to undefined
treyarch used this for the is_drinking stuff, which actually caused me to break all their scripts by doing it the opposite way on my old perks lol. Only noticed when smashers bowie knife broke - along with everone elses lol
so "isDefined" was returning true, no matter what, stopping the player from interacting with anything treyarch that was "wanting" it to become undefined lol
oops lol
plus this way gives you 4 options for usage too :
Code Snippet
Plaintext
if ( isDefined( level.inRoundBreak ) && level.inRoundBreak ) // If is defined, and value is true / 1
if ( isDefined( level.inRoundBreak ) && !level.inRoundBreak ) // If is defined, and value is false / 0
if ( isDefined( level.inRoundBreak ) ) // If it is defined now, regardless of true / false
if ( !isDefined( level.inRoundBreak ) ) // If it isnt defined at all now
Last Edit: October 10, 2015, 11:28:46 pm by Harry Bo21