I have 2 actors from same Character blueprint. First one is controlled by player. After second actor is shot i need to access his health value to change it
Im confused because they have same blueprint but they are different actors
Does anyone know how to access second actor’s health?
class =/= object, blueprint only class of a object, when object executes code from blueprint everything there happens there relates to that object, but if other object of same class do the same it happens in it’s own instance, that means accessing objects of same class from same blueprint is as same as accessing any other external object, you simply get object refrence of same class. How you do it it depends what you trying to do.
If you want ot apply damane, you make event that detects the shot and reduce health, or make projectile apply damage to object it hits, or if you using line tracing, line trace return object reference to object it hit and you can apply damage that way. All event return references to causer (usually named “Other”) or any other involved objects, use those to send function call to them or set health (but 1st option is more clean).