How can I Change a Character (non player) to another room.
I have been looking in te AGS help but i didnt find the function.
thanks.
There's no built-in function to move a non-player character (NPC) to a new room.
However, using script, you could do:
StopMoving(NPC); // you have to stop characters before manipulating x and y coordinates
character[NPC].room = 7; // number of room you want to put him in
character[NPC].x = 160; // x-coordinate of character in new room
character[NPC].y = 120; // y-coordinate of character in new room
You can also write a custom function if you need to use this often:
Global script (outside of any other functions)
function NewRoomExSpecial(int charid, int room_number, int x, int y) {
if (charid == GetPlayerCharacter()) // specified character is the current player character
NewRoomEx(room_number, x, y); // use the normal NewRoomEx function
else { // for non-player characters
StopMoving(charid);
character[charid].room = room_number;
character[charid].x = x;
character[charid].y = y;
}
}
Script header
import function NewRoomExSpecial(int charid, int room_number, int x, int y);
Then, in the Interaction editor -> Run script, for the first example, you would only have to write
NewRoomExSpecial(NPC, 7, 160, 120);
Hope this helps.
Or if you dont need to script, you can use the interaction in the interaction editor.
I'm not even going to try pretend I understand that...