Browse Source

Merge pull request #1286 from Jeybla/add_1278

Adds var 'killedrid' to script monster OnKillEvents. (Closes #1278)

Thanks to @Jeybla - tested by @Stolao and confirmed as working.
Lemongrass3110 9 years ago
parent
commit
2e668ea25a
2 changed files with 4 additions and 1 deletions
  1. 2 1
      doc/script_commands.txt
  2. 2 0
      src/map/mob.c

+ 2 - 1
doc/script_commands.txt

@@ -5633,7 +5633,8 @@ The only very special thing about this command is an event label, which is an
 optional parameter. This label is written like '<NPC object name>::<label name>' 
 optional parameter. This label is written like '<NPC object name>::<label name>' 
 and upon the monster being killed, it will execute the script inside of the 
 and upon the monster being killed, it will execute the script inside of the 
 specified NPC object starting from the label given. The RID of the player 
 specified NPC object starting from the label given. The RID of the player 
-attached at this execution will be the RID of the killing character.
+attached at this execution will be the RID of the killing character. The variable
+'killedrid' is set to the Class (mob ID) of the monster killed.
 
 
 <size> can be:
 <size> can be:
 	0 = medium (default)
 	0 = medium (default)

+ 2 - 0
src/map/mob.c

@@ -2790,9 +2790,11 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 
 
 		if( md->npc_event[0] && !md->state.npc_killmonster ) {
 		if( md->npc_event[0] && !md->state.npc_killmonster ) {
 			if( sd && battle_config.mob_npc_event_type ) {
 			if( sd && battle_config.mob_npc_event_type ) {
+				pc_setparam(sd, SP_KILLEDRID, md->mob_id);
 				pc_setparam(sd, SP_KILLERRID, sd->bl.id);
 				pc_setparam(sd, SP_KILLERRID, sd->bl.id);
 				npc_event(sd,md->npc_event,0);
 				npc_event(sd,md->npc_event,0);
 			} else if( mvp_sd ) {
 			} else if( mvp_sd ) {
+				pc_setparam(mvp_sd, SP_KILLEDRID, md->mob_id);
 				pc_setparam(mvp_sd, SP_KILLERRID, sd?sd->bl.id:0);
 				pc_setparam(mvp_sd, SP_KILLERRID, sd?sd->bl.id:0);
 				npc_event(mvp_sd,md->npc_event,0);
 				npc_event(mvp_sd,md->npc_event,0);
 			} else
 			} else