Jump to content

Hunger damage mutiplier.


Recommended Posts

So I was trying to do hunger damage multiplier thing like on wolfgang but more primite. I ended up with something like thisi "inst:DoPeriodicTask(1, function(inst)    if inst.components.hunger.current < 150 then inst.components.combat.damagemultiplier = 1)" but it gives me error. Any ideas?
(Btw I'm new to modding so don't judge me)

Link to comment
Share on other sites

19 hours ago, Kycius said:

So I was trying to do hunger damage multiplier thing like on wolfgang but more primite. I ended up with something like thisi "inst:DoPeriodicTask(1, function(inst)    if inst.components.hunger.current < 150 then inst.components.combat.damagemultiplier = 1)" but it gives me error. Any ideas?
(Btw I'm new to modding so don't judge me)

Please provide the error message log for assistance with troubleshooting your issue.

You can find the error log inside Documents>Klei>Don't Starve Together.

Link to comment
Share on other sites

I believe that's the problem. Don't know how to fix it tho'.

[00:01:52]: [string "scripts/mainfunctions.lua"]:120: Error loading file prefabs/zim


[string "../mods/Keyui/scripts/prefabs/zim.lua"]:63: unexpected symbol near ')'
LUA ERROR stack traceback:
        =[C] in function 'assert'
        scripts/mainfunctions.lua(120,1)
        =(tail call) ?
        =[C] in function 'xpcall'
        scripts/mods.lua(154,1)
        scripts/mods.lua(593,1) in function 'RegisterPrefabs'
        scripts/gamelogic.lua(226,1) in function 'LoadAssets'
        scripts/gamelogic.lua(811,1)
        =[C] in function 'SetPersistentString'
        scripts/saveindex.lua(176,1) in function 'Save'
        scripts/saveindex.lua(366,1)
        =[C] in function 'SerializeWorldSession'
        scripts/networking.lua(276,1) in function 'SerializeWorldSession'
        scripts/saveindex.lua(369,1) in function 'OnGenerateNewWorld'
        scripts/gamelogic.lua(822,1) in function 'cb'
        scripts/screens/worldgenscreen.lua(144,1) in function 'OnUpdate'
        scripts/frontend.lua(597,1) in function 'Update'
        scripts/update.lua(92,1)

Link to comment
Share on other sites

It looks pretty normal to me.

 

    -- Stats    


    inst.components.health:SetMaxHealth(100)
    inst.components.hunger:SetMax(200)
    inst.components.sanity:SetMax(20)
    inst.components.combat.damagemultiplier = 3
    inst.components.health:StartRegen(0.5, 1)
    inst:DoPeriodicTask(1, function(inst)    if inst.components.hunger.current < 150 then inst.components.combat.damagemultiplier = 1)                          <---- This is the line 63
end

Edited by Kycius
Link to comment
Share on other sites

47 minutes ago, Kycius said:

It looks pretty normal to me.

  Hide contents

    -- Stats    


    inst.components.health:SetMaxHealth(100)
    inst.components.hunger:SetMax(200)
    inst.components.sanity:SetMax(20)
    inst.components.combat.damagemultiplier = 3
    inst.components.health:StartRegen(0.5, 1)
    inst:DoPeriodicTask(1, function(inst)    if inst.components.hunger.current < 150 then inst.components.combat.damagemultiplier = 1)                          <---- This is the line 63
end

You need to put end inside of the DoPeriodicTask. It should look like this.

inst:DoPeriodicTask(1, function(inst)    if inst.components.hunger.current < 150 then inst.components.combat.damagemultiplier = 1 end end)  

The first end is for the if statement you added in, the second end is for the function. You can remove the end that's outside of the function as it's not needed.

Link to comment
Share on other sites

4 hours ago, RedHairedHero said:

You need to put end inside of the DoPeriodicTask. It should look like this.

inst:DoPeriodicTask(1, function(inst)    if inst.components.hunger.current < 150 then inst.components.combat.damagemultiplier = 1 end end)  

The first end is for the if statement you added in, the second end is for the function. You can remove the end that's outside of the function as it's not needed.

Thank you so much!!

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