EuedeAdodooedoe Posted March 8, 2017 Share Posted March 8, 2017 Trying to set it up so that the damage that Bernie gets from shadow creatures is also applied to shadow creatures themselves. And, subsequently so that they would also teleport within a radius of Bernie upon attacking him, just like they do when a player attacks them. I've looked through many OnBlocked functions, from scalemail, to cactus picking to even single player's SW cactus armor damage, but NOTHING works! This is my final code that I've come down to: local function OnAttacked(inst, data) if data.attacker ~= nil and data.attacker.components.combat and data.attacker:HasTag("shadow") then data.attacker.components.combat:GetAttacked(inst, data.attacker.components.damage) --data.attacker.components.health:DoDelta(data.attacker.components.damage) data.attacker.components.combat:SetTarget(data.attacker) data.attacker.components.combat:ShareTarget(data.attacker, 30, ShareTargetFn, 1) end end And it doesn't work. Does anybody have any idea as to why and how I could fix it? Mind you, I'm still using that "make a copy of an original file into the mod and edit it" strat, so this code is placed within berniebrain.lua. Link to comment Share on other sites More sharing options...
EuedeAdodooedoe Posted March 8, 2017 Author Share Posted March 8, 2017 FIXED: 1) Had to put the code in bernie_active.lua and not berniebrain.lua 2) Had to add this listener in fn() function: inst:ListenForEvent("attacked", OnAttacked) 3) Had to add negative "data.damage" or " data.attacker.components.combat.defaultdamage " instead of data.attacker,components.damage Link to comment Share on other sites More sharing options...
Amalleus Posted March 9, 2017 Share Posted March 9, 2017 I like when people asking question and then answer on it themselves 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