Parcourir la source

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

Jey il y a 9 ans
Parent
commit
5b35e1afd0
2 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 2 1
      doc/script_commands.txt
  2. 2 0
      src/map/mob.c

+ 2 - 1
doc/script_commands.txt

@@ -5628,7 +5628,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>' 
 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 
-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:
 	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( sd && battle_config.mob_npc_event_type ) {
+				pc_setparam(sd, SP_KILLEDRID, md->mob_id);
 				pc_setparam(sd, SP_KILLERRID, sd->bl.id);
 				npc_event(sd,md->npc_event,0);
 			} else if( mvp_sd ) {
+				pc_setparam(mvp_sd, SP_KILLEDRID, md->mob_id);
 				pc_setparam(mvp_sd, SP_KILLERRID, sd?sd->bl.id:0);
 				npc_event(mvp_sd,md->npc_event,0);
 			} else