Jump to content

Recommended Posts

 have a event listener in your character file, with a function. then check what you just equipped, if its a hat/armor then change the character speed.

Example:

Function OnEquip(inst) -- the inst is our character
	local item = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD) --or local item = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.BODY)
	if item:HasTag("speedup") then --for this either make the hats you want have the tag either speedup or speeddown
    	inst.components.locomotor.walkspeed = 6
		inst.components.locomotor.runspeed = 8
    elseif item:HasTag("speeddown") then
    	inst.components.locomotor.walkspeed = 2
		inst.components.locomotor.runspeed = 4
    end
  --also you can make it so it lowers your character health or max health
end

local fn = function(inst) -- your character code
	inst:ListenForEvent("equip", OnEquip)
end

 

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