PlayerID is a declaration of a player. It is really a special Table:
To actually get the player's id number, use Player_GetID?.
This is usually put into functions when we want to test something (like what a player's requisition is), or do something to them (stop them from building a cirtain unit, or whatever).
It can be returned and tested against the original definitions at the top of your SCAR file as well. Setup_Player? gives you the proper table to use for all PlayerID related code.
-- Mandatory code in SCAR files for anything to do with the players function OnGameSetup() -- Setup player globals g_Player1 = Setup_Player(0, "Ultramarines", "space_marine_race", 1) g_Player2 = Setup_Player(1, "Evil Sunz", "ork_race", 2) g_Player3 = Setup_Player(2, "Farseer Eldar", "eldar_race", 3) g_Player4 = Setup_Player(3, "Iron Fists", "chaos_race", 4) end function OnGameRestore() -- Restore our global variables g_Player1 = World_GetPlayerAt(0) g_Player2 = World_GetPlayerAt(1) g_Player3 = World_GetPlayerAt(2) g_Player4 = World_GetPlayerAt(3) end
Data Types
Functions
SCAR Home
Wiki Home