Jump to content

help with wilson mod


Recommended Posts

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

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

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 :D

Link to comment
Share on other sites

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 :D

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

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

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 by Aquaterion
Link to comment
Share on other sites

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
 Share

×
  • Create New...