Make character turn around and move characters to other rooms

Started by Mats Berglinn, Mon 12/05/2003 15:36:47

Previous topic - Next topic

Mats Berglinn

I wonder, how do you make characters face other directions when he is NOT talking to a person, like if you want a character to turn away from the screen or make it turn right or left. Also how do you move characters that is not Playable characters to move to other rooms?

Thanks in advice.

Jimi

QuoteFaceLocation
FaceLocation (CHARID, int x, int y)

Similar to the FaceCharacter function, except that this faces the character to screen location (X,Y). This allows him to face not only other characters, but also objects and hotspots as well (you can get co-ordinates by watching the co-ordinates displayed in the Room Settings mode as you move the mouse over the room background).
Example:

FaceLocation(EGO,150,146);

will make the character face at the room location (150,146)
See Also: FaceCharacter


Ishmael

To move a NPC ot another room, I see no other way than use:

character[CHARID].room = WantedRoom,

where you put the char script name or number instead of CHARID, and the room number instead of WantedRoom...
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Mats Berglinn


Mats Berglinn

I have another question. How do I place characters that are not playable at specific coordinations when they get to new rooms (I believe that it should be written the script for when player character comes into the room before fadein)? Please give me an answer as quickly as possible because it's just this left before my very first game are really finished. Then I can release it.

GWNox

character[CHARID].x
character[CHARID].y

Don't use these if the character is moving, by the way.

Mats Berglinn

Uh... got any examples of who write that down in the script? Where should I place the number for the X and Y position?

scotch

If you want a character called GWB to be placed at coordinates 204,56 then you put:

character[GBW].x = 204;
character[GBW].y = 56;

in the script.

TerranRich

Status: Trying to come up with some ideas...

Gilbert

But note that NewRoomEx() can only be used for the player character, you must tackle with the variables if you want to move an NPC.

Scorpiorus

Having a special function to place the character may help to organize the code:


//Global script:
ChangeRoom(int CharId, int NewRoom, int X, int Y) {
 if (CharId == GetPlayerCharacter()) {
    NewRoomEx(NewRoom, X, Y);
 }
 else {
    StopMoving(CharID);
    character[CharID].room = NewRoom;
    character[CharID].x = X;
    character[CharID].y = Y;
 }
}


//Script header:
import function ChangeRoom(int CharId, int NewRoom, int X, int Y);



Now you can use the function this way (for example):
Inside some interaction event:
ChangeRoom(EGO, 4, 100, 160);
ChangeRoom(MAN, 5, 110, 200);

etc.

-Cheers

Ishmael

import function ChangeRoom(int, int, int, int);

in the script header, I believe... :P
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Scorpiorus


Ishmael

I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

SMF spam blocked by CleanTalk