UGX-Mods

Call of Duty 5: World at War => Tutorial Desk => Scripting => Topic started by: Scobalula on March 23, 2016, 07:38:10 pm

Title: [Tutorial] Max Ammo: Fill Clip
Post by: Scobalula on March 23, 2016, 07:38:10 pm
A max ammo should be a "max ammo" and since I liked in maps like Hotel V2 that it fills your clip I decided to just make a small edit to my powerups gsc to do it which I will also show you guys how to do.

First go to root\raw\maps and copy the _zombiemode_powerups.gsc to your mods maps folder, usually in root\mods\modname\maps. If the maps folder doesn't exist, create one.

Next we need to open it with a text editor, something like Notepad++ or Sublime text is preferred.

Search for this with the find function:

Code Snippet
Plaintext
full_ammo_powerup

That should bring you to this function:

Code Snippet
Plaintext
full_ammo_powerup( drop_item )
{
players = get_players();

for (i = 0; i < players.size; i++)
{
primaryWeapons = players[i] GetWeaponsList();

for( x = 0; x < primaryWeapons.size; x++ )
{
players[i] GiveMaxAmmo( primaryWeapons[x] );
}
}
// array_thread (players, ::full_ammo_on_hud, drop_item);
level thread full_ammo_on_hud( drop_item );
}



Change the entire function to this:


Code Snippet
Plaintext
full_ammo_powerup( drop_item )
{
players = get_players();

for (i = 0; i < players.size; i++)
{
primaryWeapons = players[i] GetWeaponsList();

for( x = 0; x < primaryWeapons.size; x++ )
{
players[i] SetWeaponAmmoClip( primaryWeapons[x], WeaponClipSize( primaryWeapons[x] ) );
players[i] GiveMaxAmmo( primaryWeapons[x] );
}
}
// array_thread (players, ::full_ammo_on_hud, drop_item);
level thread full_ammo_on_hud( drop_item );
}

What we're doing with this, is we're using WeaponClipSize to get the clip size which is then set by the SetWeaponAmmoClip.

And shown working:

(https://i.gyazo.com/53dac5975a56323a62d0b7a808143f24.gif)

Simple but awesome edit! You can credit me if you want but such a minuscule thing I'm not really bothered tbh. :)
Title: Re: [Tutorial] Max Ammo: Fill Clip
Post by: RichGaming on March 23, 2016, 08:13:37 pm
Love it! Thanks man!
Title: Re: [Tutorial] Max Ammo: Fill Clip
Post by: Scobalula on March 23, 2016, 08:58:42 pm
Love it! Thanks man!

No problem at all. :)
Title: Re: [Tutorial] Max Ammo: Fill Clip
Post by: Tim Smith on March 23, 2016, 09:48:55 pm
Wow thx scob. Been looking for this +1 :).
Title: Re: [Tutorial] Max Ammo: Fill Clip
Post by: Scobalula on March 23, 2016, 10:09:21 pm
Wow thx scob. Been looking for this +1 :).

Hehe no problem man. :P
Title: Re: [Tutorial] Max Ammo: Fill Clip
Post by: daedra descent on March 27, 2016, 04:40:42 am
great tutorial Scobalula. Fast, clean, efficient, and best of all, error free. +1 respect.
Title: Re: [Tutorial] Max Ammo: Fill Clip
Post by: PlutoBro on March 27, 2016, 08:45:40 am
This is great, I like not having to reload. If only max ammos worked on bouncing betty's. Oh well. Thanks for posting this, will be great for future use.
Title: Re: [Tutorial] Max Ammo: Fill Clip
Post by: Scobalula on March 27, 2016, 10:59:32 am
great tutorial Scobalula. Fast, clean, efficient, and best of all, error free. +1 respect.

Thanks man. Appreciate the feedback. :D
Title: Re: [Tutorial] Max Ammo: Fill Clip
Post by: HitmanVere on March 27, 2016, 12:48:57 pm
I cleaned up the topic fully from discussion about someone stealing other peoples line of code, which went way too off-topic. Lets keep this topic clean, guys