creationss Posted December 21, 2016 Share Posted December 21, 2016 So I'm making a mod for Woodie and I came across an idea I want to add but I don't know how to make it happen. I want a code for him that works like this. when Woodie picks up Lucy (his axe) he will lose 5 attack, but he will gain 10 defense. I have been trying for hours to figure this out but I'm just not that experienced with coding LUA let alone modding don't starve. If anyone can help me. I'd really appreciate it. Thanks in advance Link to comment Share on other sites More sharing options...
zazabar Posted December 21, 2016 Share Posted December 21, 2016 Have you tried using a listener event for onpickup? ListenForEvent("onpickup", MyFunctionHere). You can use that to be the trigger for picking up the axe. Then to change the stats, just set a variable on the character such as, hasAxeBoolean. Then change the combat.bonusdamagefn via PostInit and maybe modify the combat GetAttacked function. There is probably a better way, but it'd be best to look through the components/combat.lua file first to get some ideas. Link to comment Share on other sites More sharing options...
creationss Posted December 21, 2016 Author Share Posted December 21, 2016 I used something similar to yours inst:ListenForEvent("equip",function(inst,data) if data and data.item.prefab=="lucy" then inst.components.health.absorb = 1 inst.components.combat.damagemultiplier = 0.85 end end) inst:ListenForEvent("unequip",function(inst,data) if data and data.item.prefab=="lucy" then inst.components.health.absorb = 0 inst.components.combat.damagemultiplier = 6.5 And this worked fine. Thank you for the help though Link to comment Share on other sites More sharing options...
Aquaterion Posted December 22, 2016 Share Posted December 22, 2016 12 hours ago, creationss said: I used something similar to yours inst:ListenForEvent("equip",function(inst,data) if data and data.item.prefab=="lucy" then inst.components.health.absorb = 1 inst.components.combat.damagemultiplier = 0.85 end end) inst:ListenForEvent("unequip",function(inst,data) if data and data.item.prefab=="lucy" then inst.components.health.absorb = 0 inst.components.combat.damagemultiplier = 6.5 And this worked fine. Thank you for the help though you sure u didn't mean to type 0.65? 6.5 is super high. making a spear hit like 180 Link to comment Share on other sites More sharing options...
creationss Posted December 22, 2016 Author Share Posted December 22, 2016 41 minutes ago, Aquaterion said: you sure u didn't mean to type 0.65? 6.5 is super high. making a spear hit like 180 oh don't worry. I was just using that number to test if it actually worked or not. So I could see results crystal clear. But like always I have a different issue. Only this time I haven't been able to figure it out. A few other people I asked for help can't figure it out either. it's been going on for like 2 days and I can't progress without it. I made a completely new character and I'm trying to give him woodie's beaver passive. But I can't figure out how. Do you know the files I need to make this possible? Link to comment Share on other sites More sharing options...
Aquaterion Posted December 22, 2016 Share Posted December 22, 2016 (edited) 37 minutes ago, creationss said: oh don't worry. I was just using that number to test if it actually worked or not. So I could see results crystal clear. But like always I have a different issue. Only this time I haven't been able to figure it out. A few other people I asked for help can't figure it out either. it's been going on for like 2 days and I can't progress without it. I made a completely new character and I'm trying to give him woodie's beaver passive. But I can't figure out how. Do you know the files I need to make this possible? making him turn beaver would be quite difficult since its not in a component, its all in woodie's prefab file Edited December 22, 2016 by Aquaterion Link to comment Share on other sites More sharing options...
creationss Posted December 22, 2016 Author Share Posted December 22, 2016 all of it? so what if I just took his prefab file. and put it in my characters? Link to comment Share on other sites More sharing options...
Aquaterion Posted December 22, 2016 Share Posted December 22, 2016 7 minutes ago, creationss said: all of it? so what if I just took his prefab file. and put it in my characters? I mean you could do that.. but why would you make another woodie lol Link to comment Share on other sites More sharing options...
creationss Posted December 22, 2016 Author Share Posted December 22, 2016 I'm making a character passive that's just like woodie's but instead of beaver fever... my character will go berserk instead Z(which is woodie's beaver form) 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