Jump to content

Where is the lightning code?


Recommended Posts

I wanted to make a mod increasing the chance of lightning hitting you when carrying metals.  I opened the only file under the name "lightning", and it seemed to only contain the lightning spawning code, but not the code when the lightning hits you.  Where is that part of the code?  This probably has a fairly obvious answer, but I couldn't find it.  Thank you!

Link to comment
Share on other sites

Seasonmanager.lua (+seasonmanager_rog, seasonmanager_sw) seem to have lightning code (function SeasonManager:DoLightningStrike(pos, ignoreRods)) and also seems to use playerlightningtarget.lua (function PlayerLightningTarget:SetHitChance(chance) maybe what you need?)

 

I have no clue when it comes to modding (still trying to learn) so can't help beyond that.

Link to comment
Share on other sites

All of the logic is in the scripts folder, with the components being in the components subfolder. So you'll find the PlayerLightningTarget component in the playerlightningtarget.lua file located in data/scripts/components subfolder of your DS installation. However, the DLCs are loaded over the base game, which means that if you are playing RoG or SW, the game will use the DLC files whenever present instead of the original ones. If you're playing RoG, the game will use the playerlightningtarget.lua file in data/DLC0001/scripts/components, and data/DLC0002/scripts/components for SW. If there is no such file for the DLC, the game loads the base game file (for example, there's no DLC file for the Herd component, so the base game file is always used).

Lightning damage is defined by the constant TUNING.LIGHTNING_DAMAGE in tuning.lua (in data/scripts, data/DLC0001/scripts or data/DLC0002/scripts depending on what you're playing).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...