Jump to content
  • 0

Attach killerid in instance


pajodex

Question


  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  436
  • Reputation:   167
  • Joined:  12/12/17
  • Last Seen:  

Hi,

Anyone who can help me with this?

I'm using custom mobs and custom item rewards. I get error when I try to kill the mob in console

[Error]: get_val_: fatal error ! player not attached!
[Debug]: Function: getmonsterinfo (2 parameters):
[Debug]: Data: param name='killedrid' type=122
[Debug]: Data: number value=3000
[Debug]: Source (NPC): #summon_mpv at 1#force_1-1 (0,0)
[Warning]: script:get_val: cannot access player variable 'killedrid', defaulting to 0
[Info]: [Instance] Destroyed 1.
[Error]: Memory manager: args of aFree 0x274B79E4 is invalid pointer h:\dxro\rathena\src\map\map.cpp line 241

This is the part of the script when mob is summoned and killed

force_1-1,0,0,0	script	#summon_mpv	-1,{
	end;
OnEnable1:
	.@map$        = instance_mapname("force_1-1");
	.@label_g$ = instance_npcname(strnpcinfo(0))+"::OnDeathGr";
	monster .@map$,26,174,"--ja--",3000,1,.@label_g$;
		
		OnDeathGr:
			if ( getmonsterinfo( killedrid, 3000 )) {
			if ( getcharid(1) ) {
				getpartymember getcharid(1), 1;
				getpartymember getcharid(1), 2;
				for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
					if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { // what happens if someone in the party member is offline =/
						.@partymemberaid[.@c] = $@partymemberaid[.@i];
						.@c++;
					}
				}
				getitem 33001, 1, .@partymemberaid[ rand( .@c ) ];
				warp "prontera",156,191;
				instance_destroy();
				announce "[ System ] : Player ["+ strcharinfo(0) +"] of party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and got reward at "+ strcharinfo(3), bc_all;
			}
			else {
				getitem 33001, 1;
				instance_destroy();
				warp "prontera",156,191;
				announce "[ System ] : Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and got reward alone at "+ strcharinfo(3), bc_all;
			}
			//getitem 33001,1;
			end;
			}

} 

The code works well if it's not in instance. But when I put it in instance, I get this error.

Thanks

 

UPDATE: Forgot to add "end;"

OnEnable1:
	.@map$        = instance_mapname("force_1-1");
	.@label_g$ = instance_npcname(strnpcinfo(0))+"::OnDeathGr";
	monster .@map$,26,174,"--ja--",3000,1,.@label_g$;
	**end;**

Now only thing left is when I kill the mob, I get this error:

[Error]: Memory manager: args of aFree 0x20CC3684 is invalid pointer h:\dxro\rathena\src\map\map.cpp line 241

 

Edited by pajodex
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1678
  • Reputation:   704
  • Joined:  12/21/14
  • Last Seen:  

OnPCDieEvent:

This special label triggers when a player dies. The variable 'killerrid' is
set to the ID of the killer.

OnPCKillEvent:

This special label triggers when a player kills another player. The variable
'killedrid' is set to the ID of the player killed.

OnNPCKillEvent:

This special label triggers when a player kills a monster without label. The variable
'killedrid' is set to the Class (mob ID) of the monster killed.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...