if statement problem
Posted: Wed Dec 22, 2010 10:51 pm
how can i check a variable of a clone if i need to have the clone being checked 8 more in the clone index than the clone that is checking it?
AliceXIII wrote:well it's kinda hard to understand your first post?
157pl wrote:how can i check a variable of a clone if i need to have the clone being checked 8 more in the clone index than the clone that is checking it?
157pl wrote:how can i check a variable of a clone if i need to have the clone being checked 8 more in the clone index than the clone that is checking it?
Actor *check;
char str[32];
sprintf(str,"Player.%i",18);
check=getclone(str);
if(check->var1==1 && cloneindex==10) //if current player cloneindex is 10 and check (player.18) var1 is 1
{
//do something here
}
157pl wrote:would that code work on all of them because it keeps making them
Actor *check;
char str[32];
sprintf(str,"Player.%i",cloneindex+8);
check=getclone(str);
if(check->var1==1)
{
//do something here
}
Fuzzy wrote:I think you are inviting a nasty bug in. What happens if there is no player.18? Crash.
Fuzzy wrote:Ah, I guess I am getting too used to python. It would return the object, and you can test those against a boolean. I expected that C would return null instead of none.