Vm player

From EDukeWiki
Revision as of 06:08, 19 February 2020 by Fox (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is used to determine the ID of the "current" player. This is what "THISACTOR" returns when using setplayer, etc.

Changing this value is useful for commands that only affect the current player, such as addphealth, etc.

When used inside of an actor code or actor-specific events, it will equal the closest player. When used by a player or player-specific events, it will return the player itself.

In the later case, vm_sprite should also be set to reflect the player sprite (i).

It can also be used for when making a loop through all players. Example:

appendevent EVENT_WORLD
  for My_Player range MULTIMODE
  {
    setuserdef[].vm_sprite player[My_Player].i
    setuserdef[].vm_player My_Player

    [...]
  }
endevent

See also vm_sprite and vm_distance.