How do I make sure a player can't pick up two objects at the same time?

Consider the following:

  • have the interface return some form of Item ID so we can track what we have:

Here it’s a user widget soft class reference. It can be some other ID but since you want to track it with widgets and we already create them anyway, we could use that.

  • the collectible actors return their type:

  • the player has a Set variable where they track what they have (think of it as of a very rudimentary inventory / tracker):

A Set :point_up:, by definition, can only hold unique entries.

Note there no longer is any script in the pickup items - no need to duplicate script for every object class.


The above is a pseudoscript, I never run it but it should :crossed_fingers: work.

-famous last words

1 Like