You gave me a small idea, and it seems to be working, but i do have some problems with it! I declared 2 new varaibles:
int pPicked[9] and pickAgain = true;
When the player chooses a square, pPicked[square_chosen] == 1;
Now, when the computer plays, it chooses a random number between 1 and 9. Then checks if pPicked[chosen_number] != 1. If it is equal, then pickAgain = true, and it chooses it again, if not, then it positiones the object ePicked+20 to ePicked.X,0,ePicked.Z but i do seem to have a problem with that! Here's the new source:
picked = dbPickObject(dbMouseX(),dbMouseY(),1,9);
if(dbMouseClick())
{
for(int iPicked = 1; iPicked <= 9; iPicked++)
{
if(enemyturn == false && isX == true)
{
if(picked == iPicked){
pPicked[picked] = 1;
dbPositionObject(picked+9,dbObjectPositionX(picked),dbObjectPositionY(picked),dbObjectPositionZ(picked));
//dbPositionObject(30,dbObjectPositionX(picked),dbObjectPositionY(picked),dbObjectPositionZ(picked));
isX = false;
pickAgain = true;
}
}
if(enemyturn == true && isX == false)
{
//if(picked == iPicked){dbPositionObject(picked+19,dbObjectPositionX(picked),dbObjectPositionY(picked),dbObjectPositionZ(picked));
//dbPositionObject(30,dbObjectPositionX(picked),dbObjectPositionY(picked),dbObjectPositionZ(picked));
//dbPositionObject(Randomize(20,29),dbObjectPositionX(Randomize(1,9)),0,dbObjectPositionZ(Randomize(1,9)));
/*int ePicked;
int pPicked;*/
if(pickAgain == true)
{
ePicked = Randomize(1,9);
pickAgain = !pickAgain;
}
if(pPicked[ePicked] == 1)
{
pickAgain = true;
}
if(pPicked[ePicked] != 1 && sPicked[ePicked] != 1)
{
sPicked[ePicked] = 1;
dbPositionObject(ePicked+20,dbObjectPositionX(ePicked),0,dbObjectPositionZ(ePicked));
}
isX = true;
enemyturn = !enemyturn;
}
}
}
The problem is, that sometimes it doesn't check again (at least i think it doesn't), since it doesn't always position the object where it has to.