I currently have a UI system which shows the health of a monster by checking their name , it’s working fine for most of the part but one issue that I found was that if I have two or more monsters of the same name then their healths are shown the same despite both having different healths. All i want it a way to uniquely identify a creature and show their health in my UI system.
Could object variables work here to identify the creature instead of their name ? Or do I have to use something else to identify each instance unqieuly since the objects keep getting deleted and created a lot in the events.
Or is there a way to change the name of those duplicate instances of the new objects.
I would recommend using object variables or the health behavior. Instead of checking the object name, it’s best to use a for each object or some other condition or even linking to pick the object and get the value directly from it instead of an unrelated variable.
Can you post a pic of your UI so we can better understand your setup.
Do the object variables get reset when I delete the objects ? For example if i set the object variable of an object to let’s say 1 and then delete it and the create it again later , would the variable still remain 1 or would it be changed to 1 ?
This is what the UI looks like , the tiny creatures in black boxes and their health shown above , all 6 slots of the party get shown when I have 6 monsters
How do I add a unique value to each creature then ??? If i pre set the values then it would just be the same as names and not solve the duplicate issue and if I try to set the values after creation then it wouldn’t be saved for when I later create them again
It depends on how the objects are used. What type of project is it? What do you do with the objects?
If you’re switching between characters then maybe the other characters could be just disabled and/or hidden.
You could also use your method with an array of structures. Say slot 0 thru 4. The structures could contain the object name, its health, slot ID and anything else. You could then copy the data back and forth as the object is added and deleted. Or maybe use storage.
The compare text and number conditions don’t pick the objects. So, it’s easier to use an object variable or even linking. You could link the objects to their slot.