Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: nOOwy on Tue 30/09/2003 11:27:14

Title: Strange order
Post by: nOOwy on Tue 30/09/2003 11:27:14
Hi

I need some help.
This is my script:

// script for hotspot3: Interact hotspot
DisplayMessage(20);
MoveCharacter(EGO,100,95);
MoveCharacterDirect(EGO,100,80);  
DisplaySpeech(EGO,"Come on,hurry up!");

Can anyone tell me why my character say "Come on,hurry up!" before moving !!??
It should fisrt move and then say his speech. I don't understand.

nOOwy

P.S. Sorry for my yesterday post with this stupid questions. And thanks a lot for replies.
Title: Re:Strange order
Post by: Ishmael on Tue 30/09/2003 11:34:06
You must use MoveCharacterBlocking for moving the character. It is like MoveCharacter, but blocks the game form running the following commands before it is finished. The last parameter of MoveCharacterBlocking set's if it works as MoveCharacter or MoveCharacterDirect. Study the manual... Now where did I put my pillow.......
Title: Re:Strange order
Post by: nOOwy on Tue 30/09/2003 15:53:15
Thanks!
But now I faced another problem:

After displayingspeech I want to move my character and NPC to another room at specific coordinates.
I've used NEWROOMEX(x,x,x) to move my character but how can I move NPC to another location at specific coordinates?
I can't find any command that would do it :-(
Title: Re:Strange order
Post by: Ginny on Tue 30/09/2003 16:53:09
Hmm, you could try editing the characters character[CHARID].x and character[CHARID].y global variables (only when the character isn't moving.) I think you can only set them in the room the NPC will be in. You could try this:

1. Create a global variable and set it as 0.
2. When you want to move the NPC to the other room, Use character[NPCID].room and then set the global variable to 1. Then in the room where the NPC appears, on "Player enters screen (before fade-in)" put an if statement to check if the global variable is 1, and if it is, set the NPC's coordinates appropriately.

I hope this helps :).

Of course, maybe I'm wrong and there's an easier way to do this ;)
Title: Re:Strange order
Post by: SSH on Tue 30/09/2003 17:02:51
The x and y and room are independent, so you can change the x and y before changing room of an NPC, or the other way around. The NPC will be visible only if they are in the current room. You can also have the NPC in no room by setting their room to -1.

For example,  look at my game "The Dark Cave". When you use the mobile phone, a split screen is used to show the other end of the conversation. This is donme by changing the room background and moving one character to -1 and two characters from -1 to the current room. The whole process is reversed when the phone conversation completes.

Title: Re:Strange order
Post by: Ginny on Tue 30/09/2003 17:26:33
There, I knew someone knew of a simpler solution ;) Thanks SSH.
Title: Re:Strange order
Post by: nOOwy on Tue 30/09/2003 21:38:51
Thanks a lot!
Title: Re:Strange order
Post by: nOOwy on Tue 30/09/2003 22:10:00
ey wait a moment, that's not as easy as I thought.

My character(0) and his frend NPC(1) are talking in room1 and are visible.
After end of conversation I want ot move them in romm2 at specific coordinates.

Can you please write what commands I should use in my script.

Should I hide NPC and how I can hide him?
What to do to change coordinates of NPC? Move him? Or some more complex command?

nOOwy

Title: Re:Strange order
Post by: Ishmael on Wed 01/10/2003 08:01:05
You'll need dialog_request, unless you use room rep_ex and a Globalint. This is the dlreq way as I see it:

in Global Scrpt:

fuction dialog_request (int val) {
 if (val == 1) {
   character[NPC].room = r#;
   character[NPC].x = x#;
   character[NPC].y = y#;
   NewRoomEx(r#,x#,y#);
 }
}

where you replace r# with the correct room number, which in this case is 2, and the x# and y# with the appropriate cordinates.

To call this in the end of the conversation, just use

run-script 1

in the dialog script.
Title: Re:Strange order
Post by: nOOwy on Thu 02/10/2003 08:09:43
Thanks.