Modme Forums

[HELP] Custom Perk Repeating Error

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


ModmeBot:

Thread By: MJPW

Hi there! Sorry for the frequent posts but if Im having these issuse I figured that maybe someone else might as well in the future. So currently my the main bit of setting up a custom perk didnt have the part where if you have the perk, you couldnt get the perk again. The perk does take away however. Thankfully PROxFTW helped me out with a fix to where the perk machine will not let you buy the perk anymore after you have it. But now Ive came across a bigger issue with it: when picking up a "free perk" power up, you can continue to get the perk with no end.

I tried replicating the clientfield options like in the other perk files but I get a clientfield error when you try to start the game.


ModmeBot:

Reply By: natesmithzombies

I cant say for sure what is happening but it sounds like you might be stuck inside the give_perk_function that you are using. I cant recall if it is the same for perks as it is with the powerups, but the give_perk_function needs to complete for the after effects of the stock _zm_perks.gsc to take place.

You appear to be caught up on the clientfields, but dont be. I actually did all of Madgaz's perks with no clientfields as I dont feel competent enough with csc to have any advantage over gsc. Clientfields are related to csc/LUA functions if my understanding is correct, so you simply dont need to set clientfields if you dont use csc/LUA for your perk.


ModmeBot:

Reply By: MJPW

Here is the give, take, and think.

function give_custom_perk()
 
{
 
self.hasCustomPerk = true;
 
self.has_custom_perks++;
 
level.custom_perk_validation = &custom_perk_think;
 
self thread custom_perk_shader::add_custom_perk_shader( self, "mm_shader" );
 
trigger = GetEnt("multipliermodel", "target");
 
trigger SetHintStringForPlayer(self, "");
 
if( !IsDefined( self.hascertainperk ) )
 
self.hascertainperk = [];
 
array::add( self.hascertainperk, PERK_CUSTOM_PERK );
 
}
function take_custom_perk( b_pause, str_perk, str_result )
 
{
 
self.hasCustomPerk = false;
 
self.has_custom_perks--;
 
trigger = GetEnt("multipliermodel", "target");
 
trigger SetHintStringForPlayer(self, "Hold [{+activate}] for Multiplier Milkshake [Cost: 3000]");
 
self.hascertainperk = array::exclude( self.hascertainperk, PERK_CUSTOM_PERK );
 
}
function custom_perk_think( player )
 
{
 
for( i = 0; i < player.hascertainperk.size; i++ )
 
if( player.hascertainperk == self.script_noteworthy )
 
return false;
 
return true;
 
}


ModmeBot:

Reply By: natesmithzombies

MJPW

Here is the give, take, and think.

function give_custom_perk()
 
{
 
self.hasCustomPerk = true;
 
self.has_custom_perks++;
 
level.custom_perk_validation = &custom_perk_think;
 
self thread custom_perk_shader::add_custom_perk_shader( self, "mm_shader" );
 
trigger = GetEnt("multipliermodel", "target");
 
trigger SetHintStringForPlayer(self, "");
 
if( !IsDefined( self.hascertainperk ) )
 
self.hascertainperk = [];
 
array::add( self.hascertainperk, PERK_CUSTOM_PERK );
 
}
function take_custom_perk( b_pause, str_perk, str_result )
 
{
 
self.hasCustomPerk = false;
 
self.has_custom_perks--;
 
trigger = GetEnt("multipliermodel", "target");
 
trigger SetHintStringForPlayer(self, "Hold [{+activate}] for Multiplier Milkshake [Cost: 3000]");
 
self.hascertainperk = array::exclude( self.hascertainperk, PERK_CUSTOM_PERK );
 
}
function custom_perk_think( player )
 
{
 
for( i = 0; i < player.hascertainperk.size; i++ )
 
if( player.hascertainperk == self.script_noteworthy )
 
return false;
 
return true;
 
}

Next time use the code sample button.

You shouldnt have to do some anything additional to get this to work so I suggest removing any added code from PROxFTW to isolate the problem. What are the KVP's of your trigger and of your script_struct in your prefab. They should both have the same script_noteworthy.


ModmeBot:

Reply By: MJPW

Sorry about that. The think parts are what is additional to keep from purchasing it again. In the custom perk tutorial they didnt include a trigger section only a script_struct.

The struct has targetname/zm_perk_machine and script_noteworthy/speciality_customperk


ModmeBot:

Reply By: natesmithzombies

Add a trigger_use with the following KVP's, just change your specialty:


ModmeBot:

Reply By: MJPW

Okay just tried it and now I can continue to buy the perk as many times as I please again along with, for some odd reason, it doesnt actually give me the full perk (with its main use it just shows the shader) unless I get it in the power up drop.


ModmeBot:

Reply By: natesmithzombies

MJPW

Okay just tried it and now I can continue to buy the perk as many times as I please again along with, for some odd reason, it doesnt actually give me the full perk (with its main use it just shows the shader) unless I get it in the power up drop.

lol I couldnt guess much more at the problem. There is a lot of stuff going on in a perk that could go wrong, and all I can do at this point is guess.


ModmeBot:

Reply By: MJPW

natesmithzombies
MJPW

Okay just tried it and now I can continue to buy the perk as many times as I please again along with, for some odd reason, it doesnt actually give me the full perk (with its main use it just shows the shader) unless I get it in the power up drop.

lol I couldnt guess much more at the problem. There is a lot of stuff going on in a perk that could go wrong, and all I can do at this point is guess.

Is there any tutorials floating around for setting up a custom perk?


ModmeBot:

Reply By: natesmithzombies

MJPW
natesmithzombies
MJPW

Okay just tried it and now I can continue to buy the perk as many times as I please again along with, for some odd reason, it doesnt actually give me the full perk (with its main use it just shows the shader) unless I get it in the power up drop.

lol I couldnt guess much more at the problem. There is a lot of stuff going on in a perk that could go wrong, and all I can do at this point is guess.

Is there any tutorials floating around for setting up a custom perk?

Just the one over at UGX, which is what I am assuming you followed. I would find someone who has used his tut and confirm that his tut/scripts are not entirely correct. If that is the case I can try to type up a tut on it after I finish Brutus because I am getting loads of messages asking for him.


ModmeBot:

Reply By: MJPW

natesmithzombies
MJPW
natesmithzombies
MJPW

Okay just tried it and now I can continue to buy the perk as many times as I please again along with, for some odd reason, it doesnt actually give me the full perk (with its main use it just shows the shader) unless I get it in the power up drop.

lol I couldnt guess much more at the problem. There is a lot of stuff going on in a perk that could go wrong, and all I can do at this point is guess.

Is there any tutorials floating around for setting up a custom perk?

Just the one over at UGX, which is what I am assuming you followed. I would find someone who has used his tut and confirm that his tut/scripts are not entirely correct. If that is the case I can try to type up a tut on it after I finish Brutus because I am getting loads of messages asking for him.

There was a few people saying that they are are able to continue to buy the perk. But if you did it that would be awesome :) Brutus would be pretty cool to see in BO3