waitthread
Posted: Fri Sep 02, 2005 3:50 am
For a script of mine i need to know when a certain few AI have finished their little duties from a list of cute AI tricks i'm maknig them do, i made a thread that has a while loop checking to see if they've all had their .done fields set to 1, if so it moves on and finishes. since i'm calling it as a waitthread, it should hold at that thread until the htread terminates before moving, right?
for some reason it isn't doing that. it overflows my script, after putting in some debug lines i found it was indeed an infinite loop...
the relevant part of the waitthread
i'm stumped. by all appearances that thread shouldn't end til all their .done's are set (which i've checked and rechecked, that isnt set until they're finished).
is there a different way of calling a thread i need to do instead of waitthread?
the reason i'm not posting more code is because it's such an interconnected script it'd be difficult for you to follow anyway.
for some reason it isn't doing that. it overflows my script, after putting in some debug lines i found it was indeed an infinite loop...
the relevant part of the waitthread
Code: Select all
waitToSquadDone local.squadNum:
//^
// code i knows works, that gets the local.GSquad array.
while(local.GSquad[1].done == 0 && local.GSquad[2].done == 0 && local.GSquad[3].done == 0 && local.GSquad[4].done == 0 && local.GSquad[5].done == 0 && local.GSquad[6].done == 0)
{
wait 1
}
for(local.z = 7; local.z > 1; local.z--)
{
if(local.GSquad[local.z].targetname != NOT)
{
local.GSquad[local.z].done = 0 // reset their .done
}
}
println "Squad " local.squadNum " has finished it's task."
endis there a different way of calling a thread i need to do instead of waitthread?
the reason i'm not posting more code is because it's such an interconnected script it'd be difficult for you to follow anyway.