96
edits
(Improved/moved note about avoiding object-order problems) |
(→Example script: LoadModLevelObjects: clarifying some stuff) |
||
| Line 440: | Line 440: | ||
Run the main script, and the script which modifies the object constructor functions (or modify the embedded Lua files containing the object constructor functions so that they look like they do here, and run the main script before the game starts loading Level_Graveyard for the first time). | Run the main script, and the script which modifies the object constructor functions (or modify the embedded Lua files containing the object constructor functions so that they look like they do here, and run the main script before the game starts loading Level_Graveyard for the first time). | ||
*Note: if | *Note: if you run those object constructor functions in any other Lua code after the level has started, make sure you pass them a non-false value at the end for "lua", for example: <code>CreateTriggers(game:eventBarn(),true)</code> | ||
Then create/assign tables of level object constructors inside the Mod.LevelObjects... tables, and the object changes will occur whenever a level loads. | |||
'''Table usage''' | |||
* | The "main" tables are for the different functions of the script: | ||
* | *Mod.LevelObjects.'''Add''' tables will create additional new objects. | ||
*Mod.LevelObjects.'''Edit''' tables will replace existing objects with different objects, using the same ObjectName; this can be used to change objects from the original game, as well as new objects made with the "Add" tables. | |||
*Mod.LevelObjects.'''Null''' tables will safely "remove" objects with the designated ObjectNames, by changing them into predefined "null" objects that do nothing but technically are still there. | |||
**This change to "nothing" takes priority over any changes done in Edit tables. | |||
**The script on this page only can do Null for triggers/timelines/clumps so far, haven't bothered figuring out "null" constructors for other object types yet. | |||
Each of these function-based tables includes object-type-based tables, with the type name used by their Instances table: for example Mod.LevelObjects.Add.Trigger is for adding Triggers to TriggerInstances. | |||
'c''Speifying levels to change''' | |||
The tables actually filled with object constructors are level-based, and are named like: | |||
<code> Mod.LevelObjects.(Function).(Object Type).(Level)</code> | |||
For tables that should only load in a specific level, use ["(the level UID).0"] as the table key, for example adding triggers to the default Chapter Select/Level_Graveyard would be: | For tables that should only load in a specific level, use ["(the level UID).0"] as the table key, for example adding triggers to the default Chapter Select/Level_Graveyard would be: | ||