#Best way to add health to replicated objects
1 messages · Page 1 of 1 (latest)
U can have a health variable within each replicated object (when u need to set the value of an object’s variable, send an event containing the specified object, and when the event is received, check if Self is equal to the specified object. If it is, set the value of the variable. If you need to get the value of an object’s variable, send an event containing the specified object, and when the event is received, check if Self is equal to the specified object. If it is, send another event containing the value of the variable, and if you want, u can include the specified object too). I wouldn’t suggest this, as it means that extra chips are spawned with each replicated object spawned.
I would suggest using lists. You can send an event to everyone before a replicated object is returned, and include the replicated object in the event. When the other players receive the event, have them remove the object from the object list and remove the corresponding value from the health list. When a player changes the health of an object, have them send an event containing the specified object and the amount they changed the health by.
Each seperate object can have a different variable value?
Yes it spawns new chips with each replicated object.
Nooo like your saying to put a health variable but i thought the variable value would be the same for all of them
Is that how it works?
It can have a different value if it’s replicated?
I would assume so
If not then it’s prolly a bug
Another reason to use lists
It can if you put it inside of the object or inside of a circuit board
It saved it as its own value and you can see the events in the event receiver tab it will say something like "health 1 changed"