Jump to content
  • 0
Mutate

Check party member if within the cell and in the map

Question

Hi Everyone,

I'm trying to implement a condition

- if the party member is not within 14 cell of the mvp killer ( that player will not receive a point ) 

Thank you in advance

here is the part of my code 

OnNPCKillEvent:
	if( getgmlevel() >= 60 ) end; // if gm.. event wont trigger
	for ([email protected] = 0; [email protected] < getarraysize(.mvp_id); [email protected] += 3 ) {
		if( killedrid == .mvp_id[[email protected]] && compare( strcharinfo(3), .maps$[[email protected]/3] ) ) {
			[email protected] = .mvp_id[[email protected]+1];
			[email protected] = .mvp_id[[email protected]+2];
			if( .haltevent ) { // temporarily disable while giving away rewards to avoid bugs
				dispbottom "Event is still giving away rewards. This kill wont not recorded.", 0xff0000;
				end;
			}
			query_sql( "INSERT INTO `mvp_ladder_rank` SET `char_id`='"+ getcharid(0) +"', `name`='"+ strcharinfo(0) +"', `day_kills` = '1', `week_kills` = '1', `month_kills` = '1', `all_kills` = '1' ON DUPLICATE KEY UPDATE `day_kills` = `day_kills` + 1, `week_kills`=`week_kills` + 1, `month_kills` = `month_kills` + 1,`all_kills` = `all_kills` + 1" );
			if( !getcharid(1) ) {
				if(.Option&8 && rand(100) < .chance) 
				{
					[email protected] = true;
					for ([email protected] = 0; [email protected] < getarraysize(.solo_reward); [email protected]+=2)
						getitem .solo_reward[[email protected]], .solo_reward[[email protected]+1];
				}
				if(.Option&16) {
					#MVPPOINTS += [email protected];	
					dispbottom "You got "+ [email protected] +" MVP Points. Total: "+ #MVPPOINTS;
				}	
				if ( [email protected] )
					announce "[ "+ strcharinfo(0) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and received an item.", bc_all;
				else
					announce "[ "+ strcharinfo(0) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" alone at "+ strcharinfo(3), bc_all;
			} else {
				if ( rand(100) < .chance )
					[email protected] = true;
				if ( [email protected] )
					announce "[ System ] : Player ["+ strcharinfo(0) +"] of party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and received an item.", bc_all;
				else
					announce "[ System ] : Player ["+ strcharinfo(0) +"] of party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), bc_all;
				getpartymember getcharid(1), 1;
				getpartymember getcharid(1), 2;
				for ( [email protected] = 0; [email protected] < [email protected]; [email protected] ) {
					
					if ( isloggedin( [email protected][[email protected]], [email protected][[email protected]] ) ) {
						[email protected]_online++;
						
						if(.Option&16) {
							attachrid [email protected][[email protected]];
							getmapxy ( @map$, @x, @y, BL_PC );
							if ( distance([email protected], [email protected], @x, @y) > 15 || @map$ != [email protected]$ ) {
								#MVPPOINTS += [email protected];	
								dispbottom "You got "+ [email protected] +" MVP Points. Total: "+ #MVPPOINTS;								
								if ( [email protected] ) 
									announce "[ "+ strcharinfo(0) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and received an item.", bc_all;
								else
									announce "[ "+ strcharinfo(0) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" alone at "+ strcharinfo(3), bc_all;
								
							}
							else 
							#MVPPOINTS += [email protected] / [email protected];
							dispbottom "--------------------------------------------";
							dispbottom "You got "+ ([email protected] / [email protected]) +" MVP Points. Total: "+ #MVPPOINTS;
							dispbottom "--------------------------------------------";
							
							[email protected][[email protected]] = [email protected][[email protected]];
							[email protected];
							
						}
					}
					
				}
				if ( .Option&8 && [email protected] ) {
					for ([email protected] = 0; [email protected] < getarraysize(.party_reward); [email protected]+=2)
						getitem .party_reward[[email protected]], .party_reward[[email protected]+1];
				}
			}
			end;
		}
	}
	end;

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

This script is not  complete... Post it full....

Anyway, for what i can see it is already set this way u want
 

if ( distance([email protected], [email protected], @x, @y) > 15 || @map$ != [email protected]$ ) {

I dunno where  theses scope varibles came from but assuming its getmapxy from mvp killer, it  means the party member shouuld be on 14 cells distance and also in the same map (obviously)

Link to comment
Share on other sites

  • 0
13 hours ago, buraquera said:

This script is not  complete... Post it full....

Anyway, for what i can see it is already set this way u want
 

if ( distance([email protected], [email protected], @x, @y) > 15 || @map$ != [email protected]$ ) {

I dunno where  theses scope varibles came from but assuming its getmapxy from mvp killer, it  means the party member shouuld be on 14 cells distance and also in the same map (obviously)

Unfortunately i cannot share the whole script

 

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

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.