I haven't seen a tut, but with the following assumptions:
You have a working turret in your map now that doesn't cost anything
You want to buy any specific turret only once
You want at least one turret per trigger
Then this should work for you:
Radiant:
Make a trigger_use and set these kvps: targetname: turrets target: turret1 Select the trigger and then the turret (or turrets) you want to activate and press W. Or you can just set the turret (or turrets) kvp targetname to turret1. Same difference.
For each set of triggers and turrets, if you have more than one, name the target something else, but make sure you match the target of the trigger with the targetname of the turret that the trigger activates. Always name the targetname of the trigger turrets. Unless you change the script below.
Script:
Find FUNCTION CALLS - PRE _Load in your nazi_zombie_MAPNAME.gsc and paste this under it:
Code Snippet
Plaintext
thread init_turrets();
to look something like this:
Code Snippet
Plaintext
/*-------------------- FUNCTION CALLS - PRE _Load ----------------------*/ thread init_turrets();
Go to the end of your nazi_zombie__MAPNAME.gsc and paste this code:
Code Snippet
Plaintext
init_turrets(){ //Set the cost for the trigger cost = 250; turret_trigs = getentarray("turrets", "targetname"); for(trig=0;trig < turret_trigs.size; trig++){ turret_trigs[trig] setCursorHint("HINT_NOICON"); turret_trigs[trig] UseTriggerRequireLookAt(); turret_trigs[trig] SetHintString("Press &&1 to buy turret [Cost: " + cost + "]"); turret_trigs[trig] thread Buy_Turret(cost); } } Buy_Turret(cost){ turrets = getentarray(self.target, "targetname"); //if you have multiple turrets activated from one trigger for(turret=0;turret < turrets.size; turret++){ turrets[turret] MakeTurretUnusable(); //disable all of them } //Wait for the trigger self waittill("trigger", player); while(player.score<cost){ player playsound("no_cha_ching"); self waittill("trigger", player); } player playsound("cha_ching"); player maps\_zombiemode_score::minus_to_player_score( cost ); for (turret=0;turret < turrets.size; turret++){ turrets[turret] MakeTurretUsable(); //enable all of them } self delete(); }
This script is designed to handle sets that consist of one trigger and at least one turret but not limited to one turret. The cost is set to 250 by default. Change it in the init_turrets() function if you would like, or set up a zombie_cost kvp in each trigger if you want.
Last Edit: June 20, 2014, 03:15:19 am by MakeCents
I haven't seen a tut, but with the following assumptions:
You have a working turret in your map now that doesn't cost anything
You want to buy any specific turret only once
You want at least one turret per trigger
Then this should work for you:
Radiant:
Make a trigger_use and set these kvps: targetname: turrets target: turret1 Select the trigger and then the turret (or turrets) you want to activate and press W. Or you can just set the turret (or turrets) kvp targetname to turret1. Same difference.
For each set of triggers and turrets, if you have more than one, name the target something else, but make sure you match the target of the trigger with the targetname of the turret that the trigger activates. Always name the targetname of the trigger turrets. Unless you change the script below. (Image removed from quote.)(Image removed from quote.)
Script:
Find FUNCTION CALLS - PRE _Load in your nazi_zombie_MAPNAME.gsc and paste this under it:
Code Snippet
Plaintext
thread init_turrets();
to look something like this:
Code Snippet
Plaintext
/*-------------------- FUNCTION CALLS - PRE _Load ----------------------*/ thread init_turrets();
Go to the end of your nazi_zombie__MAPNAME.gsc and paste this code:
Code Snippet
Plaintext
init_turrets(){ //Set the cost for the trigger cost = 250; turret_trigs = getentarray("turrets", "targetname"); for(trig=0;trig < turret_trigs.size; trig++){ turret_trigs[trig] setCursorHint("HINT_NOICON"); turret_trigs[trig] UseTriggerRequireLookAt(); turret_trigs[trig] SetHintString("Press &&1 to buy turret [Cost: " + cost + "]"); turret_trigs[trig] thread Buy_Turret(cost); } } Buy_Turret(cost){ turrets = getentarray(self.target, "targetname"); //if you have multiple turrets activated from one trigger for(turret=0;turret < turrets.size; turret++){ turrets[turret] MakeTurretUnusable(); //disable all of them } //Wait for the trigger self waittill("trigger", player); while(player.score<cost){ player playsound("no_cha_ching"); self waittill("trigger", player); } player playsound("cha_ching"); player maps\_zombiemode_score::minus_to_player_score( cost ); for (turret=0;turret < turrets.size; turret++){ turrets[turret] MakeTurretUsable(); //enable all of them } self delete(); }
This script is designed to handle sets that consist of one trigger and at least one turret but not limited to one turret. The cost is set to 250 by default. Change it in the init_turrets() function if you would like, or set up a zombie_cost kvp in each trigger if you want.