Modme Forums

Making a Custom Perk

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


ModmeBot:

Thread By: Abnormal202
I recognize this isn't easy and requires scripting knowledge but I just wanted to know how to make a custom perk properly. What GSCs do you need to add/change? Can you edit stock GSCs like _zm_perks.gsc? just how do you get the game to recognize it is a perk, without making all these custom scripts to account for perk limit, shaders, power, and stuff that would come default with adding any new perk? I hope I'm not being too vague, but if anyone has experience with adding custom perks, that would great.


ModmeBot:

Reply By: natesmithzombies
When I made the custom perks for all the Madgaz maps I had to do a few tricky things:



<ol>

<li style="width:100%;">I copied and pasted juggernaut.gsc and removed all references to juggernaut.csc; I will be completely honest when I say I know just about nothing when it comes to csc, but from observation it appears all csc related functions have to do with adding the menu files to screen. </li>

<li style="width:100%;">I copied and pasted the juggernaut prefab to the map and then added a script_model with the "radiant machine" targetname I specified in the script. I cant say for sure what this does either, but I know it has a relation to the machine playing steam fx. I placed this radiant model far under the map so players cant see it </li>

<li style="width:100%;">In the gsc you need to also add a function for your perk. This biggest annoyance for me wasnt actually making the perk function but instead getting the hud items to show correctly. As everyone knows we arent given LUA files so we have to do with the old hud shader system (not a big deal IMO but some people hate 3arc for it lol but its not nearly as nice as it could be if we had LUA) </li>

</ol>



Those were the things that come to mind looking back at making custom perks. IIRC there is tutorial over at UGX on how to add custom perks. I dont think this guy accounted for the shader system though, which is a big deal IMO. Maybe try taking a look at his tut, asking some questions here or there along the way. I can share my hud system for perks if he doesnt have one in his tut


ModmeBot:

Reply By: Abnormal202
So I've been following the tutorial for making a custom perk here.

I wanted to make a custom perk called "Snail's Pace" that slows down all the zombies within a radius of the player(s) who have it.

Since you scripted the Time Warp powerup maybe you could help with this?

I've looked through your script and you did it in very few lines with just





function warp_time() { while(level.time_warp_active) { zoms = GetAISpeciesArray( "axis" ); foreach( zom in zoms ) { if( !isDefined(zom.is_slowed) ) { zom.is_slowed = true; zom ASMSetAnimationRate(0.5); zom SetMoveSpeedScale(.1); } } wait(0.05); } }

and I was wondering how you could apply this to radius, instead of just all the zombies.


ModmeBot:

Reply By: natesmithzombies
I am sure it has some errors, but it will help you see what I would do:

Code Link


ModmeBot:

Reply By: Abnormal202
Your script seems to work pretty good (Although I did have to put in a parenthesis you left out) except for the wait part doesn't work. The zombies stay slowed down as long as their in the player's radius and I think that's too overpowered. I've been thinking of ways to make it less powerful, such as:

<ul style="padding-left:40px;margin:0;">
<li style="width:100%;">zombies are only slowed down for a couple seconds, then sped back up.</li>
<li style="width:100%;">zombies are slowed down when they hit the bigger radius around the player, but when they hit another, smaller, radius around the player they speed up again.</li>
<li style="width:100%;">zombies are slowed down until they are hit, where they speed up again and can't be slowed down again for an amount of time.</li>
Any one of those would be good, and I think you already meant for the time one to happen, but it doesn't seem to work. Here's the actual script I am using:</ul>



