Addammo: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
 
mNo edit summary
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
addammo <weapon> <amount>
<span {{code}}>'''addammo''' <weapon> <amount></span>


Adds <amount> to ammo of <weapon>.  Similar to [[addweapon]] and [[addweaponvar]], but doesn't add the weapon if the player doesn't already have it.
Adds <amount> ammo for <weapon> to the nearest player.  Similar to [[addweapon]] and [[addweaponvar]], but doesn't give the player the weapon itself.
 
'''WARNING:''' If the player already has full ammo for the specified weapon, execution of subsequent code is halted in a fashion similar to '''[[return]]'''.
 
== Example ==
 
useractor notenemy AMMO
  fall
  ifmove RESPAWN_ACTOR_FLAG
    state respawnit
  else
    ifp pshrunk nullop
    else
      ifp palive
        ifcount 6
          ifpdistl RETRIEVEDISTANCE
            ifcanseetarget
      {
        '''addammo''' PISTOL_WEAPON PISTOLAMMOAMOUNT
        quote 65
        ifspawnedby AMMO
          state getcode
        else
          state quikget
      }
enda
 
==Weapon Reference==
{{Weapons}}
 
[[Category:Duke3D 1.3/1.5 commands]]
[[Category:Player manipulation]]

Latest revision as of 03:55, 10 January 2021

addammo <weapon> <amount>

Adds <amount> ammo for <weapon> to the nearest player. Similar to addweapon and addweaponvar, but doesn't give the player the weapon itself.

WARNING: If the player already has full ammo for the specified weapon, execution of subsequent code is halted in a fashion similar to return.

Example

useractor notenemy AMMO
  fall
  ifmove RESPAWN_ACTOR_FLAG
    state respawnit
  else
    ifp pshrunk nullop
    else
      ifp palive
        ifcount 6
          ifpdistl RETRIEVEDISTANCE
            ifcanseetarget
      {
        addammo PISTOL_WEAPON PISTOLAMMOAMOUNT
        quote 65
        ifspawnedby AMMO
          state getcode
        else
          state quikget
      }
enda

Weapon Reference

The following table lists the available weapons in Duke Nukem 3D and its expansions, along with their internal index.

Exposed Value Label Description
No 0 KNEE_WEAPON Mighty Foot. Always available.
No 1 PISTOL_WEAPON Pistol. Player starts with this weapon unless the start is located on a HURTRAIL tile (picnum 859).
No 2 SHOTGUN_WEAPON Shotgun
No 3 CHAINGUN_WEAPON "Ripper" Chaingun
No 4 RPG_WEAPON Rocket Launcher (RPG)
No 5 HANDBOMB_WEAPON Pipebomb
No 6 SHRINKER_WEAPON Shrinker
No 7 DEVISTATOR_WEAPON Devastator
No 8 TRIPBOMB_WEAPON Laser Tripbomb
No 9 FREEZE_WEAPON Freezethrower
No 10 HANDREMOTE_WEAPON Pipebomb Detonator
No 11 GROW_WEAPON Expander (Plutonium Pack/Atomic Edition only)
No 12 FLAMETHROWER_WEAPON Incinerator (World Tour only)


Defines
define KNEE_WEAPON                        0
define PISTOL_WEAPON                      1
define SHOTGUN_WEAPON                     2
define CHAINGUN_WEAPON                    3
define RPG_WEAPON                         4
define HANDBOMB_WEAPON                    5
define SHRINKER_WEAPON                    6
define DEVISTATOR_WEAPON                  7
define TRIPBOMB_WEAPON                    8
define FREEZE_WEAPON                      9
define HANDREMOTE_WEAPON                 10
define GROW_WEAPON                       11
define FLAMETHROWER_WEAPON               12