Search the Community
Showing results for tags 'equip'.
-
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:
-
Hello, I want to know how to compare the item name of an equiped item with a string in the code. Here my try: local oldEquip = inst.components.inventory.Equip inst.components.inventory.Equip = function(self, item, old_to_active) if item == "armorgrass" then print("armorgrass equipped ") end oldEquip(self, item, old_to_active) end I searched in logs für "armorgrass equipped" but I couldn't find so it doesn't work I guess... Maybe you could help me
-
I've added a hairfront_hat symbol to my character's build because their hairfront clips through hats normally. What I want to do now is override the OnEquip function in hats.lua. There's a problem though; it's a local function that's created inside of another local function (MakeHat(string)) so I don't think I can access it directly. The hats.lua file doesn't return an actual hats prefab; rather, it returns a whole bunch of hats made by MakeHat(string). I think this prevents me from adding a postinit to it because a hats prefab technically never gets made. Because of this, trying to modify components.equippable.onequipfn for hats didn't work. But I DID get it to work by modifing the onequipfn for the "tophat" prefab specifically. So here's what I want to know: is there a convenient way to do add a postinit for every prefab that MakeHat() can return, without overwriting the file? Or will I have to go through the list of return values in hats.lua and manually add the post init to every single one?
-
Hey! So this one is simple, and I'm not sure where to start as I've never told the game to change sanity levels immediately before other than eating foods. It may be more complicated than I ask, but I want a certain weapon to, onequip, set the player's Sanity level to a permanent, unfixable 0. The only way to raise the sanity back to the value it was before would be to unequip it, thus being under onunequip. Is there a way to tell the onequip code to save the sanity value under something like "player_sanity_old" and set their sanity to 0, then when the player unequips it, tell it to load "player_sanity_old" and change it back to that? I assume it's not super easy but I want the weapon to do more than induce sanity, be it that it's a weapon of sadism. For those curious, it's the Also keep in mind that I only want the person equipping it to feel these effects, and if easily added, I want a large sanity drain around the character holding it. Alright, forums, let's see what ya got!
-
This might be long depending the answer, but I was wondering if was possible to make it so that when nothing is equipped in the hands slot, you can fire a projectile similar to the fire staffs?
-
I have an issue with equippable items (weapons and tools). Case 1: Axe AddPrefabPostInit("axe",function(inst) inst:AddComponent("fuel") inst.components.fuel.fuelvalue = TUNING.SMALL_FUELendIt works fine on host. But client can't use it as fuel. Client starts action, trying, trying, trying and then axe fall back in inventory. Case 2: Ham Bat AddPrefabPostInit("hambat",function(inst) inst:AddComponent("edible") inst.components.edible.hungervalue = 12end)Same thing. Host can easily eat it (put on character). But client is trying for 2 seconds and then stops. There are following steps: 1) Client takes item into cursor of the mouse. 2) Then put it on target. On himself or on firepit. 3) Then item auto equips. 4) Then character is keeping his hand in fire pit (or in mouth while eating) for 2-3 seconds. 5) Then nothing happens. Action fails and item is returned into inventory. Probably it's action mechanics issue. Someone knows how to fix this?
- 5 replies
-
- equip
- equippable
-
(and 1 more)
Tagged with: