Modme Forums
Menu:

Activate round 1 with a trigger -by Xspicious

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


Xspicious:

////////////////////////////////////
///// SCRIPT BY XSPICIOUS /////
////////////////////////////////////

Activate a trigger to start round 1.



============
INSTRUCTIONS
============

Open mapname.gsc
in your main function at the top add this line

level.round_prestart_func= &startGame;

Now add this function to the bottom of your mapname.gsc

function startGame(){
    trig = GetEnt( "start_game" , "targetname" ); // this is the trigger_use targetname in radiant
    trig SetCursorHint( "HINT_NOICON" );
    trig SetHintString( "Press ^3[{+activate}]^7 to start the game!" ); // you can edit the text inside the "" to make it say what you want
    trig waittill( "trigger" , player );
    PlaySoundAtPosition( "mpl_plr_emp_activate" , (trig.origin)); // add any sound alias name you want for your activate sound
    trig Delete();
}


=============
RADIANT SETUP
=============

You can use the prefab from the download or just make your own

Get a trigger_use and give it this kvp - targetname | start_game

That is all you need to do. Make sure that trigger is in an area players can get to from the start to activate it or else round 1 will never start.
Thanks for checking this out if you use it please give a small credit

If you have any questions please feel free to ask!


Credits:
Xspicious
Ardivee


Clearvue:

That's brilliant. Will be a welcomed item to a lot of maps I am sure. Especially ones that are quite good to look at in the start. Or even as something slightly hidden to start the game.

Good work.


Clearvue:

If i make it a shootable trigger with the same target name would that work also?


Vertasea:

If i make it a shootable trigger with the same target name would that work also?

Yo I am Xspicious, I re-branded so my name is different now. Yes you can use pretty much any trigger you want. I have changed the script just a tiny bit. The setup for the script is exactly the same as I said above, but in Radiant if you want a model to delete once you press it. Make a script_model or a script_brushmodel and then select the trigger FIRST then select the model/brushmodel and press W. That is all for Radiant. Also if you know how to make game objects move or something like that could could change e_model Delete(); in the script to what ever you would want it to do. So I guess who ever reads the comments will get the better version lol
function startGame(){

    e_trig = GetEnt( "start_game_trigger", "targetname" );
    e_model = GetEnt( self.tartget, "targetname" );
    e_trig SetCursorHint( "HINT_NOICON" );
    e_trig UseTriggerRequireLookAt();
    e_trig SetHintString( "Press ^3[{+activate}]^7 to activate" ); // Edit this to whatever you want inside of the " "

    player = GetPlayers();
    for( i = 0; i < player.size; i++ ){
      
        player[i] PlayLoopSound( "zmb_bgb_nysm_loop" ); // must comment if you are not using a looping sound. Could also change it to  PlayLocalSound for a nonlooping sounds.
        e_trig waittill( "trigger" );
        player[i] StopLoopSound(); // must comment if you are not using a looping sound
        e_trig PlaySound( "zmb_bgb_round_robbin" );
    } 
    e_model Delete(); // comment this line if you don't want the model to delete.
    e_trig Delete();
}

Also you can use a trigger_multiple and set script_trigger_allplayers to true - then once all players touch it at the same time it will activate.


Clearvue:

Yo I am Xspicious, I re-branded so my name is different now. Yes you can use pretty much any trigger you want. I have changed the script just a tiny bit. The setup for the script is exactly the same as I said above, but in Radiant if you want a model to delete once you press it. Make a script_model or a script_brushmodel and then select the trigger FIRST then select the model/brushmodel and press W. That is all for Radiant. Also if you know how to make game objects move or something like that could could change e_model Delete(); in the script to what ever you would want it to do. So I guess who ever reads the comments will get the better version lol
function startGame(){

    e_trig = GetEnt( "start_game_trigger", "targetname" );
    e_model = GetEnt( self.tartget, "targetname" );
    e_trig SetCursorHint( "HINT_NOICON" );
    e_trig UseTriggerRequireLookAt();
    e_trig SetHintString( "Press ^3[{+activate}]^7 to activate" ); // Edit this to whatever you want inside of the " "

    player = GetPlayers();
    for( i = 0; i < player.size; i++ ){
     
        player[i] PlayLoopSound( "zmb_bgb_nysm_loop" ); // must comment if you are not using a looping sound. Could also change it to  PlayLocalSound for a nonlooping sounds.
        e_trig waittill( "trigger" );
        player[i] StopLoopSound(); // must comment if you are not using a looping sound
        e_trig PlaySound( "zmb_bgb_round_robbin" );
    }
    e_model Delete(); // comment this line if you don't want the model to delete.
    e_trig Delete();
}

Also you can use a trigger_multiple and set script_trigger_allplayers to true - then once all players touch it at the same time it will activate.

Thanks for your reply. That sounds like a good idea. Yeah a model that disappears would be ideal. That way, there isn't something left in the way. And all players being there to trigger would also work.


Clearvue:

Just to double check I use the original function and add the other one also.


Vertasea:

No just use the new function I posted and add this to your main function as the first line

level.round_prestart_func= &startGame;


Clearvue:

No just use the new function I posted and add this to your main function as the first line
level.round_prestart_func= &startGame;

Ah sweet. Just confused myself so thought it best to check.