Jump to content
  • 0

Help me with MVP reward script


Nero

Question


  • Group:  Members
  • Topic Count:  74
  • Topics Per Day:  0.02
  • Content Count:  194
  • Reputation:   2
  • Joined:  12/18/11
  • Last Seen:  

This is the code 

-	script	mvprewarders	-1,{
OnNPCKillEvent:
	if ( getmonsterinfo( killedrid, MOB_MVPEXP ) && rand(100) < 100 ) {
		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 30022, 1, .@partymemberaid[ rand( .@c ) ];
			announce "Party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and a Random Party Member Got 1 MVP TOKEN at "+ strcharinfo(3),0,0x00FF00;
		}
		else {
			getitem 30022, 1;
			announce "Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and Got 1 MVP TOKEN at "+ strcharinfo(3),0,0x00FF00;
		}
	}
	end;
}

The problem is how can i make all party member to get the reward instead of random party member? Also only party member in the area will be valid to get the reward.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  1096
  • Reputation:   345
  • Joined:  02/26/12
  • Last Seen:  

Not tested. But something like that. I were think about getpartyitem, but i guess someone already maybe made such src command for giving entire party via simple script command rewards for all (but this command can be very abused by cheaters, for example by very big party). 

 

-	script	mvprewarders	-1,{
OnNPCKillEvent:
	if ( getmonsterinfo( killedrid, MOB_MVPEXP ) && rand(100) < 100 ) {
		if ( getcharid(1) ) {
			
			getpartymember getcharid(1), 0; // for party member names.
			getpartymember getcharid(1), 1;
			getpartymember getcharid(1), 2;

			// let's get coordinates of the guy which triggered the event.
			// Then, we will check distance from this master guy to party_members.
			getmapxy(.master_map$, .master_x, .master_y, UNITTYPE_PC, strcharinfo(0));


			for ( .@i = 0; .@i < $@partymembercount; .@i++ )
			{
				// what happens if someone in the party member is offline =/
				if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) )
				{

					// let's get party member coordinates. Which we will check with master.
					// If distance < then AREA_SIZE (around 14 cells), then we will reward party member with the item
					// Either, we will do nothing.
					getmapxy(.party_member_map$, .party_member_x, .party_member_y, UNITTYPE_PC, $@partymembername$[.@i]);
					if( distance(.master_x,.master_y,.party_member_x,.party_member_y) < getbattleflag("area_size") )
						getitem 30022, 1, .@partymemberaid[.@i];

					.@partymemberaid[.@c] = $@partymemberaid[.@i];
					.@c++;
					
				}
			}
			getitem 30022, 1, .@partymemberaid[ rand( .@c ) ];
			announce "Party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and a Random Party Member Got 1 MVP TOKEN at "+ strcharinfo(3),0,0x00FF00;
		}
		else {
			getitem 30022, 1;
			announce "Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and Got 1 MVP TOKEN at "+ strcharinfo(3),0,0x00FF00;
		}
	}
	end;
}

P.S. Not tested. Because of cloudflare rules, some variables replaced via CF, so, here is pastebin: http://pastebin.com/Rbq1xEMm

Edited by Anacondaqq
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  74
  • Topics Per Day:  0.02
  • Content Count:  194
  • Reputation:   2
  • Joined:  12/18/11
  • Last Seen:  

Hello Anacondaqq

thank you very much but the area codes are not working. Players can get the item even though they are too far or in another map. Also may i ask what do you mean by "  but this command can be very abused by cheaters, for example by very big party "

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

		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 30022, 1, .@partymemberaid[ rand( .@c ) ];
			announce "Party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and a Random Party Member Got 1 MVP TOKEN at "+ strcharinfo(3),0,0x00FF00;
		}
		else {
			getitem 30022, 1;
			announce "Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and Got 1 MVP TOKEN at "+ strcharinfo(3),0,0x00FF00;
		}

change to

		.@party_id = getcharid(1);
		if ( .@party_id ) {
			getpartymember .@party_id, 2;
			.@current_map$ = strcharinfo(3);
			for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
				if ( attachrid( $@partymemberaid[.@i] ) ) {
					if ( getcharid(1) == .@party_id && strcharinfo(3) == .@current_map$ )
						getitem 30022, 1;
				}
				detachrid;
			}
			announce "Party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and a Random Party Member Got 1 MVP TOKEN at "+ strcharinfo(3),0,0x00FF00;
		}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  74
  • Topics Per Day:  0.02
  • Content Count:  194
  • Reputation:   2
  • Joined:  12/18/11
  • Last Seen:  

Still not working..

Link to comment
Share on other sites

  • -2

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  193
  • Reputation:   41
  • Joined:  07/21/16
  • Last Seen:  

Open up 12 instances of your RO client, log in 12 accounts, kill 1 boss, profit. If you don't see that system being abused, I suggest you do not use it.

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