Well, if it is an actor variable, it shouldn't be changing both. What might be the problem is how you are displaying the variable. For instance if you had 50 cloned actors, that had the actor variable hp. This code would only change the first clone's hp variable.
- Code: Select all
clone.hp-=10;
So when you display a variable via a health bar or textNumber, you have to be more specific.
- Code: Select all
Actor * c2 = getclone("clone.2");
textNumber = c2->hp;
Now it is much easier if you use the especial actor types (creator, parent, collide). So if you have an hp bar for each soldier you create, put the create actor for the hp bar in the soldiers create actor. That way when you need the hp displayed, you can access the correct clone by using this.
- Code: Select all
textNumber = creator.hp;
Now if you want to lower a soldiers hp during a collision (assuming the event belongs to the other actor), you can do this.
- Code: Select all
collide.hp-=10;
So to sum that up, it is probably due to you not using actor specific references to the variable.