sjtdhiqbwczfzpu Posted May 14, 2023 Share Posted May 14, 2023 (edited) Hi there. I would like the character to slow down when wearing armor. I added "inst.components.equippable.walkspeedmult" to all armor, but if both body and head are equipped, the effect stacks. In general, this suits me, but I would like to have an alternative option, so that the characters slows down by a fixed amount if they are protected by any slot (head, body, hand). I tried to come up with this, but I failed: Edited September 8, 2023 by sjtdhiqbwczfzpu Link to comment https://forums.kleientertainment.com/forums/topic/147791-slow-if-armored/ Share on other sites More sharing options...
Glommer2 Posted June 27, 2023 Share Posted June 27, 2023 i've considered similiar function,maybe you can refer to this local function noheavything(inst) local itembody = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.BODY) local itemhead = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD) if (itembody ~= nil and itembody.components.armor ~= nil ) or(itemhead ~= nil and itemhead.components.armor ~= nil ) then inst.components.locomotor:SetExternalSpeedMultiplier(inst, "character_speed_mod", 0.5) if inst.components.talker then inst.components.talker:Say("armor doesn't fit me) end else inst.components.locomotor:SetExternalSpeedMultiplier(inst, "character_speed_mod", 1) end end master_postinit = function(inst) inst:ListenForEvent("equip", noheavything) inst:ListenForEvent("unequip", noheavything) end Link to comment https://forums.kleientertainment.com/forums/topic/147791-slow-if-armored/#findComment-1643926 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