Jump to content

Recommended Posts

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.

  • Like 1

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 by Kwriss

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)

 

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