Skip to content

Instantly share code, notes, and snippets.

@marcogravbrot
Last active June 9, 2017 14:45
Show Gist options
  • Save marcogravbrot/3c020f4d9f78450d876bd2f4bb75f1a9 to your computer and use it in GitHub Desktop.
Save marcogravbrot/3c020f4d9f78450d876bd2f4bb75f1a9 to your computer and use it in GitHub Desktop.
#RADIANT
Make a trigger_use covering the purchasable area of the door, for the time being this only supports deleting models/brushes, will
add more fancy effects and things later on(tomorrow).
trigger_use KVPs: (star = required)
*targetname "bankdoor"
*target <unique name of your choosing>
cost <number of how much you input into the bank at once>
limit <number of how much the bank needs to open the door>
Then, for your model/brushes/clips/whatever make sure you convert them to script entities (script_brushmodel, script_model, etc)
and then give them the targetname of what you chose as "target" in the trigger_use. So for example
trigger_use.target = "bankdoor1"
script_brushmodel.targetname = "bankdoor1"
Once you've set everything up you're ready to go to the scripting!
Keep in mind you can have as many bankdoor's you want, and as many targets you want as long as you have the targets unique for each bankdoor.
#SCRIPTS
Navigate to your map's main gsc file as per usual, which is located in BO3Root/usermaps/zm_map/scripts/zm_map.gsc
At the top of your file, among the other #using add these lines so we can modify the points of our players:
// Bank door neccesities
#using scripts\zm\_zm_score;
Then you want to find your main function, and put the following lines of code somewhere inside it (preferably at the bottom)
//Bank door initialization
thread bankdoor_init();
Then, for the last step for the scripting, paste the rest of this file anywhere undearneath the main function,
or if you know how you can also put it in a seperate file for organization.
//Everything after this point should be copy+pasted
#define BANKDOOR_DEFAULT_COST 1000
#define BANKDOOR_DEFAULT_SCRIPT_INT 10000
function bankdoor_init()
{
trigs = GetEntArray("bankdoor", "targetname");
foreach(trig in trigs)
{
trig thread bankdoor_waitfor();
}
}
function bankdoor_waitfor()
{
cost = BANKDOOR_DEFAULT_COST;
if( isDefined( self.zombie_cost ) )
cost = self.zombie_cost;
script_int = BANKDOOR_DEFAULT_SCRIPT_INT;
if ( isDefined( self.script_int ) )
script_int = self.script_int;
debris = GetEntArray(self.target, "targetname");
self.amount = 0;
self SetCursorHint("HINT_NOICON");
self SetHintString("Press ^3&&1^7 to deposit. Cost [" + cost + "] / Remaining: " + (script_int-self.amount));
while(isdefined(self))
{
self waittill("trigger", player);
self PlaySoundToPlayer("zmb_cha_ching", player);
if (player.score >= cost)
{
player zm_score::minus_to_player_score(cost);
self.amount = self.amount + cost;
self SetHintString("Press ^3&&1^7 to deposit. Cost [" + cost + "] / Remaining: " + (script_int-self.amount));
if (self.amount >= script_int)
{
foreach(k, v in debris)
{
v Delete();
}
//Remove comment and change alias for sound when completed bank
//self PlaySound("mus_roundstart1_intro");
break;
}
}
wait(0.5);
}
self delete();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment