CathMario Posted November 6, 2021 Share Posted November 6, 2021 How do I make a character be slower when wearing armor/hats? Link to comment https://forums.kleientertainment.com/forums/topic/135108-how-do-i-make-a-characters-speed-change-depending-on-their-equipment/ Share on other sites More sharing options...
Silky-Inc Posted November 6, 2021 Share Posted November 6, 2021 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 Link to comment https://forums.kleientertainment.com/forums/topic/135108-how-do-i-make-a-characters-speed-change-depending-on-their-equipment/#findComment-1511215 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