96
edits
(→Example script: LoadModLevelObjects: clarification continued) |
m |
||
| Line 1: | Line 1: | ||
So far, it seems the most stable way to add level objects that will interact with absolutely everything properly - especially by adding non-temporary Triggers - is to include them in the "(Object Type)Instances" tables that get loaded at the very start of the level. This is also one of the best times to edit any level object that you want to be changed before the level actually begins to run, and might be the only time you can change Triggers from one Type to another. | So far, it seems the most stable way to add level objects that will interact with absolutely everything properly - especially by adding non-temporary Triggers - is to include them in the "(Object Type)Instances" tables that get loaded at the very start of the level. | ||
This is also one of the best times to edit any level object that you want to be changed before the level actually begins to run, and might be the only time you can change Triggers from one Type to another. | |||
To do this, you can add code to the Lua functions which construct objects from their ...Instances tables, so that whenever the game calls those functions at the start of a level, new object constructors are inserted and/or existing objects are changed before the objects start getting constructed. | To do this, you can add code to the Lua functions which construct objects from their ...Instances tables, so that whenever the game calls those functions at the start of a level, new object constructors are inserted and/or existing objects are changed before the objects start getting constructed. | ||
Another option is to add code to the embedded (Object Type)Instances.lua files themselves, and make them call a function which adds/edits level objects in the table or simply loads a completely new table from a non-embedded file. Some level object types seem to be built with currently-inaccessible C functions instead of Lua functions, and this might be the only way to change those tables. | Another option is to add code to the embedded (Object Type)Instances.lua files themselves, and make them call a function which adds/edits level objects in the table or simply loads a completely new table from a non-embedded file. Some level object types seem to be built with currently-inaccessible C functions instead of Lua functions, and this might be the only way to change those tables. | ||
'''Important note-''' To avoid causing new glitches in your game, and ''especially'' to avoid causing them in the games of non-modding companions, new objects which weren't in the original game apparently need to: | '''Important note-''' To avoid causing new glitches in your game, and ''especially'' to avoid causing them in the games of non-modding companions, new objects which weren't in the original game apparently need to: | ||