• 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] anyAmmoForWeaponModes, itemWeaponSetAmmo
#1
Hello

Here is a new tutorial explaining 2 ammo commands: anyAmmoForWeaponModes and itemWeaponSetAmmo.

The first one will return true if you have ammo of a particular weapon, if you have no ammo it will return false. It works like this:

Code:
anyAmmoForWeaponModes( weapon )

An example:

Code:
if( self anyAmmoForWeaponModes( self getCurrentWeapon() ) )
    self setWeaponAmmoClip( self getCurrentWeapon(), WeaponClipSize( self getCurrentWeapon() ) );

In the example above if you dont have ammo on your weapon clip, it will fill it up.

The other command: itemWeaponSetAmmo, gives ammo to a weapon which is dropped on the ground, it works like this:

Code:
itemWeaponSetAmmo( ammo for the clip, ammo for the stock, ammo for alternative weapon in case there is one like grenade launcher )

Example:

Code:
weapon = self DropItem( self getCurrentWeapon() );
weapon itemWeaponSetAmmo( 1, 5 );

The example above will drop to your ground your weapon and set its clip ammo to 1 and its stock ammo to 5. Big Grin

I hope you have enjoyed the tutorial, for any questions reply to this thread.

Thanks, @Yamato
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)