96
edits
(→Loading Resource Files: corrected example script so it actually works) |
(info on using functions with "hidden" barns (only tested on creatures so far), other minor updates) |
||
| Line 242: | Line 242: | ||
Creatures include Fish/Carpets, Guardians/War Machines, Cloth Guardians/Whales/Dragons, Jellyfish, Flow creatures, and Meteors/Comets/Shooting Stars. | Creatures include Fish/Carpets, Guardians/War Machines, Cloth Guardians/Whales/Dragons, Jellyfish, Flow creatures, and Meteors/Comets/Shooting Stars. | ||
Creatures can be added and/or modified in a similar way to Triggers and Clumps, using the functions from Creatures.lua: | |||
DynamicNodeInstances = { construct based on the format in DynamicNodeInstances.lua } | DynamicNodeInstances = { construct based on the format in DynamicNodeInstances.lua } | ||
CreateCreatures( | CreateCreatures( creatureBarn* ) --only used when adding new creatures(?) | ||
ResolveCreatureNames( game:creatureBarn | ResolveCreatureNames( creatureBarn* ) | ||
'''*''' There is no "game:creatureBarn" or other predefined global variable, but you can still access the "hidden" Barn and use these functions - see end of article. | |||
===Particle Emitters=== | ===Particle Emitters=== | ||
Particle Emitters emit particles (sparkles, puffs of sand/dust, etc.) | Particle Emitters emit particles (sparkles, puffs of sand/dust, etc.) | ||
| Line 254: | Line 254: | ||
LoadEnvFXParticles( game:envFXBarn(), game:particleBarn() ) | LoadEnvFXParticles( game:envFXBarn(), game:particleBarn() ) | ||
Based on tests where logging code was put in LoadEnvFXParticles() and ParticleEmitterInitialize() and nothing was logged, it seems this script doesn't actually run at level start, so Particle Emitters might be added to Names table by another Lua script or by inaccessible C code. But maybe this function could still add/modify Particle Emitters anyway. | Based on tests where logging code was put in LoadEnvFXParticles() and ParticleEmitterInitialize() and nothing was logged, it seems this script doesn't actually run at level start, so Particle Emitters might be added to Names table by another Lua script or by inaccessible C code. But maybe this function could still add/modify Particle Emitters anyway. | ||
===Sound Emitters=== | === Sound Emitters=== | ||
Sound Emitters emit sounds. They can be stationary or attached to a moving object somehow. It seems that most looping music is played by Sound Emitters that are set to be audible at the same volume anywhere in the level. | Sound Emitters emit sounds. They can be stationary or attached to a moving object somehow. It seems that most looping music is played by Sound Emitters that are set to be audible at the same volume anywhere in the level. | ||
| Line 274: | Line 274: | ||
LoadEnvNodes does ''not'' clear the EnvNodeInstances table automatically upon completion, and the code comments say this causes a crash, so might be a bad idea to do it yourself. | LoadEnvNodes does ''not'' clear the EnvNodeInstances table automatically upon completion, and the code comments say this causes a crash, so might be a bad idea to do it yourself. | ||
===Markers=== | ===Markers=== | ||
Markers seem to be locations, or regions of space around locations, which objects can be aimed or moved towards/away from by certain Triggers. Also, Markers can be moved around or attached to moving objects by Triggers. | Markers seem to be locations, or regions of space around locations, which objects can be aimed or moved towards/away from by certain Triggers. Also, Markers can maybe be moved around or attached to moving objects by Triggers. | ||
It has not yet been tested, but Markers can probably be added and/or modified in a similar way to Triggers and Clumps, based on MarkerInstances.lua's and the functions in Markers.lua: | It has not yet been tested, but Markers can probably be added and/or modified in a similar way to Triggers and Clumps, based on MarkerInstances.lua's and the functions in Markers.lua: | ||
| Line 284: | Line 284: | ||
It has not yet been tested, but Rails can probably be added and/or modified in a similar way to Triggers and Clumps, based on RailInstances.lua's and the functions in RailBarn.lua: | It has not yet been tested, but Rails can probably be added and/or modified in a similar way to Triggers and Clumps, based on RailInstances.lua's and the functions in RailBarn.lua: | ||
RailInstances = { construct based on the format in RailInstances.lua } | RailInstances = { construct based on the format in RailInstances.lua } | ||
LoadRails( railBarn ) | LoadRails( railBarn* ) | ||
'''*''' There is no "game:railBarn" or other predefined global variable, but you can probably still access the "hidden" Barn and use this function - see end of article. | |||
===Camera Key Frames=== | ===Camera Key Frames=== | ||
Camera Key Frames seem to be the data for basically any location/angle/etc that the camera can get moved to, whenever the camera moves by itself - not just following behind the player, or being moved around by the player. | Camera Key Frames seem to be the data for basically any location/angle/etc that the camera can get moved to, whenever the camera moves by itself - not just following behind the player, or being moved around by the player. | ||
| Line 297: | Line 297: | ||
It has not yet been tested, but Jets can probably be added and/or modified in a similar way to Triggers and Clumps, based on JetInstances.lua's and the functions in Jets.lua: | It has not yet been tested, but Jets can probably be added and/or modified in a similar way to Triggers and Clumps, based on JetInstances.lua's and the functions in Jets.lua: | ||
JetInstances = { construct based on the format in JetInstances.lua } | JetInstances = { construct based on the format in JetInstances.lua } | ||
LoadJets( | LoadJets( jetBarn* ) | ||
'''*''' There is no "game:jetBarn" or other predefined global variable, but you can probably still access the "hidden" Barn and use this function - see end of article. | |||
===Signs=== | ===Signs=== | ||
Signs are scrolling text, used only in the credits. Could maybe be used for other scrolling text as well, although there seem to already be scrolling text Triggers that might be easier for that. | Signs are scrolling text, used only in the credits. Could maybe be used for other scrolling text as well, although there seem to already be scrolling text Triggers that might be easier for that. | ||
| Line 305: | Line 305: | ||
Credits = { construct based on the format in SignData.lua } | Credits = { construct based on the format in SignData.lua } | ||
SignInstances = { construct based on the format in SignInstances.lua } | SignInstances = { construct based on the format in SignInstances.lua } | ||
InitializeSignBarn( signBarn, signData, signInstances ) | InitializeSignBarn( signBarn*, signData**, signInstances** ) | ||
<nowiki>*</nowiki> There is no "game:jetBarn" or other predefined global variable, but you can probably still access the "hidden" Barn and use this function - see end of article. | |||
===TBD / Other=== | |||
<nowiki>**</nowiki> signData and signInstances don't seem to actually be referenced inside InitializeSignBarn, so they might not be required, but if required then maybe signData is the Credits table and signInstances is the SignInstances table. ) | |||
=== TBD / Other=== | |||
These are the remaining types of level resources. They can *maybe* be manipulated in real time with Lua code, but it's not yet known if/how it can be done. | These are the remaining types of level resources. They can *maybe* be manipulated in real time with Lua code, but it's not yet known if/how it can be done. | ||
====Hulls==== | ====Hulls==== | ||
| Line 329: | Line 331: | ||
These are LevelSfx''Somewhere''-SFX.bnk and LevelMus''Somewhere''-MUS.bnk in the Data/Sounds folder; not much is known yet about how to edit these at all, other than renaming files to swap one level for another. | These are LevelSfx''Somewhere''-SFX.bnk and LevelMus''Somewhere''-MUS.bnk in the Data/Sounds folder; not much is known yet about how to edit these at all, other than renaming files to swap one level for another. | ||
====TerrainData==== | ====TerrainData ==== | ||
Terrain Data determines the terrain's Height Map and Land Color (the color of sand/snow added to the sides and/or top of some Decoration Meshes, and that collects on the player avatars). It also determines Mask Data which seems to be unused. | Terrain Data determines the terrain's Height Map and Land Color (the color of sand/snow added to the sides and/or top of some Decoration Meshes, and that collects on the player avatars). It also determines Mask Data which seems to be unused. | ||
| Line 337: | Line 339: | ||
You can change what is loaded at the start of a level by editing/replacing the DuneColorShadow.dds texture inside the DuneColorShadow.dds.D3D11x64 file in the Data/Textures/Level_''Somewhere''/Bin folder. | You can change what is loaded at the start of a level by editing/replacing the DuneColorShadow.dds texture inside the DuneColorShadow.dds.D3D11x64 file in the Data/Textures/Level_''Somewhere''/Bin folder. | ||
==Using Functions With "Hidden" Barns/Managers== | |||
Many of the functions for creating resources need a related "somethingBarn"/etc - many of them already have this as "game:somethingBarn()", but some don't appear to have any predefined global variable in Lua. For at least some of these, you can still access it and make your own global variable for it, and then use that variable whenever a function calls for a "somethingBarn". (This has only been tested with Creatures) | |||
You do this by modifying/overwriting the function used with the Barn, to save the variable that it receives when the game calls it normally (whenever a level loads). For example, you could overwrite CreateCreatures with this: | |||
function CreateCreatures( creatureBarn ) | |||
Hack_CreatureBarn = creatureBarn -- this is the part that's been modded in | |||
for i, v in ipairs( DynamicNodeInstances ) do | |||
if v.Type == "Creature" then | |||
Names[ v.ObjectName ] = creatureBarn:CreateCreature() | |||
end | |||
end | |||
end | |||
And then after the game has loaded a level at least once, you would be able to successfully call the function yourself anytime with: | |||
CreateCreatures( Hack_CreatureBarn ) | |||