Jump to content
  • 0

OnPCKillEvent/OnPCDieEvent


pajodex

Question


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

Hi,

Is is possible to attach a OnPCKillEvent/OnPCDieEvent to the leader of party?

Thanks!

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 1

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

-	script	DieDieDie	-1,{
OnPCDieEvent:
	.@party_id = getcharid(1);
	if (getcharid(0) != getpartyleader(.@party_id,2)) {
		end;
		}
  	mapannounce strnpcinfo(4),"The party leader of "+getpartyname(.@party_id)+" has died in battle. ",0,"0x00ff99";
	end;
	}

 

Edited by crazyarashi
  • Upvote 1
Link to comment
Share on other sites

  • 0

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

Cool, Will try this soon. What if there are two parties?

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

1 minute ago, pajodex said:

Cool, Will try this soon. What if there are two parties?

this will apply to all party leaders of any party :o

Link to comment
Share on other sites

  • 0

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

I'm getting this error in console every time I use command @die with the leader in the party

[Error]: buildin_rid2name: invalid RID

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  91
  • Reputation:   22
  • Joined:  10/24/14
  • Last Seen:  

5 hours ago, pajodex said:

I'm getting this error in console every time I use command @die with the leader in the party


[Error]: buildin_rid2name: invalid RID

 

Hey,

Have you tried to add in some checks like, if some member is offline? I think when getting RID when some one is offline will fail. Not 100% sure about this! xD


Like this:

// (Optional) Check who is the killer
if (killedrid == killerrid) {
	// You have been killed by your own hand
	end;
}

// Check player is in a party
if (getcharid(1)) {
	getpartymember(getcharid(1), 2);
	set .@partymembercount, $@partymembercount;
	copyarray .@partymemberaid[0], $@partymemberaid[0], .@partymembercount;
	for (set .@i, 0; .@i < .@partymembercount; set .@i, .@i + 1) {
		// Try to attach each party member to this script
		if (attachrid(.@partymemberaid[.@i])) {
			// Now we can check player status like AFK
			if (checkvending() && checkchatting()) {
				// This member is AFK
				end;
			}
		}
	}
}

 

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...