luafunctionref
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| luafunctionref [2025/01/08 20:30] – bredroll | luafunctionref [2026/03/03 18:17] (current) – [Loading] bredroll | ||
|---|---|---|---|
| Line 26: | Line 26: | ||
| * library_custom_X.lua | * library_custom_X.lua | ||
| * screen/hud | * screen/hud | ||
| + | |||
| ==== Execution ==== | ==== Execution ==== | ||
| Line 48: | Line 49: | ||
| Next is the update cycle, most of the heavy lifting goes on in here, these are where you can introspect the current vehicle, carrier details, weapons, map, nearby units, other players, missiles, etc. graphical/ | Next is the update cycle, most of the heavy lifting goes on in here, these are where you can introspect the current vehicle, carrier details, weapons, map, nearby units, other players, missiles, etc. graphical/ | ||
| + | |||
| + | === Refresh Rate === | ||
| + | |||
| + | I have recently discovered there is another factor that influences how often a script '' | ||
| + | |||
| ==== Functions ====== | ==== Functions ====== | ||
| Line 1202: | Line 1208: | ||
| Native/C function | Native/C function | ||
| + | |||
| + | Return '' | ||
| Usable in: | Usable in: | ||
| Line 1259: | Line 1267: | ||
| Native/C function | Native/C function | ||
| + | |||
| + | Return the localized string for the given index word/phrase from the '' | ||
| + | < | ||
| + | update_get_loc(e_loc.upp_paste) | ||
| + | </ | ||
| + | Will return " | ||
| Usable in: | Usable in: | ||
| Line 1302: | Line 1316: | ||
| Native/C function | Native/C function | ||
| + | |||
| + | Get the ID of the current player. | ||
| Usable in: | Usable in: | ||
| Line 1315: | Line 1331: | ||
| Native/C function | Native/C function | ||
| + | |||
| + | Get the team ID of the current player. | ||
| Usable in: | Usable in: | ||
| Line 1329: | Line 1347: | ||
| Native/C function | Native/C function | ||
| + | |||
| + | Get the logic tick. This is the game simulation counter starting at zero the moment the map is crated. It increments by one every simulation frame. The game is tuned such that a second of real time covers 30 game ticks. | ||
| + | |||
| + | During the span of an '' | ||
| + | |||
| + | It can be thought of as a primitive low-res clock. | ||
| Usable in: | Usable in: | ||
| Line 1348: | Line 1372: | ||
| Native/C function | Native/C function | ||
| + | |||
| + | Get an object representing a recently destroyed vehicle. Used along with '' | ||
| + | |||
| + | Destroyed vehicles have several methods. | ||
| + | |||
| + | * '' | ||
| + | * get a '' | ||
| + | * '' | ||
| + | * get the team ID of the destroyed vehicle | ||
| + | * '' | ||
| + | * get float in range 0-1 based on the age of destruction, | ||
| Usable in: | Usable in: | ||
| Line 1361: | Line 1396: | ||
| Native/C function | Native/C function | ||
| + | |||
| + | Get the number of destroyed vehicles visible on the game map. | ||
| Usable in: | Usable in: | ||
| Line 1371: | Line 1408: | ||
| ---- | ---- | ||
| - | ===update_get_map_vehicle_by_id=== | + | === update_get_map_vehicle_by_id === |
| Native/C function | Native/C function | ||
| + | |||
| + | Get an object representing a player or AI controlled unit in game, the unit may be docked or active. | ||
| + | |||
| + | The HUD can obtain 3D position (lat-lon-alt) information about a unit where the screen scripts can only obtain 2D (lat-lon). | ||
| + | |||
| + | The HUD can also see unit waypoints since update 1.5.16. | ||
| + | |||
| + | Bridge screens can fully get/set waypoint data for all units on all teams. | ||
| + | |||
| + | vehicle objects have many methods, the most commonly used are: | ||
| + | |||
| + | * '' | ||
| + | * locking/ | ||
| + | * '' | ||
| + | * get the vehicle ID number. | ||
| + | * '' | ||
| + | * get the vehicle type (a value in the '' | ||
| + | * '' | ||
| + | * get the vehicle team number | ||
| + | * '' | ||
| + | * get the vehicle team number | ||
| + | * '' | ||
| + | * get the vehicle 2D position as a '' | ||
| + | * '' | ||
| + | * get the vehicle 3D position as a '' | ||
| Usable in: | Usable in: | ||
| Line 1383: | Line 1445: | ||
| * screen_weapons_support.lua | * screen_weapons_support.lua | ||
| * vehicle_hud.lua | * vehicle_hud.lua | ||
| + | |||
| Example call: | Example call: | ||
| '' | '' | ||
| - | < | + | |
| + | < | ||
| + | local attached_vehicle = update_get_map_vehicle_by_id(attached_vehicle_id) | ||
| + | </ | ||
| ---- | ---- | ||
| + | |||
| + | |||
| ===update_get_map_vehicle_by_index=== | ===update_get_map_vehicle_by_index=== | ||
luafunctionref.1736368225.txt.gz · Last modified: 2025/01/08 20:30 by bredroll
