Jump to content

Recommended Posts

Hello, I need help :)!

I don't know how to use prefabpostinit... So... maybe can someone guide me how to make a character with tag "amazon" make spears do 25 extra damage? Like the spear and wathgrithr_spear I want my character to do like 25 extra damage with those weapons only. So, I can't give damagemult because that effects all attacks...

So, can someone please guide me :D? I would really appreciate it a lot :D!

Thank you so much for reading my problem! Have a wonderful day/night :D:D:D!!!

Edited by SuperDavid

As a postinit:

local function SpearOnEquip(inst, data)
	if data and data.owner and data.owner:HasTag("amazon") then
		inst.was_on_amazon = true
		inst.components.weapon.damage = inst.components.weapon.damage + 25
	end
end

local function SpearOnUnequip(inst, data)
	if inst.was_on_amazon then
		inst.was_on_amazon = nil
		inst.components.weapon.damage = inst.components.weapon.damage - 25
	end
end

local function AmazonSpearExperience(inst)
	if inst.components.equippable and inst.components.weapon then
		inst:ListenForEvent("equipped", SpearOnEquip)
		inst:ListenForEvent("unequipped", SpearOnUnequip)
	end
end

AddPrefabPostInit("spear", AmazonSpearExperience)
AddPrefabPostInit("wathgrithr_spear", AmazonSpearExperience)

 

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