From a32ca166fd30baaf79a161d1a2e43eb032c8b014 Mon Sep 17 00:00:00 2001 From: Chuck Miller Date: Sun, 24 Apr 2011 20:10:38 -0400 Subject: Add script functions for getting a player's x and y locations --- src/map/script.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/map/script.c b/src/map/script.c index 27567c3..ca5c427 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -316,6 +316,9 @@ int buildin_shop (struct script_state *st); // [MadCamel] int buildin_isdead (struct script_state *st); // [Jaxad0127] int buildin_fakenpcname (struct script_state *st); //[Kage] int buildin_unequip_by_id (struct script_state *st); // [Freeyorp] +int buildin_getx (struct script_state *st); // [Kage] +int buildin_gety (struct script_state *st); // [Kage] + void push_val (struct script_stack *stack, int type, int val); int run_func (struct script_state *st); @@ -737,6 +740,10 @@ struct buildin_fakenpcname, "fakenpcname", "ssi"}, { buildin_unequip_by_id, "unequipbyid", "i"}, // [Freeyorp] + { + buildin_getx, "getx", "i"}, // [Kage] + { + buildin_gety, "gety", "i"}, // [Kage] // End Additions { NULL, NULL, NULL},}; @@ -7250,6 +7257,31 @@ int buildin_fakenpcname (struct script_state *st) return 0; } +/*============================ + * Gets the PC's x pos + *---------------------------- + */ + +int buildin_getx (struct script_state *st) +{ + struct map_session_data *sd = script_rid2sd (st); + + push_val (st->stack, C_INT, sd->bl.x); + return 0; +} + +/*============================ + * Gets the PC's y pos + *---------------------------- + */ +int buildin_gety (struct script_state *st) +{ + struct map_session_data *sd = script_rid2sd (st); + + push_val (st->stack, C_INT, sd->bl.y); + return 0; +} + // // 実行部main // -- cgit v1.2.3-60-g2f50