Help Home

Tutorials

Weapon Scr. I
Weapon Scr. II
Missions

Reference

All Commands
General
Load/Add
Graphics
HUD
Sounds
Player
Terrain
Projectiles
Particles
Collision
Objects
AI
Nodes
Missions

Commands: player

Legend

  • X - X is a number
  • 'X' - X is a string (a letter/word/text)
  • [X=0] - X is an optional parameter with value 0 when omitted (NEVER add [] to your script!)
  • hard sync - command is hard synced

getplayeraction(PLAYER)

Parameters:
PLAYER - ID of player, 0 for current
Returns:
ACTION - action state of a player
Returns the action state of a player.
ACTION 0 means that the player is standing on the ground or walking. Other action states mean that he is either jumping or flying through the air.

getplayeralliance(PLAYER)

Parameters:
PLAYER - ID of player, 0 for current
Returns:
ALLIANCE - an alliance from 1 to 8
Returns the ALLIANCE (= color) of PLAYER.
ALLIANCE is a value from 1 to 8. All players with the same ALLIANCE are friends, players with different ALLIANCE are enemies.

The command returns 0 if it failed to get the alliance (for example if PLAYER does not exist).

Each alliance has its own color (R,G,B):
1 - 0,255,0
2 - 255,255,0
3 - 255,0,0
4 - 80,200,255
5 - 180,60,255
6 - 255,180,0
7 - 0,180,0
8 - 50,100,255

getplayercontrol()

Returns:
CONTROL - control active (1) or not (0)
Returns if the player can be controlled (1) or not (0). Default is 1. It will only be 0 if the command playercontrol has been used to deactivate player control.

getplayerdirection(PLAYER)

Parameters:
PLAYER - ID of player, 0 for current
Returns:
DIRECTION - player direction
Returns the direction of PLAYER either as -1 for left or as 1 for right.

getplayerhealth(PLAYER)

Parameters:
PLAYER - ID of player, 0 for current
Returns:
HEALTH - health of player
Returns the health of PLAYER.
Values smaller than 1 mean that PLAYER is dead.
A value of -2147483648 means that PLAYER drowned.

getplayerrotation(PLAYER)

Parameters:
PLAYER - ID of player, 0 for current
Returns:
ANGLE - current weapon rotation angle
Returns the current weapon rotation angle of PLAYER.

getplayerstate(PLAYER, STATE)

Parameters:
PLAYER - ID of player, 0 for current
STATE - a state
Returns:
ACTIVE - 1 if state is active, else 0
Checks if a STATE of a PLAYER is active or not. Returns either 1 for an active state or 0 for an inactive state.

States are:
state_poisoned
state_confused
state_frozen
state_sleeping
state_invisible

getplayerteam(PLAYER)

