summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-26 18:54:07 +0000
committerLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-26 18:54:07 +0000
commit2e35eff8bfe55314e30aaa2b88bd0bf1e7bd7647 (patch)
tree53fbb31579d6e7c4f9572090379dd0ac36c53000 /src/map/mob.c
parent894951cb5bb625050cc6da1ce409aed575f034f0 (diff)
downloadhercules-2e35eff8bfe55314e30aaa2b88bd0bf1e7bd7647.tar.gz
hercules-2e35eff8bfe55314e30aaa2b88bd0bf1e7bd7647.tar.bz2
hercules-2e35eff8bfe55314e30aaa2b88bd0bf1e7bd7647.tar.xz
hercules-2e35eff8bfe55314e30aaa2b88bd0bf1e7bd7647.zip
* Patches to allow everything to work right. + 1 more sample script.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6779 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index efa632ef9..1b148f629 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -808,7 +808,7 @@ static int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap)
setd_sub(NULL, NULL, ".ai_action", 2, (void *)bl->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);
- return 0; // We have script handling the work.
+ return 1; // We have script handling the work.
}
if(battle_check_target(&md->bl,bl,BCT_ENEMY)<=0)
@@ -997,6 +997,15 @@ int mob_unlocktarget(struct mob_data *md,int tick)
{
nullpo_retr(0, md);
+ if(md->nd){
+ struct block_list *tbl = map_id2bl(md->target_id);
+ setd_sub(NULL, NULL, ".ai_action", 0, (void *)(int)6, &md->nd->u.scr.script->script_vars);
+ setd_sub(NULL, NULL, ".ai_action", 1, (void *)(int)(tbl?tbl->type:0), &md->nd->u.scr.script->script_vars);
+ setd_sub(NULL, NULL, ".ai_action", 2, (void *)(tbl?tbl->id:0), &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=0;
md->state.skillstate=MSS_IDLE;
md->next_walktime=tick+rand()%3000+3000;
@@ -2160,6 +2169,17 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
guild_agit_break(md);
}
+ if(src->type == BL_MOB){
+ struct mob_data *smd = (struct mob_data *)src;
+ if(smd->nd){
+ setd_sub(NULL, NULL, ".ai_action", 0, (void *)(int)5, &smd->nd->u.scr.script->script_vars);
+ setd_sub(NULL, NULL, ".ai_action", 1, (void *)(int)md->bl.type, &smd->nd->u.scr.script->script_vars);
+ setd_sub(NULL, NULL, ".ai_action", 2, (void *)md->bl.id, &smd->nd->u.scr.script->script_vars);
+ setd_sub(NULL, NULL, ".ai_action", 3, (void *)smd->bl.id, &smd->nd->u.scr.script->script_vars);
+ run_script(smd->nd->u.scr.script, 0, 0, smd->nd->bl.id);
+ }
+ }
+
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);