Gotweapon: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
Fox (talk | contribs)
No edit summary
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Array holding boolean telling if the [[player] has the weapon
'''''gotweapon #''''' is an array that specify if player currently has a certain weapon. ''#'' Indicates the weapon ID.
 
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
 
When the player picks up the SHRINKER_WEAPON, he also gets the GROW_WEAPON. For the TRIPBOMB_WEAPON, this value is only used to indicate in the status bar if he ever possessed the weapon. For the HANDBOMB_WEAPON this is always true.
 
Note that internally the code uses a bitfield, but the structure interpret it as true/false for each weapon ID for easier access.
 
Example:
 
appendevent EVENT_RESETWEAPONS
  // remove the player's pistol if they spawned on E1L1
 
  ifvare VOLUME 0
    ifvare LEVEL 0
    {
      setplayer[THISACTOR].'''gotweapon''' PISTOL_WEAPON 0
      setplayer[THISACTOR].[[ammo_amount]] PISTOL_WEAPON 0
    }
endevent
 


[[Category:Player structure members]]
[[Category:Player structure members]]

Latest revision as of 19:56, 19 February 2020

gotweapon # is an array that specify if player currently has a certain weapon. # Indicates the weapon ID.

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

When the player picks up the SHRINKER_WEAPON, he also gets the GROW_WEAPON. For the TRIPBOMB_WEAPON, this value is only used to indicate in the status bar if he ever possessed the weapon. For the HANDBOMB_WEAPON this is always true.

Note that internally the code uses a bitfield, but the structure interpret it as true/false for each weapon ID for easier access.

Example:

appendevent EVENT_RESETWEAPONS
  // remove the player's pistol if they spawned on E1L1
  ifvare VOLUME 0
    ifvare LEVEL 0
    {
      setplayer[THISACTOR].gotweapon PISTOL_WEAPON 0
      setplayer[THISACTOR].ammo_amount PISTOL_WEAPON 0
    }
endevent