Code/Function of varible that records character location
Displaying 1-6 of 6 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
aazami

I am looking for a way to know where the main character is on the map at anytime.
IE: cordsx = 1, cordsy = 2

Getlocation() or something like that.

I want to spawn entities based on the character's location.

Posted on 2008-06-30 14:27:19

mcgrue

http://www.verge-rpg.com/docs/view.php?libid=1&section=35

Specifically you want:


int entity.x[entity];
int entity.y[entity];


To get the player's current coordinates, the code would look like:


int current_players_x = entity.x[getPlayer()];
int current_players_y = entity.y[getPlayer()];

log( "The player is at coordinates ("+str(current_players_x)+","+str(current_players_y)+")" );

Posted on 2008-06-30 17:14:20

aazami

sweet this helps alot :)

Also is there a way to tell which way to player is facing?

Posted on 2008-07-01 09:59:33

mcgrue

Also on http://www.verge-rpg.com/docs/view.php?libid=1&section=35

entity.face - (read/write) Returns a number that corresponds to the direction the entity is facing. Changing this will change the direction the entity is facing. Setting it to an invalid value can crash the system.


(up) 1
|
(left) 3 --+-- 4 (right)
|
2 (down)


so if the player is facing up, you can do this:


int i = entity.face[GetPlayer()];
Log( "this will say 1 because the player is facing up: " + str(i) );


or to set the player's facing to the right, you could do this:


entity.face[GetPlayer()] = 4;

Posted on 2008-07-01 10:17:16 (last edited on 2008-07-01 10:17:40)

Overkill

Note that another way to switch directions without using the facing codes is possible.Just move 0 tiles in a specific direction!

EntityMove(GetPlayer(), "R0");
I prefer this to "F" codes everywhere when I want the player to turn.

Posted on 2008-07-02 10:36:24

resident

It also seems like a much better way of changing direction than messing around with entity.face.

Posted on 2008-07-04 14:27:09


Displaying 1-6 of 6 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.