I'm not completely sure if this is what you wanted, but this can set all clones hp to a given value. You could adapt if further for any variable. I don't know anything about getclone2 but I think it can do a similar thing, maybe even better.
This would go in global code. It uses feral's cloneID function and a setor function to set all actor*s hp to a given value.
- Code: Select all
#define MAX 100
char buffer[50];
char *cloneID(const char *cname, int cindex)
{
sprintf(buffer,"%s.%d",cname,cindex);
return(buffer);
}
void
unit_stat_hp_set (Actor * self, const char* actor, int hp_value)
{
int i;
for (i=0; i<MAX; i++)
{
self=getclone(cloneID(actor,i));
self->HP = hp_value;
}
}
When calling it, you would use,
- Code: Select all
unit_stat_hp_set(a, name, hp); // hp being your desired HP
For the a->HP, is HP an actor variable, because it must be if you are to use it that way.