Jump to content

Recommended Posts

My current character I've been developing is supposed to be very frightened of spirits and shadow creatures, so I figured they should also take more damage from them. I looked into Walter's code for being allergic to bee's, but the only thing in his script is a tag in postinit that sets him as allergictobees.

It seems the damage increase, from what I can tell, is done in the bee's script, condensed here:

local function bonus_damage_via_allergy(inst, target, damage, weapon)
    return (target:HasTag("allergictobees") and TUNING.BEE_ALLERGY_EXTRADAMAGE) or 0
end

If I wanted to make this work for shadow creatures, is there a way to properly append functions onto the vanilla game, like a version of this one made for shadow creatures (example here), or do I have to do a workaround, like replacing the shadow creatures script with my own completely?

Edited by DocterRedstone
forgot to link to example

You'll need to add some code to the shadow creatures, for example:

AddPrefabPostInit("crawlinghorror", function(inst) -- AddPrefabPostInit for the shadow creature
	local function bonus_damage_via_fear(inst, target, damage, weapon) -- Bonus damage function
		return (target:HasTag("shadowfear") and TUNING.BEE_ALLERGY_EXTRADAMAGE) or 0 -- You can set the tag to whatever you want. TUNING.BEE_ALLERGY_EXTRADAMAGE is 10 but you can set it to whatever you want.
	end

	inst.components.combat.bonusdamagefn = bonus_damage_via_fear -- Setting the function for bonus damage
end)

You need to add this to all of the shadow creatures.

Then just add the tag to your character:

inst:AddTag("shadowfear")

 

  • Like 1

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
×
  • Create New...