Vm player: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Fox (talk | contribs)
Created page with "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 a..."
 
Fox (talk | contribs)
No edit summary
 
Line 1: Line 1:
This is used to determine the ID of the current player. This is what "THISACTOR" returns when using [[setplayer]], etc.
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 [[resetplayer]], etc.
Changing this value is useful for commands that only affect the current player, such as [[addphealth]], etc.


In most cases, [[vm_sprite]] should also be set to reflect the player sprite ([[i]]).
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:
It can also be used for when making a loop through all players. Example:

Latest revision as of 06:08, 19 February 2020

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.