So this is just a simple little script I put together that allows players to buy an extra perk slot. This is very simple and easy to do, so nobody should have any problems with it
NOTE: Due to some issues people have been having, I highly reccomend installing Bam's perks the manual way (i.e. adding the scripts yourself and not using script placer z for them). Now, I only say this because I believe there may be a problem in the script if you do not install them the manual way or do not have them installed. I will re-write the script with the necessary changes and checks when I have the time and will update this topic. Thank you.
Step 1: Open your map in radiant and place a script model of a perk bottle (or you can use a different model if you'd like), and give it this KVP:
Code Snippet
Plaintext
targetname : perk_bottle_model
Now place a trigger around the perk bottle (or whatever model you used), and give it the KVP:
Code Snippet
Plaintext
targetname : buy_slot_trigger
Save and close your map.
Step 2: Go into WaWroot/mods/yourmapname/maps and open up YourMapName.gsc
Step 3: Find this:
Code Snippet
Plaintext
maps\_zombiemode::main();
And directly under that line, paste this:
Code Snippet
Plaintext
thread buyable_perk_slot();
Now, paste this at the very bottom of the file:
Code Snippet
Plaintext
buyable_perk_slot() { level.perk_limit = 4; //Initial perk limit, feel free to change level.perk_limit_max = 8; //Max perk limit, feel free to change level.buy_slot_cost = 1500; //Cost of perk slot, feel free to change buy_slot_trigger = getent( "buy_slot_trigger" , "targetname" ); //Gets the trigger entity perk_bottle_model = getent("perk_bottle","targetname" ); //Gets the model entity
playfxontag (level._effect["powerup_on"], perk_bottle_model, "tag_origin"); //Puts the powerup effect around the bottle self thread perk_bottle_rotate( perk_bottle_model );
buy_slot_trigger SetCursorHint("HINT_NOICON"); //Gets rid of hand symbol buy_slot_trigger UseTriggerRequireLookAt(); //Requires the player to look at the trigger to use it buy_slot_trigger SetHintString("Press &&1 To Buy Perk Slot [Cost: 1500]"); //Hint string players will see
while(1) //Loops so players can use it more than once { buy_slot_trigger waittill( "trigger", player ); //Waits until player uses trigger
if(player.score >= level.buy_slot_cost && level.perk_limit < level.perk_limit_max) //Checks to see if the player has enough points { player maps\_zombiemode_score::minus_to_player_score( level.buy_slot_cost ); //Subtracts the cost from the player's score level.perk_limit = level.perk_limit + 1; //Increases the player's perk limit by 1 iprintlnbold( "You Can Now Hold " +level.perk_limit+ "/" +level.perk_limit_max+ " Perks" ); //Displays this message to the player }
if(player.score >= level.buy_slot_cost && level.perk_limit >= level.perk_limit_max) //checks if the player has reached the max perk limit { return; } } }
If you have Bam's BO perks in your map, make sure to go into _zombiemode.gsc and delete the level.perk_limit line in there. If you dont, it will cause bugs in the script.
I hope some people find this tutorial helpful, and please let me know if you encounter any problems.
Thanks to PROxFTW and Arceus for letting me know of syntax errors
Last Edit: May 14, 2015, 09:28:01 pm by AlecKeaneDUB
Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
MZslayer11's Contact & Social LinksMZslayer11Service_Code_30#2655
Nice job man, I may use this How would I have "Perk Limit: #" in the top left corner of the screen, like zombie counter style. Would it be a simple modification?
Nice job man, I may use this How would I have "Perk Limit: #" in the top left corner of the screen, like zombie counter style. Would it be a simple modification?
And you should be good to go You'll have to mess with the hud elem positions though, I'm not sure what the xy values are for the top left of the screen. I'll see if I can figure them out and if I do I'll post another reply
Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
MZslayer11's Contact & Social LinksMZslayer11Service_Code_30#2655
Thanks man! I'll test all this tomorrow When I get a chance
buyable_perk_slot() { perk_limit = 4; //Initial perk limit, feel free to change perk_limit_max = 8; //Max perk limit, feel free to change buy_slot_cost = 1500; //Cost of perk slot, feel free to change buy_slot_trigger = getent( "buy_slot_trigger" , "targetname" ); //Gets the trigger entity perk_bottle_model = getent("perk_bottle","targetname" ); //Gets the model entity
playfxontag (level._effect["powerup_on"], perk_bottle_model, "tag_origin"); //Puts the powerup effect around the bottle self thread perk_bottle_rotate( perk_bottle_model );
buy_slot_trigger SetCursorHint("HINT_NOICON"); //Gets rid of hand symbol buy_slot_trigger UseTriggerRequireLookAt(); //Requires the player to look at the trigger to use it buy_slot_trigger SetHintString("Press &&1 To Buy Perk Slot [Cost: " + buy_slot_cost + "]"); //Hint string players will see
while(1) //Loops so players can use it more than once { buy_slot_trigger waittill( "trigger", player ); //Waits until player uses trigger
if(!is_player_valid(player)) { wait 0.1; continue; } if(player.score < buy_slot_cost)//DUKIP - Score less than amount { player PlaySound("deny"); player thread play_no_money_perk_dialog(); wait 0.1; continue; } if(player.perk_limit >= perk_limit_max) //DUKIP - If we're at max then deny and continue { player PlaySound("deny"); wait 0.1; continue; } if(player.perk_limit < perk_limit_max) //Checks to see if the player doesn't hax max perks. { player maps\_zombiemode_score::minus_to_player_score( buy_slot_cost ); //Subtracts the cost from the player's score player.perk_limit++; //Increases the player's perk limit by 1 iprintlnbold( "You Can Now Hold " + player.perk_limit + "/" + perk_limit_max + " Perks" ); //Displays this message to the player } } }
More efficient code.
Edit: Make sure somewhere on onPlayerSpawned you add self.perk_limit = (some_amount);
Last Edit: April 24, 2015, 02:42:16 am by DidUknowiPwn
buyable_perk_slot() { perk_limit = 4; //Initial perk limit, feel free to change perk_limit_max = 8; //Max perk limit, feel free to change buy_slot_cost = 1500; //Cost of perk slot, feel free to change buy_slot_trigger = getent( "buy_slot_trigger" , "targetname" ); //Gets the trigger entity perk_bottle_model = getent("perk_bottle","targetname" ); //Gets the model entity
playfxontag (level._effect["powerup_on"], perk_bottle_model, "tag_origin"); //Puts the powerup effect around the bottle self thread perk_bottle_rotate( perk_bottle_model );
buy_slot_trigger SetCursorHint("HINT_NOICON"); //Gets rid of hand symbol buy_slot_trigger UseTriggerRequireLookAt(); //Requires the player to look at the trigger to use it buy_slot_trigger SetHintString("Press &&1 To Buy Perk Slot [Cost: " + buy_slot_cost + "]"); //Hint string players will see
while(1) //Loops so players can use it more than once { buy_slot_trigger waittill( "trigger", player ); //Waits until player uses trigger
if(!is_player_valid(player)) { wait 0.1; continue; } if(player.score < buy_slot_cost)//DUKIP - Score less than amount { player PlaySound("deny"); player thread play_no_money_perk_dialog(); wait 0.1; continue; } if(player.perk_limit >= perk_limit_max) //DUKIP - If we're at max then deny and continue { player PlaySound("deny"); wait 0.1; continue; } if(player.perk_limit < perk_limit_max) //Checks to see if the player doesn't hax max perks. { player maps\_zombiemode_score::minus_to_player_score( buy_slot_cost ); //Subtracts the cost from the player's score player.perk_limit++; //Increases the player's perk limit by 1 iprintlnbold( "You Can Now Hold " + player.perk_limit + "/" + perk_limit_max + " Perks" ); //Displays this message to the player } } }
More efficient code
Thanks I'm still learning so I didn't expect my version to be perfect lol
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
buyable_perk_slot() { perk_limit = 4; //Initial perk limit, feel free to change perk_limit_max = 8; //Max perk limit, feel free to change buy_slot_cost = 1500; //Cost of perk slot, feel free to change buy_slot_trigger = getent( "buy_slot_trigger" , "targetname" ); //Gets the trigger entity perk_bottle_model = getent("perk_bottle","targetname" ); //Gets the model entity
playfxontag (level._effect["powerup_on"], perk_bottle_model, "tag_origin"); //Puts the powerup effect around the bottle self thread perk_bottle_rotate( perk_bottle_model );
buy_slot_trigger SetCursorHint("HINT_NOICON"); //Gets rid of hand symbol buy_slot_trigger UseTriggerRequireLookAt(); //Requires the player to look at the trigger to use it buy_slot_trigger SetHintString("Press &&1 To Buy Perk Slot [Cost: " + buy_slot_cost + "]"); //Hint string players will see
while(1) //Loops so players can use it more than once { buy_slot_trigger waittill( "trigger", player ); //Waits until player uses trigger
if(!is_player_valid(player)) { wait 0.1; continue; } if(player.score < buy_slot_cost)//DUKIP - Score less than amount { player PlaySound("deny"); player thread play_no_money_perk_dialog(); wait 0.1; continue; } if(player.perk_limit >= perk_limit_max) //DUKIP - If we're at max then deny and continue { player PlaySound("deny"); wait 0.1; continue; } if(player.perk_limit < perk_limit_max) //Checks to see if the player doesn't hax max perks. { player maps\_zombiemode_score::minus_to_player_score( buy_slot_cost ); //Subtracts the cost from the player's score player.perk_limit++; //Increases the player's perk limit by 1 iprintlnbold( "You Can Now Hold " + player.perk_limit + "/" + perk_limit_max + " Perks" ); //Displays this message to the player } } }
More efficient code.
Edit: Make sure somewhere on onPlayerSpawned you add self.perk_limit = (some_amount);
i would also add this under where it defines "perk_limit"
Code Snippet
Plaintext
flag_wait( "all_players_connected" ); players = get_players(); for( i = 0; i < players.size; i++ ) { players[i].perk_limit = perk_limit; }
and also change "play_no_money_perk_dialog()" to "maps\_zombiemode_perks::play_no_money_perk_dialog()". Because that function is only in _zombiemode_perks.gsc
Can anyone help me? I have the "more efficient" part of the script along with the other scripts above it that are not included in the more efficient part. I have Bam's perks installed and I took out the level.perk_limit in my _zombiemode.gsc. When I load the map with it like I described, the perk HUD is there (It says perk limit = (no number), and it lets me buy all 8 perks without buying more slots, even though I can still buy the perk bottle. If I leave Bam's level.perk_limit in the _zombiemode.gsc It says perk limit = 4 on the HUD and the game limits me to 4 perks and I can buy slots but not more actual perks. Any help would be great!
Thank you, works well only it still allows me to buy more perks but I fixed it EDIT: For some reason it still lets me buy after I thought I fixed it, I am using Bams perks and got them through Scriptplacer Z. I have searched for the level.perk_limit but haven't found it.
Last Edit: May 12, 2015, 12:08:56 pm by Andy Whelan
These errors you guys are getting are odd to me. It may he because I added in Bam's perks manually, as I dont use script placer Z. That could be the problem...something with the script placer, because the script and everything I posted works 110% perfect for me ???