Moving an NPC to a specific co-ordinate in a room

Started by Takkar Tekekak, Thu 21/10/2004 16:24:46

Previous topic - Next topic

Takkar Tekekak

i'm making my first AGS game and i'm kinda stuck at this situation:

After you pick up a piece of paper, room6 can be entered, you gain 30 points,Ã,  gloabal variable 2 now =5 and "EGO" moves to room 6 c0 ordinates 132, 46.

Thats not exactly right but its the generall situation, I can command it so that my character enters room 6, but he appear in the center of the room, no matter what i can't move him either, and using the "move character to co-ordiantes" says "error- character is not in room" (i tried putting thease in either order to no affect)

so the 2 commands
Character - move NPC to different room, and
Character - move to specific co-ordinates.

don't seem to work, is there anothe obvious command i'm missing here? (the character i'm trying to move isn't my player character either.)
I may not be sane, but at least i'm not a penguin!

Barbarian

#1
Not sure I follow what you're trying to ask, but to move an NPC character to a different room and at specific co-ordinates, from within a "Script" you might add the commnds that look like:

character[NPC_NAME_HERE].room = 3;
character[NPC_NAME_HERE].x=(157);
character[NPC_NAME_HERE].y=(34);Ã,  Ã, 


Would place the character "NPC_NAME_HERE" (use whatever script name you've given that character of course), in room 3 at x posistion of 157 and y posistion of 34.Ã,  Ã, This is just an example.

If moving your player character, be sure the location in the room is on a Walkable area. And you can use the command editor and select "Player - Go to a room (at specific co-ordinates)", or alternatively you could use it with scripting commands, here's a cut and paste from the AGS Help Manual:

"NewRoomEx (int room_number, int x, int y)

Identical to NewRoom, except that the player character is placed at co-ordinates (X,Y) in the new room.
Example:

NewRoomEx(4,100,50);

will move the player character to room 4 and also place him at coordinates 100,50."
Conan: "To crush your enemies, see them driven before you, and to hear the lamentation of the women!"
Mongol General: "That is good."

Blade of Rage: www.BladeOfRage.com

Takkar Tekekak

I may not be sane, but at least i'm not a penguin!

strazer

#3
And AGS v2.62 will have the NewRoomNPC command, similar to NewRoomEx. It's already available in the beta version.

Takkar Tekekak

I'm downloading the file now.

Thanks guys!
I may not be sane, but at least i'm not a penguin!

BorisZ

Quote from: strazer on Thu 21/10/2004 18:07:28
And AGS v2.62 will have the NewRoomNPC command, similar to NewRoomEx. It's already available in the beta version.

What additional features does this command have? New room coordinates?

strazer

NewRoomNPC(CHARID, int room_number, int x, int y)

Moves a non-player character to a different room. Character CHARID is moved into ROOM_NUMBER at co-ordinates (X, Y).
To move the player character to another room, use NewRoom or NewRoomEx.

Example:

NewRoomNPC(BOB, 4, 100, 50);

will move the character BOB to room 4 and place him at coordinates 100,50.

CarriePinza

I'm trying to do the same thing but with the interactions editor, by doing Character move NPC to a different room and then Character: move character. I get the same error happening as mentioned above, with a message saying that the character is not in the room and the game crashes. How can you put an NPC at a specific place without using script?

Ashen

Can you post the EXACT interactions you're using, and the EXACT error message you get? This threads is nearly 2 years old, and refers to AGS several versions ago.
Are you tring to more the NPC to a new rooms and new coords? If so, it might be quicker and easier to use scripting - the Character.ChangeRoom f function allows you to do this (replaces the functions strazer mentioned).
I know what you're thinking ... Don't think that.

Khris

Carrie: As soon as you've moved the NPC to another room, you can't change its coordinates any longer, because the NPC isn't in the current room. That's why you get this error message.
Please learn how to script, it really pays off and you don't have to struggle with basic things like this anymore.

Candle

CharacterControl script module for AGS v2.71.

Features:

* NPCs can walk around in other rooms, talk, animate etc. _in the background_
* Compatible with CCS plugin command strings
(That may change at any time so you're encouraged to use this module's commands.)

Advantages to the CCS plugin:

+ Cross-platform compatibility
+ Additional and extended, more flexible control commands
+ No need for a dedicated blank view
+ Extensible & customizable
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=24489.0

SMF spam blocked by CleanTalk