SetPlayerClass: Difference between revisions

From Zandronum Wiki
(Created page with "{{Template:ACSWarning}} int '''SetPlayerClass'''(int player, str class, bool respawn) '''(<font color="darkblue">3.1-alpha</font> <font color="red">only</font>)''' ==Usage==...")
 
m (Replaced "3.1-alpha only" with "Zandronum 3.1 only".)
Line 1: Line 1:
{{Template:ACSWarning}}
{{Template:ACSWarning}}
int '''SetPlayerClass'''(int player, str class, bool respawn) '''(<font color="darkblue">3.1-alpha</font> <font color="red">only</font>)'''
int '''SetPlayerClass'''(int player, str class, bool respawn) '''(<font color="darkblue">Zandronum 3.1</font> <font color="red">only</font>)'''


==Usage==
==Usage==

Revision as of 16:02, 26 February 2021

This article documents a Zandronum-specific ACS feature which may not be supported by ZDoom and its other child ports.

int SetPlayerClass(int player, str class, bool respawn) (Zandronum 3.1 only)

Usage

Changes the class a player is currently using. Note that in order for this to work, the player must exist and not a true spectator, and the class must be a valid player class that isn't forbidden to the player (eg. the class is restricted to a team the player isn't on).

Parameters

  • player: The number of the player to change their class.
  • class: The name of the actor to change the player to. This must be a valid actor that inherits from APlayerPawn.
  • respawn: If true, the player will immediately respawn with the new class, otherwise their class won't change until they respawn normally.

Return Value

Returns 1 if the player's class was successfully changed, 0 on failure (eg. the player or class don't exist).