Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Candle on Sat 29/01/2005 20:51:50

Title: Random room stuff
Post by: Candle on Sat 29/01/2005 20:51:50
I have a room were  with a MoveCharacter(EGO,155,122);
but I just want it to happen now and then .
So how could I make it random  MoveCharacter(EGO,155,122);
or let the user move the Character ?
Make scenes ?
Title: Re: Random room stuff
Post by: Goot on Sat 29/01/2005 22:59:22
I'm not sure if I exactly understand. It sounds like every once and a while you want to move the character to 155,122. To do that you would use Timers (SetTimer and IsTimerExpired) and the Random(); function (look those up in the manual if this is what you want to do.) I don't get what you mean by let the user move the character. Can't the user already move the character with the walk cursor? Or is it not the player character (in this case you can use the mouse.x and mouse.y variables to move the character to the mouse position).
Sorry if I didn't understand the question.
Title: Re: Random room stuff
Post by: Candle on Sat 29/01/2005 23:06:52
Kind hard to say . ok I have a room that when you go in to it , it has a  MoveCharacter and when it is done you are back out of the room . right now you have no control of the Character they way I have it setup .
What I want is for it to be random  so not everytime you go in to the room it does the MoveCharacter . see what I mean  now .
Title: Re: Random room stuff
Post by: Goot on Sat 29/01/2005 23:10:41
Oh, ok.

at top of room script:
int rand;

in player enters room after fadein:
rand=Random(1);
if(rand==0){
script for moving the character
}

Random(1); picks a number, either 0 or 1 and if it's 0, the character moves, and you go to the next room. (put the script for that where it says "script for moving the character." otherwise, it does nothing and the player has control.
Title: Re: Random room stuff
Post by: Candle on Sat 29/01/2005 23:14:32
You lost me here with the script for moving the character where is that?

thats ok I'm just going to use an object in the inventory,  so if the  character the inventory item it will just be   the reg room, and if they don't have the inventory item then it will go to the MoveCharacter bit .