Jump to content
  • 0

Check if party member is same map with the mob killer


Eross

Question


  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.11
  • Content Count:  349
  • Reputation:   12
  • Joined:  04/05/20
  • Last Seen:  

Hi ! can anyone edit my this script .. I made a share exp for event MOTD . but I need to check if the member is on the same map with the mob killer because every time I kill a monster an exp applies on members wherever they are. Thanks a lot guys 

OnNPCKillEvent:
	query_sql ("SELECT `exp` FROM `party` WHERE `party_id` = "+ getcharid(1), .@exp);
	if(killedrid!=$MobTypeLow && killedrid!=$MobTypeMid && killedrid!=$MobTypeHard ) { end; }
	.@map$ = strcharinfo(3);
	.mobid = killedrid;
	if (.@exp) {addrid(2,0,getcharid(1));}
	dispbottom "[Monster of the Day]: Experience Gained Base:"+strmobinfo(6,.mobid)+" Job:"+strmobinfo(7,.mobid)+"";
	set BaseExp,(BaseExp+strmobinfo(6,.mobid));
	set JobExp,(JobExp+strmobinfo(7,.mobid));
	end;

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

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

there is 2 ways i can think of

1. get party information

OnNPCKillEvent:
	.@m$ = strcharinfo(3);//the killer map.
	.@pid = getcharid(1);//get killer party id
	.@char_id = getcharid(0);//save char id for check later
	if(.@pid){//the player is in a party
		getpartymember(.@pid,1,.@cid);//get party information char id
		getpartymember(.@pid,2,.@aid);//get party information account id
		.@size = getarraysize(.@cid);//array size
		for(.@i=0;.@i<.@size;.@i++){
			if(.@cid[.@i] == .@char_id) continue;//this is the killer , skip
			if(isloggedin(.@aid[.@i],.@cid[.@i])){//is the party member online?
				if(strcharinfo(3,.@cid[.@i]) == .@m$){//check the map
					//the party member is in the same map.
					//your code here.
					
					
					
				}
			}
		}
	}
end;

 

2. get players list in the map

OnNPCKillEvent:
	.@m$ = strcharinfo(3);//the killer map.
	.@pid = getcharid(1);//get killer party id
	.@char_id = getcharid(0);//save char id for check later
	if(.@pid){//the player is in a party
		.@size = getmapunits(BL_PC,.@m$,.@name$);//get players in the map
		for(.@i=0;.@i<.@size;.@i++){
			if(getcharid(0,.@name$[.@i]) == .@char_id) continue;//this is the killer , skip
			if(getcharid(1,.@name$[.@i]) == .@pid){//check the party id
				//the party member is in the same map.
				//your code here.
				
				
				
			}
		}
	}
end;

 

Edited by sader1992
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.01
  • Content Count:  148
  • Reputation:   21
  • Joined:  11/12/18
  • Last Seen:  

4 minutes ago, Eross said:

Hi ! can anyone edit my this script .. I made a share exp for event MOTD . but I need to check if the member is on the same map with the mob killer because every time I kill a monster an exp applies on members wherever they are. Thanks a lot guys 

OnNPCKillEvent:
	query_sql ("SELECT `exp` FROM `party` WHERE `party_id` = "+ getcharid(1), .@exp);
	if(killedrid!=$MobTypeLow && killedrid!=$MobTypeMid && killedrid!=$MobTypeHard ) { end; }
	.@map$ = strcharinfo(3);
	.mobid = killedrid;
	if (.@exp) {addrid(2,0,getcharid(1));}
	dispbottom "[Monster of the Day]: Experience Gained Base:"+strmobinfo(6,.mobid)+" Job:"+strmobinfo(7,.mobid)+"";
	set BaseExp,(BaseExp+strmobinfo(6,.mobid));
	set JobExp,(JobExp+strmobinfo(7,.mobid));
	end;

 

What is your basis then?
- Location of party leader ?
- Specific location chosen by you?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.11
  • Content Count:  349
  • Reputation:   12
  • Joined:  04/05/20
  • Last Seen:  

On 9/26/2021 at 10:23 PM, Forshaken said:

What is your basis then?
- Location of party leader ?
- Specific location chosen by you?

hmm I need to get the location of the party member who killed the monster..

Or maybe location of party leader will do since this feature is made for leeching players only ... ^_^

 

