Jump to content
  • 0

Reward for party members on killer player screen,


mawjustin

Question


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  121
  • Reputation:   6
  • Joined:  09/26/14
  • Last Seen:  

Hi Team, may I ask for your help? I'm following this script, but unable to complete it, I need to add the cell distance between party killer and other party members, only those within 15 cells can get the reward in the map.

I'm trying to combine these scripts.

From here:

From here:

From here:

 

This what I got so far, I am unable to do the distance from killer and party members.

OnNPCKillEvent:
sleep2 500;
if (getgmlevel() >= .gm ) { end; } // If gm = event wont happen 	
if ( getmonsterinfo( killedrid, MOB_MVPEXP )) {
	for (.@aaa = 0; .@aaa < getarraysize(.t_mvphunt_maps$); .@aaa++) {
	if ( strcharinfo(3) == .t_mvphunt_maps$[.@aaa]) { 
			    if ( getcharid(1) ) {
				.@mapname$ = .t_mvphunt_maps$[.@aaa];
				getpartymember getcharid(1), 1;
				getpartymember getcharid(1), 2;
				getmapxy(.@mapname$,.@mapx,.@mapy,BL_PC);
					for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
						if ( !isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ||  // what happens if someone in the party member is offline =/
							strcharinfo(3,$@partymembercid[.@i]) != .@mapname$ || // If the party member is not on the same map of the killer
							checkidle(rid2name($@partymemberaid[.@i])) > 5 ) // If player is idle for 30 seconds
							continue;
				set .@mvppointshunt,0;
				getitem .p_rwd[0], .p_rwd[1], $@partymemberaid[.@i];
				getitem .p_rwd[2], .p_rwd[3], $@partymemberaid[.@i];
				announce "[ System ] : Player ["+ strcharinfo(0) +"] of party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), bc_all,0xffb6c1;
					}
				} else {
				set .@mvppointshunt,0;
				getitem .s_rwd[0], .s_rwd[1];
				getitem .s_rwd[2], .s_rwd[3];
				announce "[ System ] : Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" alone at "+ strcharinfo(3), bc_all,0xffb6c1;
			}
		MVPHunts = MVPHunts+1;
		dispbottom "---------------------------------------------------";
		dispbottom "You killed a total of "+MVPHunts+" MVP"+((MVPHunts == 1)?"":"s")+".";
		dispbottom "---------------------------------------------------";
		dispbottom "[BB]: MVP Killed!";
		end;
		}	
    }
	end;
	}	
}

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  63
  • Reputation:   35
  • Joined:  07/04/19
  • Last Seen:  

this is probably the fastest way to do it: (untested) 

if ( !isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ||  // what happens if someone in the party member is offline =/
	strcharinfo(3,$@partymembercid[.@i]) != .@mapname$ || // If the party member is not on the same map of the killer
	checkidle(rid2name($@partymemberaid[.@i])) > 5 || // If player is idle for 30 seconds
	getmapxy(.@membermap$, .@memberX, .@memberY, BL_PC, $partymemberaid[.@i]) == -1 || distance(.@mapx, .@mapy, .@memberX, .@memberY) > 15 ) // if the search failed or if ths distance is larger than 15 cells.

from the docs: 

---------------------------------------

*distance(<x0>,<y0>,<x1>,<y1>)

Returns distance between 2 points.

Example:
	.@i = distance(100,200,101,202);

---------------------------------------
  
---------------------------------------

*getmapxy("<variable for map name>",<variable for x>,<variable for y>{,<type>,"<	value>"})

This function will locate a character object, NPC object or pet's coordinates
and place their coordinates into the variables specified when calling it. It
will return 0 if the search was successful, and -1 if the parameters given were
not variables or the search was not successful.

Type is the type of object to search for:

	BL_PC   - Character object (default)
	BL_NPC  - NPC object
	BL_PET  - Pet object
	BL_HOM  - Homunculus object
	BL_MER  - Mercenary object
	BL_ELEM - Elemental object

The search value is optional. If it is not specified, the location of the
invoking character will always be returned for types BL_PC and BL_PET,
the location of the NPC running this function for type BL_NPC.

If a search value is specified, for types BL_PC and BL_NPC, the
character or NPC with the specified name or GID will be located.

 

you could also try to use attachrid() to the party member and then check his location with getmapxy.

Edited by Mastagoon
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  121
  • Reputation:   6
  • Joined:  09/26/14
  • Last Seen:  

5 hours ago, Mastagoon said:

this is probably the fastest way to do it: (untested) 


if ( !isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ||  // what happens if someone in the party member is offline =/
	strcharinfo(3,$@partymembercid[.@i]) != .@mapname$ || // If the party member is not on the same map of the killer
	checkidle(rid2name($@partymemberaid[.@i])) > 5 || // If player is idle for 30 seconds
	getmapxy(.@membermap$, .@memberX, .@memberY, BL_PC, $partymemberaid[.@i]) == -1 || distance(.@mapx, .@mapy, .@memberX, .@memberY) > 15 ) // if the search failed or if ths distance is larger than 15 cells.

from the docs: 


---------------------------------------

*distance(<x0>,<y0>,<x1>,<y1>)

Returns distance between 2 points.

Example:
	.@i = distance(100,200,101,202);

---------------------------------------
  
---------------------------------------

*getmapxy("<variable for map name>",<variable for x>,<variable for y>{,<type>,"<	value>"})

This function will locate a character object, NPC object or pet's coordinates
and place their coordinates into the variables specified when calling it. It
will return 0 if the search was successful, and -1 if the parameters given were
not variables or the search was not successful.

Type is the type of object to search for:

	BL_PC   - Character object (default)
	BL_NPC  - NPC object
	BL_PET  - Pet object
	BL_HOM  - Homunculus object
	BL_MER  - Mercenary object
	BL_ELEM - Elemental object

The search value is optional. If it is not specified, the location of the
invoking character will always be returned for types BL_PC and BL_PET,
the location of the NPC running this function for type BL_NPC.

If a search value is specified, for types BL_PC and BL_NPC, the
character or NPC with the specified name or GID will be located.

 

you could also try to use attachrid() to the party member and then check his location with getmapxy.

testing it now..

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