UGX-Mods

Call of Duty: Black Ops 3 => Help Desk => Scripting => Topic started by: slit8539 on October 07, 2016, 07:23:52 am

Title: give perk through trigger
Post by: slit8539 on October 07, 2016, 07:23:52 am
hey just a quick question , is it possible to give the players a free perk through a  use trigger and if so how?
thankyou for your time
Title: Re: give perk through trigger
Post by: reckfullies on October 08, 2016, 05:05:03 am
Go into the _zm_perks file and search for how perks are given to players. Once you find it, make a script that gives the perk to the player once they activate your trigger(I'm assuming you know how to get a trigger from a script already).
Title: Re: give perk through trigger
Post by: Tomzen on October 08, 2016, 09:08:09 am
I would like to know how to give one a perk with a usable trigger.
Title: Re: give perk through trigger
Post by: reckfullies on October 08, 2016, 11:24:42 pm
I would like to know how to give one a perk with a usable trigger.

Here is a function you could use to give a player a perk with a trigger:
Code Snippet
Plaintext
#using scripts\zm\_zm_perks;

function init()
{
    trig = GetEnt("perk_trigger", targetname); // Gets the entity with the targetname "perk_trigger".
    trig SetHintString("Press &&1 for perk."); // Changes the string that shows when looking at the trigger.
    trig SetCursorHint("HINT_NOICON"); // Changes the icon that shows when looking at the trigger.

    trig waittill("trigger", player); // Waits until the player triggers the trigger and gets the player that does it.

    player zm_perks::give_perk(perkname); // Gives the player a perk - I don't know all the names of the perks for this function so you would need to find the one you want.
   
    // You could add a while loop if you need one for something you are doing.

   
}
Title: Re: give perk through trigger
Post by: avidpenguin on October 09, 2016, 01:33:08 pm
Here is a function you could use to give a player a perk with a trigger:
Code Snippet
Plaintext
#using scripts\zm\_zm_perks;

function init()
{
    trig = GetEnt("perk_trigger", targetname); // Gets the entity with the targetname "perk_trigger".
    trig SetHintString("Press &&1 for perk."); // Changes the string that shows when looking at the trigger.
    trig SetCursorHint("HINT_NOICON"); // Changes the icon that shows when looking at the trigger.

    trig waittill("trigger", player); // Waits until the player triggers the trigger and gets the player that does it.

    player zm_perks::give_perk(perkname); // Gives the player a perk - I don't know all the names of the perks for this function so you would need to find the one you want.
   
    // You could add a while loop if you need one for something you are doing.

   
}

I've tried this with both electric cherry and juggernog, but it didn't work. However, I looked in the zm_perks script and found the give_random_perk() function, which works perfectly. Am I missing something here?

I used the following code to give electric cherry, but it didn't work. It took up a perk slot but didn't give me the icon nor effect.

Code Snippet
Plaintext
player zm_perks::give_perk("electric_cherry_perk");
Title: Re: give perk through trigger
Post by: reckfullies on October 11, 2016, 01:59:05 am
I've tried this with both electric cherry and juggernog, but it didn't work. However, I looked in the zm_perks script and found the give_random_perk() function, which works perfectly. Am I missing something here?

I used the following code to give electric cherry, but it didn't work. It took up a perk slot but didn't give me the icon nor effect.

Code Snippet
Plaintext
player zm_perks::give_perk("electric_cherry_perk");

Not sure if this is problem but, while looking in _zm_perks.gsc I found that give_perk has 2 parameters.

give_perk(perk, bought).

An example of how I think this would be used is this:
Code Snippet
Plaintext
player zm_perks::give_perk("perkname", true/false); // True/false would indicate if it is a bought perk or not, it seems that having this set to true will mean that it increments some sort of challenge stat called "SURVIVALIST_BUY_PERK".
Title: Re: give perk through trigger
Post by: GNT123 on October 11, 2016, 03:13:57 am
Were would I look to tell it to give me all perks?
Title: Re: give perk through trigger
Post by: reckfullies on October 11, 2016, 10:52:36 am
Were would I look to tell it to give me all perks?

Just go into root/scripts/zm/_zm_perks.gsc and look through the functions until you find what you need.

If there isn't a way to give all perks just give one at a time.
Title: Re: give perk through trigger
Post by: Tomzen on October 11, 2016, 11:29:44 am
Just go into root/scripts/zm/_zm_perks.gsc and look through the functions until you find what you need.

If there isn't a way to give all perks just give one at a time.

I'm pretty sure it's possible, if you look at Madgaz Gaming's FABRIK DER UNTOTEN map he has a buyable Perk-a-Lot machine which gives you all the perks when you buy it.
Title: Re: give perk through trigger
Post by: reckfullies on October 11, 2016, 12:34:56 pm
I'm pretty sure it's possible, if you look at Madgaz Gaming's FABRIK DER UNTOTEN map he has a buyable Perk-a-Lot machine which gives you all the perks when you buy it.

What I mean't was if it wasn't possible with a single function just do the give_perk function for every perk at once.

Ill look right now and see if they made a function for giving them all at once.

EDIT:
It doesn't look like tryarch made a function for giving all perks.

You can just give the player every perk at the same time and it will essentially be the exact same.

If you are still having trouble with giving perks, make sure this is included in the script:
Code Snippet
Plaintext
#insert scripts\zm\_zm_perks.gsh;

and for the perkname just look inside _zm_perks.gsh for all the names.(root/share/raw/scripts/zm/_zm_perks.gsh)
Title: Re: give perk through trigger
Post by: GNT123 on October 11, 2016, 11:53:06 pm
What I mean't was if it wasn't possible with a single function just do the give_perk function for every perk at once.

Ill look right now and see if they made a function for giving them all at once.

EDIT:
It doesn't look like tryarch made a function for giving all perks.

You can just give the player every perk at the same time and it will essentially be the exact same.

If you are still having trouble with giving perks, make sure this is included in the script:
Code Snippet
Plaintext
#insert scripts\zm\_zm_perks.gsh;

and for the perkname just look inside _zm_perks.gsh for all the names.(root/share/raw/scripts/zm/_zm_perks.gsh)

 player zm_perks::give_perk("specialty_electriccherry", true);

^(what my thing looks like) Idk I cant get it to work I have tried true, and false different perks I just don't know what I'm doing wrong

Double Post Merge: October 12, 2016, 03:32:15 am
nvm I saw that one guy just post it on the shootable trigger topic
Title: Re: give perk through trigger
Post by: reckfullies on October 12, 2016, 01:23:25 pm
player zm_perks::give_perk("specialty_electriccherry", true);

^(what my thing looks like) Idk I cant get it to work I have tried true, and false different perks I just don't know what I'm doing wrong

Double Post Merge: October 12, 2016, 03:32:15 am
nvm I saw that one guy just post it on the shootable trigger topic

You put in the wrong name from the list, here is a simple list for people who don't want to look in the .gsh:
Code Snippet
Plaintext
PERK_JUGGERNOG                                - Juggernog
PERK_QUICK_REVIVE                            - Quick Revive
PERK_SLEIGHT_OF_HAND                      - Speed Cola
PERK_DOUBLETAP2                               - Doubletap
PERK_STAMINUP                                   - Staminup
PERK_PHDFLOPPER                               - PHD Flopper - DO NOT USE(Unless you have a custom script since it isn't actually in the game)!
PERK_DEAD_SHOT                                - Dead Shot
PERK_ADDITIONAL_PRIMARY_WEAPON - Mule Kick
PERK_ELECTRIC_CHERRY                      - Electric Cherry
PERK_TOMBSTONE                                - Tombstone - DO NOT USE(Unless you have a custom script since it isn't actually in the game)!
PERK_WHOSWHO                                  - Whos Who - DO NOT USE(Unless you have a custom script since it isn't actually in the game)!
PERK_VULTUREAID                                - Vulture Aid - DO NOT USE(Unless you have a custom script since it isn't actually in the game)!
PERK_WIDOWS_WINE                           - Widows Wine

Title: Re: give perk through trigger
Post by: ulraz_viper on October 12, 2016, 05:12:06 pm
you're all welcome - http://hastebin.com/yawekanaza.php (http://hastebin.com/yawekanaza.php)