pastebin - collaborative debugging tool
rathena.kpaste.net RSS


MVP Reward
Posted by Anonymous on Thu 21st May 2015 21:49
raw | new post

  1. // https://rathena.org/board/topic/101778-mvp-killer-party-gets-a-item/
  2. // hi, is there a way to reward a party (or player if he is alone), to reward with an item which
  3. // only drops once every kill? one idea would be to cause the mvp killer after he kills the mvp to
  4. // get a menu where he can choose one of this partymembers to get the item, the condition should be
  5. // here that the partymember must be on the same map/spot when the mvp was killed, so no abuse can be done.
  6.  
  7.  
  8. -       script  #mvp_reward     -1,{
  9.         end;
  10. OnNPCKillEvent:
  11.         // check if they killed a MVP
  12.         if (getmonsterinfo(killedrid,MOB_MVPEXP) == 0) end;
  13.        
  14.         do {
  15.                 // No party --> automatically give the item to killer.
  16.                 if (getcharid(1)==0 ) {
  17.                         set .@reward_accountid, playerattached();
  18.                         break;
  19.                 }
  20.                 getpartymember(getcharid(1));
  21.                 // Party of 1 --> automatically give the item to killer.
  22.                 if ($@partymembercount==1) {
  23.                         set .@reward_accountid, playerattached();
  24.                         break;
  25.                 }
  26.                
  27.                 // save the map where MVP was killed
  28.                 set .@kill_map$, strcharinfo(3);
  29.                
  30.                 // get party info (name, char_id, account_id)
  31.                 getpartymember(getcharid(1));
  32.                 set .@party_count, $@partymembercount;
  33.                 copyarray .@party_names$[0],$@partymembername$[0],.@party_count;
  34.                 getpartymember(getcharid(1),1);
  35.                 copyarray .@party_charid[0],$@partymembercid[0],.@party_count;
  36.                 getpartymember(getcharid(1),2);
  37.                 copyarray .@party_aid[0],$@partymemberaid[0],.@party_count;
  38.                
  39.                 // construct menu of online party members on the same map
  40.                 for( set .@i,0; .@i<.@party_count; set .@i,.@i+1 ) {
  41.                         if (isloggedin(.@party_aid[.@i],.@party_charid[.@i])) {
  42.                                 // if they are online
  43.                                 getmapxy(.@map$, .@x, .@y, 0, .@party_names$[.@i]);
  44.                                 if (.@map$ == .@kill_map$) {
  45.                                         set .@menu$, .@menu$ + .@party_names$[.@i]+":";
  46.                                 } else {
  47.                                         set .@menu$, .@menu$ + ":";
  48.                                 }
  49.                         } else {
  50.                                 // if they are offline, don't add their name
  51.                                 set .@menu$, .@menu$ + ":";
  52.                         }
  53.                 }
  54.                
  55.                 mes "[MVP Reward]";
  56.                 mes "Who should receive the reward?";
  57.                 close2;
  58.                 // pick a party member
  59.                 set .@j, prompt(.@menu$);
  60.                 if (.@j == 255) {
  61.                         // they clicked Cancel button --> automatically give the item to killer.
  62.                         set .@reward_accountid, playerattached();
  63.                         break;
  64.                 } else {
  65.                         set .@j, .@j -1;
  66.                         set .@reward_accountid, .@party_aid[.@j];
  67.                         break;
  68.                 }
  69.         } while (0);
  70.        
  71.         // give item to player
  72.         getitem 55555,1, .@reward_accountid;
  73.         end;
  74. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}





All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at