Kwriss Posted September 25, 2021 Share Posted September 25, 2021 Hi, I'm doing a new character and I want to have the same kind of tag as walter "allergictobees" for spiders and want to become immune to bees. I don't figure how to make it. Can please someone help me with this. Thanks :) Link to comment https://forums.kleientertainment.com/forums/topic/133954-arachnophobic-and-beekeeper-character/ Share on other sites More sharing options...
Monti18 Posted September 26, 2021 Share Posted September 26, 2021 The bonusdamage from bees comes from this function: local function bonus_damage_via_allergy(inst, target, damage, weapon) return (target:HasTag("allergictobees") and TUNING.BEE_ALLERGY_EXTRADAMAGE) or 0 end inst.components.combat.bonusdamagefn = bonus_damage_via_allergy So you can do the same by doing this: AddPrefabPostInit("spider",function(inst) if not GLOBAL.TheWorld.ismastersim then return inst end local old_bonusdamage = inst.components.combat.bonusdamagefn or function() return 0 end inst.components.combat.bonusdamagefn = function(inst, target, damage, weapon,...) if target:HasTag("allergictospiders") then --or whatever tag you want to use return 10 --Replace with bonusdamage you want to have else return old_bonusdamage(inst, target, damage, weapon,...) end end end) This will make all normal spider make bonus damage against characters with this tag. If you want the others spiders also to do bonus damage, you will need to add a AddPrefabPostInit for each of them. You can do the same for the bees but make it return 0 if it has your tag that makes it immune. 1 Link to comment https://forums.kleientertainment.com/forums/topic/133954-arachnophobic-and-beekeeper-character/#findComment-1498375 Share on other sites More sharing options...
Kwriss Posted September 26, 2021 Author Share Posted September 26, 2021 (edited) Ok thank you so much for your quick response. But this code should be located in which file if I want it to be "server" and other can have these tags? (with other modded character) And if I want to to sanity damage in spider area instead of bonus damage? <3 Edited September 26, 2021 by Kwriss Link to comment https://forums.kleientertainment.com/forums/topic/133954-arachnophobic-and-beekeeper-character/#findComment-1498398 Share on other sites More sharing options...
Monti18 Posted September 26, 2021 Share Posted September 26, 2021 This needs to go in the modmain. Other characters just need to add this tag to their character and it will work the same for them. As for sanity I'm not sure if this works, but you could try this instead: AddPrefabPostInit("spider",function(inst) if not GLOBAL.TheWorld.ismastersim then return inst end local old_bonusdamage = inst.components.combat.bonusdamagefn or function() return 0 end inst.components.combat.bonusdamagefn = function(inst, target, damage, weapon,...) if target:HasTag("allergictospiders") then --or whatever tag you want to use if target.components.sanity then target.components.sanity:DoDelta(-10) --Replace with sanityloss you want to have end return 0 else return old_bonusdamage(inst, target, damage, weapon,...) end end end) 1 Link to comment https://forums.kleientertainment.com/forums/topic/133954-arachnophobic-and-beekeeper-character/#findComment-1498409 Share on other sites More sharing options...
Kwriss Posted September 26, 2021 Author Share Posted September 26, 2021 Thanks it works. Link to comment https://forums.kleientertainment.com/forums/topic/133954-arachnophobic-and-beekeeper-character/#findComment-1498506 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