When character overlaps triggerbox, I want to give character 30 gems only once. Using do once didn’t work and gave character 30games everytime it overlapped triggerbox. Help plz! (ps. I can’t destroy the triggerbox)
You can use a bool in the character ‘has gems’. It only gets set once…
If this is further extending on your reward system for doing certain things, I would suggest moving towards some container that holds all the already collected rewards. (GameplayTag Container was suggest). This way you can add new rewards later on, without having to add new branches, new bools, and new checks for wether or not they already got it.
I’m sorry gameplaytag container thing is just too much for me right now. Is there just a way that uses boolean or a check? I won’t mind doing it again everytime.
There are for sure alternatives…
But the container is just a variable type, and doesn’t have to do anything else than what the code I’ve shown you do (and keeps it easily expandable)
All the magic of it is happening when we simply add a GameplayTag to the GameplayTag Container
And during adding of the entries …
If you’re new to gameplay tags they’re pretty great for many things, and I would recommend learning a bit about them
They provide you with hierarchal names that comes as a list
Link about tags
When character overlaps triggerbox, I want to give character 30 gems only once. Using do once didn’t work and gave character 30games everytime it overlapped triggerbox. Help plz! (ps. I can’t destroy the triggerbox)
This can only happen once. If you want to collect gems again, turn the collision back on.
This can only happen once.
Unless you reset / restart level or quit game. If you want to save this data, then you still need a save game, of course. Then a tag container is a blessing for something like this.