Jump to content
  • 0

help with my script!


Mabuhay

Question


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

-	script	mvpkill	-1,{
OnNPCKillEvent:
	if ( getmonsterinfo( killedrid, MOB_MVPEXP ) && rand(100) < 20 ) {
		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 8400, 2, .@partymemberaid[ rand( .@c ) ];
			announce "Player ["+ strcharinfo(0) +"] of ["+ strcharinfo(1) +"] party has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0;
		}
		else {
			getitem 8400, 2;
			announce "Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0;
		}
	}
	if( getmonsterinfo(killedrid, 21) & 0x0020 && rand(100) < 20 ) {
		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 8404, 1, .@partymemberaid[ rand( .@c ) ];
			announce "You have received an item by killing "+ getmonsterinfo( killedrid, MOB_NAME ) +" .", bc_self;
		}
		else {
			getitem 8404, 1;
			announce "You have received an item by killing "+ getmonsterinfo( killedrid, MOB_NAME ) +" .", bc_self;
		}
	}
	end;
}

 

i made this script. upon killing a mini boss, player must get the item. but the problem is that even the MVP will drop the same item.  help!

Edited by MrVandalBus
Link to comment
Share on other sites

1 answer to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   2
  • Joined:  11/06/13
  • Last Seen:  

You need a else between the first if and the second if.

 

Right now, you check if the killed monster gives MVP EXP ( only true for MVPs ), then afterwards you separately check whether the mob has the boss flag ( true for both proper MVPs and mini bosses ).

 

For MVP drop item 1, mini boss drop item 2, use:

-	script	mvpkill	-1,{
OnNPCKillEvent:
	if ( getmonsterinfo( killedrid, MOB_MVPEXP ) && rand(100) < 20 ) {
		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 8400, 2, .@partymemberaid[ rand( .@c ) ];
			announce "Player ["+ strcharinfo(0) +"] of ["+ strcharinfo(1) +"] party has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0;
		}
		else {
			getitem 8400, 2;
			announce "Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0;
		}
	} else if( getmonsterinfo(killedrid, 21) & 0x0020 && rand(100) < 20 ) {
		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 8404, 1, .@partymemberaid[ rand( .@c ) ];
			announce "You have received an item by killing "+ getmonsterinfo( killedrid, MOB_NAME ) +" .", bc_self;
		}
		else {
			getitem 8404, 1;
			announce "You have received an item by killing "+ getmonsterinfo( killedrid, MOB_NAME ) +" .", bc_self;
		}
	}
	end;
}

 

If you want ONLY mini bosses:

-	script	mvpkill	-1,{
OnNPCKillEvent:
	if ( !getmonsterinfo( killedrid, MOB_MVPEXP ) && getmonsterinfo(killedrid, 21) & 0x0020 && rand(100) < 20 ) {
		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 8400, 2, .@partymemberaid[ rand( .@c ) ];
			announce "Player ["+ strcharinfo(0) +"] of ["+ strcharinfo(1) +"] party has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0;
		}
		else {
			getitem 8400, 2;
			announce "Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0;
		}
	}
	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...