![]() ![]() ![]() The functions SpawnCircle and SpawnLine are useful for checking your maths and verifying assumptions. The log.txt file in your Forts/users/(steamid) folder will also record them in full.ĪddTextControl and SetControlText can be used to display information in a convenient place on the screen. The console will show output of Log, plus syntax error and exception messages. You can use Log to see where execution gets to and the value of variables. WARNING: do not store non-deterministic values in the data table, such as the local team Id.įinding out where your script is going wrong is an important skill. WARNING: setting values outside the data table will cause errors at run time. how many projectiles are there currently? Table.insert(data.projectiles, projectileNodeId)įunction OnProjectileDestroyed(nodeId, teamId, saveName, structureIdHit) You are likely to experience unexpected behaviour if you do this.įunction OnWeaponFired(teamId, saveName, weaponId, projectileNodeId) For example the value returned by GetLocalTeamId, or the time the player last pressed a button. This means that the data table should not contain anything that is unique to a player (i.e. When a player joins a game in progress, the host writes the data table of each script to a file, and sends this to the new player to bring them up to speed. Sub-tables are fine, but function values must be avoided, as these can't be serialised. To do this correctly all state must be stored within the data table, which is automatically written and restored by the game for each script, to allow late joining and replay seeking. It must be done with care to avoid desyncs, however. This can be useful for tracking objects, statistics, and AI state. It's possible for the script to set values that last longer than the current call. It behaves just like a mission script, but is not tied to a specific map. If the mod is active and a exists the game will load it. Mods can have an optional file in their root, such as mods/sandbags_large/a. Use Skirmish or Multiplayer to test them. WARNING: mission scripts don't run in Sandbox. These scripts have a few settings specific to maps, such as to force on mods and to mark the map as symmetrical: If the requested map name contains non-ANSI characters it will be something like maps/playermap1/a. On creation of the map this file is automatically made and takes the name of the map folder, such as maps/Vanilla/a. the function can be one of the built-in script functions or defined by the script call the MyDelayedFunc function with parameter 'myParam' in 5 seconds time necessary to access script functions, plus basic functions, types and variables The script can use the built-in function ScheduleCall to make things happen later. The main entry points are the Load, Update and OnRestart events. There are two types of functions listed below: 'script functions' and 'events'. This document provides details on the Application Programming Interface (API) between Forts and scripts used for mission and mod implementation. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |