Jump to content

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!

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.

Thank you for the help, but exactly where are the files?  (Don't Starve/data/???)

And also, where does it say how much damage and such it does when the player is hit?  Sorry, I feel like this is extremely obvious... >~<

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).

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...