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
, 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 work.
-famous last words