#item OnEquip() and OnUnequip() don't work

1 messages · Page 1 of 1 (latest)

main lantern
#

title
neither function does anything from what I can see
I need to know when a player picks up/drops a specific item, and I would very much like the code to be within the item itself, but I can't find any functions pertaining to it that actually do anything

#

what I mean by it "not doing anything" is I cannot get any of the functions to be called, no matter what I do with my inventory
I also tried OnInventoryContentsChanged() to no avail

#

has this stuff been deprecated?

void gate
#

i know they worked in the past, no idea about currently.
i see specifically a OnItemEquipped(item) function for lua items/abilities in the api but no unequip equivalent.

main lantern
#

doesn't work

#

tried it before

#

I'm simulating it using the intrinsic modifiers creation / destroy function atm, but it feels super jank
it works
but I don't like it

void gate
#

that sounds fine tbh.

feral dawnBOT
livid onyx
#

Hm, so you're saying it doesn't work for abilities as well?

#

Because I remember doing that for controlling scepter behavior on custom abilities

main lantern
#

can't say for abilities, I'm specifically using it on an item

#

but as far as I can tell, none of the functions are called

livid onyx
#

Is the item custom? (Sounds obvious but I got to ask)

Can you show relevant code for your tests?

pulsar wind
#

OnInventoryContentsChanged() is ability only

#

useful for scepter abilities like Shush mentioned

livid onyx
#

So in other words it's just a broken event lol

void gate
#

just poorly named functions

#

despite being called OnUnequip, what the function does is Unequip

livid onyx
#

Ohhhhhhhh

#

That's so.. Valve

main lantern
#

classic valve