Try this demo out, click the button, will set 3 clones health to 100, leaving the other two at 0.
It uses the activation event tied to the three actors. The text actors are this code.
- Code: Select all
textNumber=getclone("Seargent.0")->health;
and the other text actors respectively, only with incremented clonenames.
i.e.: Seargent.1, Seargent.2, etc.
The last clone gets its health directly from clones Seargent.1 and Seargent.2 with the following code in the draw actor event of Seargent.
- Code: Select all
getclone("Seargent.4")->health=getclone("Seargent.1")->health + getclone("Seargent.2")->health;
You could use this method to give an overall health variable to a unit of 5 clones, and use a code like this to distribute it evenly across the unit members.
- Code: Select all
getclone("UnitMember.1")->health=UnitHealth/5;
getclone("UnitMember.2")->health=UnitHealth/5;
...
Using the getclone2 code would really come in handy here I think, it is posted here somewhere, just do a search for it. It lets you specify the clonename and cloneindex, so you could setup a For Loop and shorten the code here.
Link to getclone2 post:
http://game-editor.com/forum/viewtopic. ... =getclone2