Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Dan2552 on Sat 20/12/2003 23:18:37

Title: getting where character is standing (x and y) into variable
Post by: Dan2552 on Sat 20/12/2003 23:18:37
how can i get the characters location (x and y) into 2 variables?
Title: Re:getting where character is standing (x and y) into variable
Post by: Ben on Sat 20/12/2003 23:21:23
The EGO character's coordinates are stored in these two variables:

character[EGO].x
and
character[EGO].y

where EGO is the character's script name..

If you want to do something with the character's CURRENT position, you can use these just like any other variables.

If you want to save the character's position to use the variables later, just do something like this:

xpos = character[EGO].x;
ypos = character[EGO].y;

or this:

SetGlobalInt(1,character[EGO].x);
SetGlobalInt(2,character[EGO].y);
Title: Re:getting where character is standing (x and y) into variable
Post by: Dan2552 on Sat 20/12/2003 23:27:39
Quote from: Santa Ben on Sat 20/12/2003 23:21:23
The EGO character's coordinates are stored in these two variables:

character[EGO].x
and
character[EGO].y

where EGO is the character's script name.. You use these just like any other variables.

i want to go to another room, and come back to the location before when the stuff in that room is finnished.
The character[EGO].x and character[EGO].y would change when you goto the second room... (it would also help if it stored what room number aswell)

is there any way to transfer the character[EGO].x and character[EGO].y to normal variables?

edit----------------------------------------------
i think this may work:

multix = character[EGO].x;
multiy = character[EGO].y;

another edit---
stop editing to make it look like you did ALL the work!