NyctoDarkMatter Posted June 19, 2015 Share Posted June 19, 2015 Hey! Working on a Zoidberg mod for Don't Starve Together, most of it is complete. I'm wondering what code I could use to make him gain health and sanity in the rain. Any help? Link to comment Share on other sites More sharing options...
DarkXero Posted June 19, 2015 Share Posted June 19, 2015 In Zoidberg's prefab:local function RainBuff(inst) inst.components.health:StartRegen(1, 2) inst.components.sanity.custom_rate_fn = function(inst) return TUNING.DAPPERNESS_LARGE endendlocal function Normal(inst) inst.components.health:StopRegen() inst.components.sanity.custom_rate_fn = nilendlocal function onbecamezoidberg(inst) if TheWorld.state.israining then RainBuff(inst) end inst:WatchWorldState("startrain", RainBuff) inst:WatchWorldState("stoprain", Normal)endlocal function onbecameghost(inst) Normal(inst) inst:StopWatchingWorldState("startrain", RainBuff) inst:StopWatchingWorldState("stoprain", Normal)end-- Your central functionlocal function master_postinit(inst) -- Other code of yours is here onbecamezoidberg(inst) inst:ListenForEvent("ms_respawnedfromghost", onbecamezoidberg) inst:ListenForEvent("ms_becameghost", onbecameghost)end Link to comment Share on other sites More sharing options...
NyctoDarkMatter Posted June 19, 2015 Author Share Posted June 19, 2015 Thanks for the help, dude. May I attach the prefab so you can show me where it goes? That'd help me understand a bit more. I'm a noob at coding, the only thing he does so far is have 70 damage without a weapon (which I get it, that's kinda OP, no need to tell me, I plan to lower it, it's moreso for testing purposes). Anyways, hope you can help me out.zoidberg.lua Link to comment Share on other sites More sharing options...
DarkXero Posted June 19, 2015 Share Posted June 19, 2015 *zoidberg.lua Link to comment Share on other sites More sharing options...
NyctoDarkMatter Posted June 19, 2015 Author Share Posted June 19, 2015 Thanks, dude! It works great now! The regen is just right, and the sanity regen is good without being overpowered! What's your Steam name so I can add you to the list of the contributors once I upload it? Also, are there any other things, perhaps negative things, that you think a Zoidberg character would carry? (Assuming you've seen Futurama, if not, that's fine. Also, I'd love to PM you and talk more about the code. You really saved me there! ^^) Link to comment Share on other sites More sharing options...
DarkXero Posted June 19, 2015 Share Posted June 19, 2015 *Slinky.zip Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now