diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/mob.c | 20 | ||||
-rw-r--r-- | src/map/script.c | 13 |
2 files changed, 25 insertions, 8 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index 7761e3db9..efa632ef9 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -972,6 +972,13 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick) tbl = NULL;
}
if (tbl && status_check_skilluse(&md->bl, tbl, 0, 0)) {
+ if(md->nd){
+ setd_sub(NULL, NULL, ".ai_action", 0, (void *)(int)4, &md->nd->u.scr.script->script_vars);
+ setd_sub(NULL, NULL, ".ai_action", 1, (void *)(int)tbl->type, &md->nd->u.scr.script->script_vars);
+ setd_sub(NULL, NULL, ".ai_action", 2, (void *)tbl->id, &md->nd->u.scr.script->script_vars);
+ setd_sub(NULL, NULL, ".ai_action", 3, (void *)md->bl.id, &md->nd->u.scr.script->script_vars);
+ run_script(md->nd->u.scr.script, 0, 0, md->nd->bl.id);
+ }
md->target_id=tbl->id;
md->min_chase=md->db->range3+distance_bl(&md->bl, tbl);
if(md->min_chase>MAX_MINCHASE)
@@ -2153,10 +2160,15 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) guild_agit_break(md);
}
- // SCRIPTˇĄ¨s
- if(md->npc_event[0]){
-// if(battle_config.battle_log)
-// printf("mob_damage : run event : %s\n",md->npc_event);
+ if(md->nd){
+ setd_sub(NULL, NULL, ".ai_action", 0, (void *)(int)3, &md->nd->u.scr.script->script_vars);
+ setd_sub(NULL, NULL, ".ai_action", 1, (void *)(int)src->type, &md->nd->u.scr.script->script_vars);
+ setd_sub(NULL, NULL, ".ai_action", 2, (void *)src->id, &md->nd->u.scr.script->script_vars);
+ setd_sub(NULL, NULL, ".ai_action", 3, (void *)md->bl.id, &md->nd->u.scr.script->script_vars);
+ run_script(md->nd->u.scr.script, 0, 0, md->nd->bl.id);
+ } else if(md->npc_event[0]){
+ // if(battle_config.battle_log)
+ // printf("mob_damage : run event : %s\n",md->npc_event);
if(src && src->type == BL_PET)
sd = ((struct pet_data *)src)->msd;
if(sd && battle_config.mob_npc_event_type)
diff --git a/src/map/script.c b/src/map/script.c index d4f607765..75ed89db6 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -10322,20 +10322,25 @@ int buildin_rid2name(struct script_state *st){ }
int buildin_pcwalkxy(struct script_state *st){
- int id, x, y;
+ int id, x, y = 0;
struct map_session_data *sd = NULL;
id = conv_num(st, & (st->stack->stack_data[st->start + 2]));
x = conv_num(st, & (st->stack->stack_data[st->start + 3]));
- y = conv_num(st, & (st->stack->stack_data[st->start + 4]));
+ if(st->end > st->start + 4)
+ y = conv_num(st, & (st->stack->stack_data[st->start + 4]));
if(id)
sd = map_id2sd(id);
else
sd = script_rid2sd(st);
- if(sd)
- unit_walktoxy(&sd->bl, x, y, 0);
+ if(sd){
+ if(y)
+ unit_walktoxy(&sd->bl, x, y, 0);
+ else
+ unit_walktobl(&sd->bl, map_id2bl(x), 65535, 1);
+ }
return 0;
}
|