Self wrote:Does anyone know how i can search through all actors (or all of specified actors) and find one with a particular variable? For example, i want for a keydown to find which actor has tha actor variable Sel ==1, and find another actor variable from that actor.
void CheckHeal(char *nam;)
{
int i;
char *ns;
char *nc;
for(i=0; i<(ActorCount(nam)); i++)
{
strcpy(nc, nam);
sprintf(ns, ".%d", i);
strcat(nc, ns);
if(getclone(nc)->heal)
{
getclone(nc)->HP+=4;
}
}
}
void Shoot(int xpo, int ypo)
{
char *col;
int ST = getclone(SNam)->ShotType;
strcpy(col, getactor(xpo, ypo)->clonename);
if(getclone(col)->Type==Unit && getclone(col)->Side!=Side)
{
strcpy(col, getactor(xpo, ypo)->clonename);
switch(getclone(col)->HitType)
{
case G:
if(getShot(1, ST))
{
CreateActor("GBang", "Ground_Bang", "no parent", "no path", xpo, ypo, true);
Move=0;
CollisionState(SNam, DISABLE);
ChangeParent(SNam, "no parent");
getclone(SNam)->Sel=0;
getclone(SNam)->r=150;
getclone(SNam)->g=150;
getclone(SNam)->b=150;
EventDisable("Event Actor", EVENTKEYDOWN);
}
break;
case A:
if(getShot(2, ST))
{
CreateActor("ABang", "Air_Bang", "no parent", "no path", xpo, ypo, true);
Move=0;
CollisionState(SNam, DISABLE);
ChangeParent(SNam, "no parent");
getclone(SNam)->Sel=0;
getclone(SNam)->r=150;
getclone(SNam)->g=150;
getclone(SNam)->b=150;
EventDisable("Event Actor", EVENTKEYDOWN);
}
break;
case S:
if(getShot(3, ST))
{
CreateActor("SBang", "Sea_Bang", "no parent", "no path", xpo, ypo, false);
Move=0;
CollisionState(SNam, DISABLE);
ChangeParent(SNam, "no parent");
getclone(SNam)->Sel=0;
getclone(SNam)->r=150;
getclone(SNam)->g=150;
getclone(SNam)->b=150;
}
break;
case U:
if(getShot(4, ST))
{
CreateActor("UBang", "Sub_Bang", "no parent", "no path", xpo, ypo, false);
Move=0;
CollisionState(SNam, DISABLE);
ChangeParent(SNam, "no parent");
getclone(SNam)->Sel=0;
getclone(SNam)->r=150;
getclone(SNam)->g=150;
getclone(SNam)->b=150;
EventDisable("Event Actor", EVENTKEYDOWN);
}
}
}
}
Users browsing this forum: No registered users and 1 guest