From a702c55f219519c1d9410f823bd7a9e4c6be256b Mon Sep 17 00:00:00 2001 From: shennetsind Date: Wed, 7 Aug 2013 18:49:31 -0300 Subject: Fixed Bug #7633 unitskillusepos/unitskilluseid script commands werent functioning because the npc's status weren't properly measured. Special Thanks to purityz http://hercules.ws/board/tracker/issue-7633-unitskillusepos-unitskilluseid/ Signed-off-by: shennetsind --- src/map/script.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/map/script.c b/src/map/script.c index 4385ef07d..04ed0ccce 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -15092,8 +15092,17 @@ BUILDIN(unitskilluseid) target_id = ( script_hasdata(st,5) ? script_getnum(st,5) : unit_id ); bl = iMap->id2bl(unit_id); - if( bl != NULL ) + + if( bl != NULL ) { + if( bl->type == BL_NPC ) { + if (!((TBL_NPC*)bl)->status.hp) { + status_calc_npc(((TBL_NPC*)bl), true); + } else { + status_calc_npc(((TBL_NPC*)bl), false); + } + } unit_skilluse_id(bl, target_id, skill_id, skill_lv); + } return true; } @@ -15118,8 +15127,17 @@ BUILDIN(unitskillusepos) skill_y = script_getnum(st,6); bl = iMap->id2bl(unit_id); - if( bl != NULL ) + + if( bl != NULL ) { + if( bl->type == BL_NPC ) { + if (!((TBL_NPC*)bl)->status.hp) { + status_calc_npc(((TBL_NPC*)bl), true); + } else { + status_calc_npc(((TBL_NPC*)bl), false); + } + } unit_skilluse_pos(bl, skill_x, skill_y, skill_id, skill_lv); + } return true; } -- cgit v1.2.3-60-g2f50