Hi thanks sir @sader1992! it worked .. But the only thing/problem is ? How can I make the EXP output recieved by partymember less for like 60% only and 100% for the killer ? 

OnNPCKillEvent:
	query_sql ("SELECT `exp` FROM `party` WHERE `party_id` = "+ getcharid(1), .@exp);
	if(killedrid!=$MobTypeLow && killedrid!=$MobTypeMid && killedrid!=$MobTypeHard ) { end; }
	.mobid = killedrid;
	.@m$ = strcharinfo(3);//the killer map.
	.@pid = getcharid(1);//get killer party id
	.@char_id = getcharid(0);//save char id for check later
	if(.@pid){//the player is in a party
		getpartymember(.@pid,1,.@cid);//get party information char id
		getpartymember(.@pid,2,.@aid);//get party information account id
		.@size = getarraysize(.@cid);//array size
		for(.@i=0;.@i<.@size;.@i++){
			if(.@cid[.@i] == .@char_id) continue;//this is the killer , skip
			if(isloggedin(.@aid[.@i],.@cid[.@i])){//is the party member online?
				if(strcharinfo(3,.@cid[.@i]) == .@m$){//check the map
					//the party member is in the same map.
					//your code here.
					if (.@exp) {
						addrid(2,0,getcharid(1));
					}					
				}
			}
		}
	}
	dispbottom "[Monster of the Day]: Experience Gained Base:"+strmobinfo(6,.mobid)+" Job:"+strmobinfo(7,.mobid)+"";
	set BaseExp,(BaseExp+strmobinfo(6,.mobid));
	set JobExp,(JobExp+strmobinfo(7,.mobid));
	end;

 

Edited by Eross
added lines
Link to comment
Share on other sites

  • 0

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

17 minutes ago, Eross said:

Hi thanks sir @sader1992! it worked .. But the only thing/problem is ? How can I make the EXP output recieved by partymember less for like 60% only and 100% for the killer ? 

OnNPCKillEvent:
	query_sql ("SELECT `exp` FROM `party` WHERE `party_id` = "+ getcharid(1), .@exp);
	if(killedrid!=$MobTypeLow && killedrid!=$MobTypeMid && killedrid!=$MobTypeHard ) { end; }
	.mobid = killedrid;
	.@m$ = strcharinfo(3);//the killer map.
	.@pid = getcharid(1);//get killer party id
	.@char_id = getcharid(0);//save char id for check later
	if(.@pid){//the player is in a party
		getpartymember(.@pid,1,.@cid);//get party information char id
		getpartymember(.@pid,2,.@aid);//get party information account id
		.@size = getarraysize(.@cid);//array size
		for(.@i=0;.@i<.@size;.@i++){
			if(.@cid[.@i] == .@char_id) continue;//this is the killer , skip
			if(isloggedin(.@aid[.@i],.@cid[.@i])){//is the party member online?
				if(strcharinfo(3,.@cid[.@i]) == .@m$){//check the map
					//the party member is in the same map.
					//your code here.
					if (.@exp) {
						addrid(2,0,getcharid(1));
					}					
				}
			}
		}
	}
	dispbottom "[Monster of the Day]: Experience Gained Base:"+strmobinfo(6,.mobid)+" Job:"+strmobinfo(7,.mobid)+"";
	set BaseExp,(BaseExp+strmobinfo(6,.mobid));
	set JobExp,(JobExp+strmobinfo(7,.mobid));
	end;

 

as a start do not use addrid and do not set the exp variable , use getexp command , and you can provide the char id to it so player attaching is not needed

and this is wrong (.mobid = killedrid;) , just use it as it is or set it to ".@" var like (.@mobid = killedrid;)

and what you want is just math , .@exp = (original_exp/100)*70;

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

  • 0

  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.11
  • Content Count:  349
  • Reputation:   12
  • Joined:  04/05/20
  • Last Seen:  

30 minutes ago, sader1992 said:

as a start do not use addrid and do not set the exp variable , use getexp command , and you can provide the char id to it so player attaching is not needed

and this is wrong (.mobid = killedrid;) , just use it as it is or set it to ".@" var like (.@mobid = killedrid;)

and what you want is just math , .@exp = (original_exp/100)*70;

Thanks sir . But the .@exp is the checker if the party is on Even Share mode .. hmm

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