Parameters:
PLAYER - ID of player, 0 for current
Returns:
TEAM - team ID of this player
Returns the TEAM of PLAYER.
The team ID can range from 0 to 7 (there's a maximum of 8 teams).

getplayerweapon()

Returns:
'TABLE' - Lua table which holds the weapon functions
Returns a string with the weapon Lua table of the currently selected weapon of the active player.

getplayerweaponswitch()

Returns:
SWITCH - allow weapon switching (1) or not (0)
Returns if the player can switch the weapon (1) or not (0). Default is 1. It will only be 0 if the command playerweaponswitch has been used to deactivate weapon switching.

getplayerx(PLAYER)

Parameters:
PLAYER - ID of player, 0 for current
Returns:
X - x coordinate of player
Returns the X coordinate/position of PLAYER.

getplayerxspeed(PLAYER)

Parameters:
PLAYER - ID of player, 0 for current
Returns:
X SPEED - x speed of player
Returns the x speed of PLAYER (flying speed).

getplayery(PLAYER)

Parameters:
PLAYER - ID of player, 0 for current
Returns:
Y - y coordinate of player
Returns the Y coordinate/position of PLAYER.

getplayeryspeed(PLAYER)

Parameters:
PLAYER - ID of player, 0 for current
Returns:
Y SPEED - y speed of player
Returns the y speed of PLAYER (flying speed).

playercontrol(CONTROL)

Parameters:
CONTROL - control active (1) or not (0)
(De-)activates the player control. The player will only be controlled if playercontrol is set to 1. The game sets playercontrol to 1 automatically on the start of each turn.
Disable playercontrol if you want to create weapons which can be controlled after launching.

playercurrent()

Returns:
PLAYER - ID of player who is currently controlled
Returns the ID of the player who is currently controlled.

hard sync playerdamage(PLAYER, DAMAGE)

Parameters:
PLAYER - ID of player, 0 for current
DAMAGE - damage value
Decreases the health of PLAYER by DAMAGE.

playerforceframe(PLAYER, FRAME)

Parameters:
PLAYER - ID of player, 0 for current
FRAME - player frame (0-11)
Forces the game to render the player with a certain frame, no matter if he is falling/walking/standing/...

Most important frames are:
0 - standing (with arms)
1 - walking frame 1 / standing (no arms)
2 - walking frame 2 (no arms)
3 - jumping (with arms)
4 - falling (with arms)

Note: The frame will be forced for the next render only. You have to call this command continuously to keep that frame. Therefore you should call this command in a draw-function!

hard sync playerheal(PLAYER, HEAL)

Parameters:
PLAYER - ID of player, 0 for current
HEAL - heal value
Increases the health of PLAYER by HEAL.

playerposition(PLAYER, X, Y)

Parameters:
PLAYER - ID of player, 0 for current
X - x coordinate
Y - y coordinate
Sets the position of a player to the (X|Y) coordinate.

playerpush(PLAYER, PUSH X, PUSH Y, [ABSOLUTE=0], [PUSH OTHERS=1])

Parameters:
PLAYER - ID of player, 0 for current
PUSH X - x push value
PUSH Y - y push value
[ABSOLUTE=0] - set absolute (1) or add to current values (0)
[PUSH OTHERS=1] - push players on contact (1) or not (0)
Pushs a certain player with the speeds PUSH X and PUSH Y.
Use ABSOLUTE 1 to set the values. Use ABSOLUTE 0 to add the values to the current speed values.
Use PUSH OTHERS to control if this push is able to move other players on contact or not.

For comparison:
A normal jump equals a push with X=3, Y=-3.
A back jump equals a push with X=1,Y=-5.
(the X speed depends on the player direction of course and can also be -3 or -1 for that reason)

hard sync playerstate(PLAYER, STATE, SET)

Parameters:
PLAYER - ID of player, 0 for current
STATE - a state
SET - enable(1) or disable(0)
Enables (SET=1) or disables (SET=0) a STATE of PLAYER.

States are:
state_poisoned
state_confused
state_frozen
state_sleeping
state_invisible

hard sync playerswitch(PLAYER)

Parameters:
PLAYER - ID of player
Passes the control to PLAYER.
PLAYER has to be a player who is in the same team as the current player and who is still living.

playertable([MODE=0], [INC DEAD=1])

Parameters:
[MODE=0] - list mode
[INC DEAD=1] - include dead players (1) or not (0)?
Returns:
PLAYER TABLE - a table containing player IDs
Returns a table/array which contains the IDs of players in the game. The index starts at 1!

For MODE you can use these values:
0 - list of all players
1 - list of team-members of current player
2 - list of allied players of current player (same and other teams)
3 - list of enemies of current player

Note that all modes - besides mode 0 - exclude the current player (this means that the current player will not appear in the list).

By default all dead players are included. You can exclude them by setting INC DEAD to 0.

playerweaponswitch(SWITCH)

Parameters:
SWITCH - allow weapon switching (1) or not (0)
(De-)activates the possibility to switch the weapon. Weapon switching is only possible if this is set to 1. The game sets playerweaponswitch to 1 automatically on the start of each turn.
This command can be very useful for game modes or missions!