To use an XS script in a Random Map Script, do the following: you want to chat the amount of food a player has) you must initialize your parameter variables.Įxample on how a function written inside the editor looks: If you want to write a function which accepts parameters (e.g.
How to write functions which accept parameters: if there is 2 players in a match, only 2 is returned. Returns the number of players in a match (Excluding Gaia) E.g. XsSetPlayerAttribute(long playerId, long attribute, float value) Sets the desired player attribute to the value specified. XsPlayerAttribute(long playerId, long attribute) Returns the value of the desired player attribute. XsChatData(“Player one food: %d”, food) Sends a chat with the desired message/variable. XsEffectAmount(cModResource, cAttributeStone, cSetAttribute, 50, -1) Modify players starting resources, in this case, set starting stone to 50. XsEffectAmount(long effect, long itemName, long type, float value, long playerId)
Set playerId to -1 to apply the change to all players. XsSetTriggerVariable(long triggerVariableId, long value)Īllows you to modify a unit or building with research-style type effects. Sets a trigger variable to the desired value. Returns the value of Trigger Variable 0. XsTriggerVariable(long triggerVariableId) Returns the value of the desired Trigger Variable. if you had a function called doesPlayerHaveFood() you will only need to write doesPlayerHaveFood in the Script Call textbox.)