function give_custom_perk() { // quick revive in solo gives an extra life // give perk here self.hasCustomPerk = true; self.has_custom_perks++; self thread custom_perk_shader::add_custom_perk_shader( self, "snails_pace_shader" ); // CHANGE THIS TO YOUR PERK SHADER self thread check_for_close_zoms(); trigger = GetEnt("vending_snails_pace", "target"); // CHANGE THIS TO YOUR PERK MACHINE NAME trigger SetHintStringForPlayer(self, ""); } function take_custom_perk( b_pause, str_perk, str_result ) { // take perk here self.hasCustomPerk = false; self.has_custom_perks--; trigger = GetEnt("vending_customperk", "target"); trigger SetHintStringForPlayer(self, "Hold [{+activate}] for Snail&#39;s Pace [Cost: 300]"); // CHANGE THIS TO YOUR HINTSTRING ABOVE } function check_for_close_zoms() { while(self.hasCustomPerk) { zoms = GetAISpeciesArray( "axis", "all" ); zoms = util::get_array_of_closest( self.origin, zoms , undefined , undefined, 150 ); // 150 is the max distance. take a look at this function in util.gsc to edit stuff foreach( zom in zoms ) { if( !isDefined( zom.is_snailed )) zom thread warp_time(); } wait(0.05); } } function warp_time() { self.is_snailed = true; self ASMSetAnimationRate(0.7); self SetMoveSpeedScale(.5); wait(3); // this is how long it will be slowed self ASMSetAnimationRate(1); self SetMoveSpeedScale(1); self.is_snailed = undefined; }


ModmeBot:

Reply By: natesmithzombies

Abnormal202Your script seems to work pretty good (Although I did have to put in a parenthesis you left out) except for the wait part doesn't work. The zombies stay slowed down as long as their in the player's radius and I think that's too overpowered. I've been thinking of ways to make it less powerful, such as:

<ul style="padding-left:40px;margin:0;">
<li style="width:100%;">zombies are only slowed down for a couple seconds, then sped back up.</li>
<li style="width:100%;">zombies are slowed down when they hit the bigger radius around the player, but when they hit another, smaller, radius around the player they speed up again.</li>
<li style="width:100%;">zombies are slowed down until they are hit, where they speed up again and can't be slowed down again for an amount of time.</li>
Any one of those would be good, and I think you already meant for the time one to happen, but it doesn't seem to work. Here's the actual script I am using:</ul>



function give_custom_perk() { // quick revive in solo gives an extra life // give perk here self.hasCustomPerk = true; self.has_custom_perks++; self thread custom_perk_shader::add_custom_perk_shader( self, "snails_pace_shader" ); // CHANGE THIS TO YOUR PERK SHADER self thread check_for_close_zoms(); trigger = GetEnt("vending_snails_pace", "target"); // CHANGE THIS TO YOUR PERK MACHINE NAME trigger SetHintStringForPlayer(self, ""); } function take_custom_perk( b_pause, str_perk, str_result ) { // take perk here self.hasCustomPerk = false; self.has_custom_perks--; trigger = GetEnt("vending_customperk", "target"); trigger SetHintStringForPlayer(self, "Hold [{+activate}] for Snail&#39;s Pace [Cost: 300]"); // CHANGE THIS TO YOUR HINTSTRING ABOVE } function check_for_close_zoms() { while(self.hasCustomPerk) { zoms = GetAISpeciesArray( "axis", "all" ); zoms = util::get_array_of_closest( self.origin, zoms , undefined , undefined, 150 ); // 150 is the max distance. take a look at this function in util.gsc to edit stuff foreach( zom in zoms ) { if( !isDefined( zom.is_snailed )) zom thread warp_time(); } wait(0.05); } } function warp_time() { self.is_snailed = true; self ASMSetAnimationRate(0.7); self SetMoveSpeedScale(.5); wait(3); // this is how long it will be slowed self ASMSetAnimationRate(1); self SetMoveSpeedScale(1); self.is_snailed = undefined; }



The fun of modding is figuring out the code as best you can without copying and pasting too much. This is what I would modify to help your ideas into script:

<ol>

<li style="width:100%;">Add a zom.snail_cooldown boolean to be true or false and make the zombies only be able to slow once every 'x' amount of seconds. You can thread a cooldown_function on a zombie that waits 10 seconds and then sets zom.snail_cooldown to false. </li>

</ol>