KBID1 Posted July 26, 2023 Share Posted July 26, 2023 I wanted to know if there was a way to make a character do more damage when they’re insane, and also when they’re insane their hunger drains faster. If someone could help me with this i’d be greatly appreciated Link to comment https://forums.kleientertainment.com/forums/topic/149858-damage-increased-when-insane-as-well-as-higher-hunger-rate/ Share on other sites More sharing options...
Glommer2 Posted July 28, 2023 Share Posted July 28, 2023 --try this --each time this function triggered, we change the dmg rate and hunger rate local function insanestate(inst) if inst.components.hunger then inst.components.hunger.hungerrate = TUNING.WILSON_HUNGER_RATE * 2 end if inst.components.combat then inst.components.combat.damagemultiplier = 2 end end --turn it higher when insane local function sanestate(inst) if inst.components.hunger then inst.components.hunger.hungerrate = TUNING.WILSON_HUNGER_RATE * 1 end if inst.components.combat then inst.components.combat.damagemultiplier = 1 end end --turn it normal when sane local master_postinit = function(inst) inst:ListenForEvent("goinsane", changestate) inst:ListenForEvent("gosane", changestate) --here we add two listerer to trigger the function end Link to comment https://forums.kleientertainment.com/forums/topic/149858-damage-increased-when-insane-as-well-as-higher-hunger-rate/#findComment-1655166 Share on other sites More sharing options...
KBID1 Posted July 29, 2023 Author Share Posted July 29, 2023 On 7/28/2023 at 12:58 AM, Glommer2 said: --try this --each time this function triggered, we change the dmg rate and hunger rate local function insanestate(inst) if inst.components.hunger then inst.components.hunger.hungerrate = TUNING.WILSON_HUNGER_RATE * 2 end if inst.components.combat then inst.components.combat.damagemultiplier = 2 end end --turn it higher when insane local function sanestate(inst) if inst.components.hunger then inst.components.hunger.hungerrate = TUNING.WILSON_HUNGER_RATE * 1 end if inst.components.combat then inst.components.combat.damagemultiplier = 1 end end --turn it normal when sane local master_postinit = function(inst) inst:ListenForEvent("goinsane", changestate) inst:ListenForEvent("gosane", changestate) --here we add two listerer to trigger the function end The code is not working, it says I disconnected from the server whenever I try and join. Link to comment https://forums.kleientertainment.com/forums/topic/149858-damage-increased-when-insane-as-well-as-higher-hunger-rate/#findComment-1655734 Share on other sites More sharing options...
Glommer2 Posted August 2, 2023 Share Posted August 2, 2023 what have you done? you need to add the first part in your character file and add the second part in the master_postinit. you'd better upload your character file here so i can check if the format is right Link to comment https://forums.kleientertainment.com/forums/topic/149858-damage-increased-when-insane-as-well-as-higher-hunger-rate/#findComment-1656604 Share on other sites More sharing options...
Glommer2 Posted August 2, 2023 Share Posted August 2, 2023 I see, I forget to rename the name of function used by listener it should be like this Link to comment https://forums.kleientertainment.com/forums/topic/149858-damage-increased-when-insane-as-well-as-higher-hunger-rate/#findComment-1656606 Share on other sites More sharing options...
Glommer2 Posted August 2, 2023 Share Posted August 2, 2023 local function insanestate(inst) if inst.components.hunger then inst.components.hunger.hungerrate = TUNING.WILSON_HUNGER_RATE * 2 end if inst.components.combat then inst.components.combat.damagemultiplier = 2 end end --turn it higher when insane local function sanestate(inst) if inst.components.hunger then inst.components.hunger.hungerrate = TUNING.WILSON_HUNGER_RATE * 1 end if inst.components.combat then inst.components.combat.damagemultiplier = 1 end end --turn it normal when sane local master_postinit = function(inst) inst:ListenForEvent("goinsane", insanestate) inst:ListenForEvent("gosane", sanestate) --here we add two listerer to trigger the function end Link to comment https://forums.kleientertainment.com/forums/topic/149858-damage-increased-when-insane-as-well-as-higher-hunger-rate/#findComment-1656608 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