UGX-Mods

Call of Duty: Black Ops 3 => Help Desk => Scripting => Topic started by: Blink-420 on October 10, 2016, 07:45:46 pm

Title: How to add buyable max ammo
Post by: Blink-420 on October 10, 2016, 07:45:46 pm
My map is in need of max ammo that is buyable..I tried a few old World at War scripts but couldn't seem to get any of them working..please help!
Title: Re: How to add buyable max ammo
Post by: Tomzen on October 11, 2016, 04:58:43 am
I have a script at home, if you wait till 3 my time. (it's 12:58 right now) I'll PM it to you when I'm home.

Double Post Merge: October 11, 2016, 09:16:52 am
I might as well share it here:

Code Snippet
Plaintext
function MaxAmmo()
{
    trigger = GetEnt("maxammo_trigger", "targetname");
    trigger SetHintString("Press ^3&&1^7 for max ammo."); // Changes the string that shows when looking at the trigger.
    trigger SetCursorHint("HINT_NOICON"); // Changes the icon that shows when looking at the trigger.
    trigger1cost = 4500;
 
    while(1)
    {
        while(1)
        {
            // Purchase Code
            trigger waittill("trigger", player);
                 
            if(player.score >= trigger1cost)
            {
                player zm_score::minus_to_player_score(trigger1cost);
                trigger PlayLocalSound( "cha-ching" );
                break;
            }
            else
            {
                trigger PlayLocalSound( "deny" );
            }
        }
 
players = GetPlayers();

for (i = 0; i < players.size; i++)
{
primaryWeapons = players[i] GetWeaponsList();
players[i] PlayLocalSound( "maxammosnd" );
players[i] notify( "zmb_max_ammo" );

for( x = 0; x < primaryWeapons.size; x++ )
{

players[i] GiveMaxAmmo( primaryWeapons[x] );
}
}

        wait(5);
    }
}

Add a trigger to your map with the targetname "maxammo_trigger"
Title: Re: How to add buyable max ammo
Post by: Blink-420 on October 12, 2016, 01:05:06 am
I have a script at home, if you wait till 3 my time. (it's 12:58 right now) I'll PM it to you when I'm home.

Double Post Merge: October 11, 2016, 09:16:52 am
I might as well share it here:

Code Snippet
Plaintext
function MaxAmmo()
{
    trigger = GetEnt("maxammo_trigger", "targetname");
    trigger SetHintString("Press ^3&&1^7 for max ammo."); // Changes the string that shows when looking at the trigger.
    trigger SetCursorHint("HINT_NOICON"); // Changes the icon that shows when looking at the trigger.
    trigger1cost = 4500;
 
    while(1)
    {
        while(1)
        {
            // Purchase Code
            trigger waittill("trigger", player);
                 
            if(player.score >= trigger1cost)
            {
                player zm_score::minus_to_player_score(trigger1cost);
                trigger PlayLocalSound( "cha-ching" );
                break;
            }
            else
            {
                trigger PlayLocalSound( "deny" );
            }
        }
 
players = GetPlayers();

for (i = 0; i < players.size; i++)
{
primaryWeapons = players[i] GetWeaponsList();
players[i] PlayLocalSound( "maxammosnd" );
players[i] notify( "zmb_max_ammo" );

for( x = 0; x < primaryWeapons.size; x++ )
{

players[i] GiveMaxAmmo( primaryWeapons[x] );
}
}

        wait(5);
    }
}

Add a trigger to your map with the targetname "maxammo_trigger"

I'm getting this error, any ideas? I added the script to the bottom of my mapname.gsc and did "level thread MaxAmmo(); under the main.


UNRECOVERABLE ERROR:
  ^1SCRIPT ERROR: No generated data for 'scripts/zm/zm_kfc3.gsc'
ERR(6E) scripts/zm/zm_kfc3.gsc (355,1)  : Compiler Internal Error :  Unresolved external 'zm_score::minus_to_player_score'
Title: Re: How to add buyable max ammo
Post by: Tomzen on October 12, 2016, 09:46:45 am
Oh yeah, sorry you have to also add this with the others:

Code Snippet
Plaintext
#using scripts\zm\_zm_score;