Vm player

From EDukeWiki
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


See also vm_sprite and vm_distance.