Addammo: Difference between revisions
| No edit summary | Helixhorned (talk | contribs)  correction of early return semantics | ||
| (4 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
| addammo <weapon> <amount> | '''addammo''' <weapon> <amount> | ||
| 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> to ammo of <weapon>.  Similar to [[addweapon]] and [[addweaponvar]], but doesn't add the weapon if the player doesn't already have it. | ||
| If the player already has full ammo for <weapon>, execution of subsequent code is halted in a fashion similar to '''[[return]]'''.  | |||
|  actor 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 | |||
| [[Category:Duke3D 1.3/1.5 commands]] | [[Category:Duke3D 1.3/1.5 commands]] | ||
| [[Category:Player manipulation]] | |||
Revision as of 15:35, 10 May 2012
addammo <weapon> <amount>
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.
If the player already has full ammo for <weapon>, execution of subsequent code is halted in a fashion similar to return.
actor 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
