Kaiwe Posted July 25, 2017 Share Posted July 25, 2017 I'm modding for the first time but i'm a little familiar with coding from high school. I'm also new to this forum and couldn't seem to find these codes listed anywhere? if anyone could give me some tips on coding lines for the objectives below for a custom character mod? - Either immune to damage from shadow tentacles or them not appearing due to the character. - Health/insanity gained from eating raw meat. - Vulnerable to fire damage. I'm currently following a detailed tutorial at http://dont-starve.surge.sh/ so i know where to add the code, just not the code itself. TYSM for any help! Link to comment Share on other sites More sharing options...
Andreasgamming Posted July 25, 2017 Share Posted July 25, 2017 inst.components.health.fire_damage_scale = 3 inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED * 1.2 inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED * 1.2 I'm not exactly sure if this works but it should, and what do you mean by shadow tentacles? the only ones I know of spawn when using the thucelite club and they don't harm the player. Link to comment Share on other sites More sharing options...
Kaiwe Posted July 25, 2017 Author Share Posted July 25, 2017 Thank you a ton! Just to confirm, the above is just for the vulnerability to fire, right? And these are those nasty little tentacles! http://dontstarve.wikia.com/wiki/Tentacle Link to comment Share on other sites More sharing options...
Andreasgamming Posted July 25, 2017 Share Posted July 25, 2017 Oh those, Alright, and the code I had for a while and had removed it from my character when I didn't want it any more. this part of the code inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED * 1.2 inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED * 1.2 should make the character run faster when on fire. (Though I am not too sure if it works completely as I didn't notice a difference in the walkspeed when testing) Link to comment Share on other sites More sharing options...
Andreasgamming Posted July 25, 2017 Share Posted July 25, 2017 (edited) any way these codes are simple if you get a basic understanding of the Don't starve API the part with making the tentacles passive towards the character on the other hand... I cant even think how that would be coded. The eating of raw/monstermeat I think you can find in Webber's LUA under don'tstarvetogehter/data/scripts webber.lua I believe there might be something there that could help. Edited July 25, 2017 by Andreasgamming Link to comment Share on other sites More sharing options...
Kaiwe Posted July 25, 2017 Author Share Posted July 25, 2017 thank you so so much! ill go check for the raw meat part now, i really appreciate it! Link to comment Share on other sites More sharing options...
ZupaleX Posted July 25, 2017 Share Posted July 25, 2017 1 hour ago, Andreasgamming said: Oh those, Alright, and the code I had for a while and had removed it from my character when I didn't want it any more. this part of the code inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED * 1.2 inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED * 1.2 should make the character run faster when on fire. (Though I am not too sure if it works completely as I didn't notice a difference in the walkspeed when testing) That would just make the character run faster in general, not linked to being on fire. About the tentacles, you would need to modify their behaviour directly if you don't want them to come out. If you modify their targeting function to ignore your character that should odo the job. Let's say you add a tag into your character prefab inst:AddTag("notentacletarget") then in you modmain you could add something along these lines local function MyTentacleTargetModFn(inst) if inst.components and inst.components.combat then if inst.components.combat.target ~= nil and inst.components.combat.target:HasTag("notentacletarget") then inst.components.combat:TryRetarget() if inst.components.combat.target:HasTag("notentacletarget") then -- retargeting failed because no other valid target around inst.components.combat:DropTarget() -- we make the tentacle drop the target (your character) return end end end end AddPrefabPostInit("tentacle", function(tentacle) if TheWorld.ismastersim then local OriginalTargetFn = tentacle.components.combat.targetfn tentacle.components.combat.targetfn = function(inst) OriginalTargetFn(inst) -- we call the original targeting function MyTentacleTargetModFn(inst) -- we post check if the target is your character by executing the function defined above end end end) Untested but that gives you the idea Link to comment Share on other sites More sharing options...
Lumina Posted July 25, 2017 Share Posted July 25, 2017 2 hours ago, Andreasgamming said: should make the character run faster when on fire. (Though I am not too sure if it works completely as I didn't notice a difference in the walkspeed when testing) You need a condition for it to work, like "if character is on fire, then, [improved stat], else [base stat]" Link to comment Share on other sites More sharing options...
Andreasgamming Posted July 25, 2017 Share Posted July 25, 2017 1 minute ago, Lumina said: You need a condition for it to work, like "if character is on fire, then, [improved stat], else [base stat]" Alright, thanks for the tip. Link to comment Share on other sites More sharing options...
Kaiwe Posted July 26, 2017 Author Share Posted July 26, 2017 oh thank you! ill have to do the updates tomorrow, but ill post if it works! 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