- // https://rathena.org/board/topic/101778-mvp-killer-party-gets-a-item/
- // hi, is there a way to reward a party (or player if he is alone), to reward with an item which
- // only drops once every kill? one idea would be to cause the mvp killer after he kills the mvp to
- // get a menu where he can choose one of this partymembers to get the item, the condition should be
- // here that the partymember must be on the same map/spot when the mvp was killed, so no abuse can be done.
- - script #mvp_reward -1,{
- end;
- OnNPCKillEvent:
- // check if they killed a MVP
- if (getmonsterinfo(killedrid,MOB_MVPEXP) == 0) end;
- do {
- // No party --> automatically give the item to killer.
- if (getcharid(1)==0 ) {
- set .@reward_accountid, playerattached();
- break;
- }
- getpartymember(getcharid(1));
- // Party of 1 --> automatically give the item to killer.
- if ($@partymembercount==1) {
- set .@reward_accountid, playerattached();
- break;
- }
- // save the map where MVP was killed
- set .@kill_map$, strcharinfo(3);
- // get party info (name, char_id, account_id)
- getpartymember(getcharid(1));
- set .@party_count, $@partymembercount;
- copyarray .@party_names$[0],$@partymembername$[0],.@party_count;
- getpartymember(getcharid(1),1);
- copyarray .@party_charid[0],$@partymembercid[0],.@party_count;
- getpartymember(getcharid(1),2);
- copyarray .@party_aid[0],$@partymemberaid[0],.@party_count;
- // construct menu of online party members on the same map
- for( set .@i,0; .@i<.@party_count; set .@i,.@i+1 ) {
- if (isloggedin(.@party_aid[.@i],.@party_charid[.@i])) {
- // if they are online
- getmapxy(.@map$, .@x, .@y, 0, .@party_names$[.@i]);
- if (.@map$ == .@kill_map$) {
- set .@menu$, .@menu$ + .@party_names$[.@i]+":";
- } else {
- set .@menu$, .@menu$ + ":";
- }
- } else {
- // if they are offline, don't add their name
- set .@menu$, .@menu$ + ":";
- }
- }
- mes "[MVP Reward]";
- mes "Who should receive the reward?";
- close2;
- // pick a party member
- set .@j, prompt(.@menu$);
- if (.@j == 255) {
- // they clicked Cancel button --> automatically give the item to killer.
- set .@reward_accountid, playerattached();
- break;
- } else {
- set .@j, .@j -1;
- set .@reward_accountid, .@party_aid[.@j];
- break;
- }
- } while (0);
- // give item to player
- getitem 55555,1, .@reward_accountid;
- end;
- }
MVP Reward
Posted by Anonymous on Thu 21st May 2015 21:49
raw | new post
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.