Search the Community
Showing results for tags 'Equip'.
Found 3 results
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!