User:AL
Revision as of 14:15, 17 January 2023 by AL (talk | contribs) (Created page with "== Scripting Notes == The exact limits of what scripting in Soldat 2 can do is not yet known, but it already looks to far exceed what was possible in Soldat 1. The following is a somewhat random assortment of different ways to affect or read the game state from scripting. === Messaging === * <code>GameChat.ChatOrLog(string message)</code> print a chat message * <code>HUD.Get.Notify(string message, UnityEngine.Color c)</code> text printout similar to flag grabbed/returne...")
Scripting Notes
The exact limits of what scripting in Soldat 2 can do is not yet known, but it already looks to far exceed what was possible in Soldat 1. The following is a somewhat random assortment of different ways to affect or read the game state from scripting.
Messaging
GameChat.ChatOrLog(string message)
print a chat messageHUD.Get.Notify(string message, UnityEngine.Color c)
text printout similar to flag grabbed/returned text
Players
The Teal.Player
object is what we manipulate to read or change data related to players.
The singleton class Teal.Players
provides many different ways to retrieve relevant player objects:
public List<Player> players; public int PlayersCount; public Player GetLocalPlayer(); public ushort GetLocalPlayerId(); public Controls GetLocalPlayerControlled(); public Player GetPlayerByID(ushort ID); public Player GetPlayerByNick(string nick); public Player GetPlayerByPropertyId(ushort id); public Controls GetPlayerControlledByID(ushort ID); public List<Player> GetPlayersOfTeam(int team); public List<Player> GetPlayersOfTeamExcept(int team, Player player); public List<Player> GetBots(); public List<Player> GetAlive(); public List<Player> GetAliveBots(); public List<Player> GetAliveHumans(); public List<Player> GetHumans(); public List<Player> GetHumansNonSpectator(); public List<Player> GetHumansOnClient(); public List<Player> GetTeam(int team); public List<Player> GetAliveTeam(int team); public List<Player> GetSpecators(); public List<Player> GetPlayersNonSpecators();
The Controls
class allows querying some properties like whether the player is dead, is human/bot, and some (limited?) input events
Misc
- The
Teal.RealTime
class offers a number of different time measures:public static float realtimeSinceStartup;
public static float timeSinceLevelLoad;
public static double SecsSinceStart;