Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Wed 23/11/2005 16:17:25

Title: Actions Characters. One Question.
Post by: on Wed 23/11/2005 16:17:25
Greetings:

Sorry, my bad level of english.  :'(
As I can make actions followed with a character?
That is to say, I would like for example that a first character walk, and then he outside of the room.
As I could make it?

I have created a script when the player enters to the room. I would like that after walk, the player outside of the room.

My script is:

character[TONTETE].x = Random(120);
character[TONTETE].y = Random(98);
 
int ran=Random(2);
if  (ran==0)  character[TONTETE].Walk(160,84);     
else if (ran==1) character[TONTETE].Walk(220,120);
else character[TONTETE].Walk(30,40);


Thank you.  :)
Title: Re: Actions Characters. One Question.
Post by: DoorKnobHandle on Wed 23/11/2005 16:36:47
Hello and welcome to the forums,

I'd like to help, but I have serious trouble understanding what you want.

Are you talking about one or two characters? It seems you mean two of them, but in the script, only one character (TONTETE) appears! Also: What do you use the "random"-functions for?

Please try to describe your problem a little better if possible (or maybe draw some explaining images in paint and poste them here) and I'm very confident that someone is going to help you!

EDIT: After a second glance of your post, I think I am starting to understand... slowly. :)
Title: Re: Actions Characters. One Question.
Post by: on Wed 23/11/2005 16:57:00
Hello:

I have just gone up an image in the server. I hope understands it.

IMAGE:
http://www.speksnk.net/administradores/chapisnk/midea.gif

Thank you.
Title: Re: Actions Characters. One Question.
Post by: strazer on Wed 23/11/2005 17:50:52
You probably just want to make the character walking blocking, so it doesn't start walking but then change rooms immediately.
"Blocking" means the game waits for the action to finish before executing the next command in the script. You have to use the "eBlock" parameter of the Character.Walk function.

So, in conclusion, try this:


  // script for room: Player enters room (before fadein)

  cTontete.x = Random(120); // place TONTETE at random position
  cTontete.y = Random(98);

  // or, if you also want him to be put into this room EVERY TIME the player enters it:
  //  cTontete.ChangeRoom(player.Room, Random(120), Random(98)); // put TONTETE in this room at a random position



  // script for room: Player enters room (after fadein)
  // or put it in "Player enters room for the first time" if you want TONTETE to walk only the first time, then never to be seen again

  int ran = Random(2);
  if  (ran == 0)  cTontete.Walk(160, 84, eBlock);
  else if (ran == 1) cTontete.Walk(220, 120, eBlock);
  else cTontete.Walk(30, 40, eBlock);
  // with the eBlock parameter, the script waits for the character to reach his destination before executing the following command:

  cTontete.ChangeRoom(-1); // place character TONTETE outside of room