summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2014-03-14 14:32:07 -0300
committershennetsind <ind@henn.et>2014-03-14 14:32:07 -0300
commit95892027052d6123805a16e12dbd12ec44d3b85d (patch)
tree30c50151d6273f26feeb6153a66e4bb783b4ffc2
parent1007d606645c16d5246761976b7648809edb8b1d (diff)
downloadhercules-95892027052d6123805a16e12dbd12ec44d3b85d.tar.gz
hercules-95892027052d6123805a16e12dbd12ec44d3b85d.tar.bz2
hercules-95892027052d6123805a16e12dbd12ec44d3b85d.tar.xz
hercules-95892027052d6123805a16e12dbd12ec44d3b85d.zip
Follow up 1007d606645c16d5246761976b7648809edb8b1d
A bonus. Fixed unitwalk's non-x/y possibility, NPCs can now be set to chase players around for as long as they keep walking, which opens a number of possibilities e.g. help npc y get thru z. Signed-off-by: shennetsind <ind@henn.et>
-rw-r--r--doc/script_commands.txt10
-rw-r--r--src/map/clif.c7
-rw-r--r--src/map/script.c8
-rw-r--r--src/map/status.c3
4 files changed, 18 insertions, 10 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index ada57d783..dc09256c5 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -5926,12 +5926,11 @@ and will return the following values:
---------------------------------------
*unitwalk <GID>,<x>,<y>;
-*unitwalk <GID>,<mapid>;
+*unitwalk <GID>,<target_GID>;
This is one command, but can be used in two ways. If only the first
argument is given, the unit whose GID is given will start walking towards
-the map with the given mapid (we believe these are the map-indexes found
-in db/map_index.txt).
+the target whose GID is given.
When 2 arguments are passed, the given unit will walk to the given x,y
coordinates on the map where the unit currently is.
@@ -5941,9 +5940,8 @@ Examples:
//Will move/walk the poring we made to the coordinates 150,150
unitwalk .GID,150,150;
-//Will move the poring towards alberta (if my assumed map-indexes are
-//correct).
- unitwalk .GID,3;
+//NPC will move towards the attached player.
+ unitwalk .GID,getcharid(3);//a player's GID is their account ID
---------------------------------------
diff --git a/src/map/clif.c b/src/map/clif.c
index e72a3c204..d023455e3 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -10057,6 +10057,8 @@ void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) {
void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, int64 tick) {
+ struct block_list *target = NULL;
+
if (pc_isdead(sd)) {
clif->clearunit_area(&sd->bl, CLR_DEAD);
return;
@@ -10082,6 +10084,11 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
case 0x00: // once attack
case 0x07: // continuous attack
+ if( (target = map->id2bl(target_id)) && target->type == BL_NPC ) {
+ npc->click(sd,(TBL_NPC*)target);
+ return;
+ }
+
if( pc_cant_act(sd) || sd->sc.option&OPTION_HIDE )
return;
diff --git a/src/map/script.c b/src/map/script.c
index fca87a81d..63b76e35b 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -15308,11 +15308,11 @@ BUILDIN(pcstopfollow)
// [zBuffer] List of mob control commands --->
//## TODO always return if the request/whatever was successfull [FlavioJS]
-/// Makes the unit walk to target position or map
+/// Makes the unit walk to target position or target id
/// Returns if it was successfull
///
/// unitwalk(<unit_id>,<x>,<y>) -> <bool>
-/// unitwalk(<unit_id>,<map_id>) -> <bool>
+/// unitwalk(<unit_id>,<target_id>) -> <bool>
BUILDIN(unitwalk) {
struct block_list* bl;
@@ -15330,8 +15330,8 @@ BUILDIN(unitwalk) {
int y = script_getnum(st,4);
script_pushint(st, unit->walktoxy(bl,x,y,0));// We'll use harder calculations.
} else {
- int map_id = script_getnum(st,3);
- script_pushint(st, unit->walktobl(bl,map->id2bl(map_id),65025,1));
+ int target_id = script_getnum(st,3);
+ script_pushint(st, unit->walktobl(bl,map->id2bl(target_id),1,1));
}
return true;
diff --git a/src/map/status.c b/src/map/status.c
index 4a81fcb05..46f6d265d 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1867,6 +1867,9 @@ int status_check_visibility(struct block_list *src, struct block_list *target) {
if (src->m != target->m || !check_distance_bl(src, target, view_range))
return 0;
+ if( src->type == BL_NPC ) /* NPCs don't care for the rest */
+ return 1;
+
if( ( tsc = status->get_sc(target) ) ) {
struct status_data *st = status->get_status_data(src);