Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Rd27 on Fri 22/10/2004 23:23:05

Title: Scripting help
Post by: Rd27 on Fri 22/10/2004 23:23:05
I have this script:

// script for object5: Interact object
if (GetGlobalInt(5)==1){
MoveObject(5,180,170,10);
}
else
MoveCharacterBlocking(EGO,132,181,1);
MoveObject(5,160,190,10);
SetGlobalInt(5,1);

I want to continue this so, that when player next time interacts the object, the player character will say, nah, it's not worth it.. But how can I do that?
How many times can I continue, so that the object moves different place always when it is interacted?

What I have done so far, has this little annoying problem:

When the object has moved second time and player interacts it after that, the object moves back to where it moved first time. And if it is interacted again, it moves back where it was and this can be done million times ;). How can I prevent that?

Thanks for help and hope that you understanded my question.
Title: Re: Scripting help
Post by: Goot on Fri 22/10/2004 23:43:44
if(GetGlobalInt(5)==0){
script for first time
SetGlobalInt(5,1);
}
else if(GetGlobalInt(5)==1){
script for second time
SetGlobalInt(5,2);
}
else{
Display ("Nah, it's not worth it.");
}
Title: Re: Scripting help
Post by: Rd27 on Tue 26/10/2004 14:29:49
Thanks, it worked perfectly!