Jump to content
  • 0

MVP kill reward via random item with chances


rookies

Question


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.01
  • Content Count:  3
  • Reputation:   0
  • Joined:  06/16/23
  • Last Seen:  

Hello can anyone help me about MVP kill reward via random item with chances in the latest update of rathena

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.01
  • Content Count:  19
  • Reputation:   4
  • Joined:  04/18/23
  • Last Seen:  

Quote

 

//Created Date: 04/07/2022
-    script    AEOUS_MVP_DROP    FAKE_NPC,{
    end;
OnNPCKillEvent:
    .@rnd = rand(1,100);
    if( getmonsterinfo( killedrid,MOB_MVPEXP ) ) {
    for( .@i = 0; .@i < getarraysize(.item_arrays); .@i += 3 ) {
        if( .@rnd < .item_arrays[.@i+2] ) {
            getitem .item_arrays[.@i], .item_arrays[.@i+1];
            announce "Congratulations! Player "+ strcharinfo(0) +" has obtained "+ getitemname( .item_arrays[.@i] ) +" ["+ .item_arrays[.@i+1] +"] from "+ getmonsterinfo(killedrid, 0) +" (chance: "+.item_arrays[.@i+2]+"%) MVP Drop(s).",bc_all,0x00FF00;
        }
    }
    end;
}

OnInit:
//    (<structure,<item_id>,<chances>)
    setarray .item_arrays[0],
        7179,    1,    5,
        7227,    1,    25,
        7539,    1,    50;
    end;
}

 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.01
  • Content Count:  3
  • Reputation:   0
  • Joined:  06/16/23
  • Last Seen:  

3 hours ago, xJohn said:

 

Hello i tried this but i got more than 1 item everytime i kill mvp

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.01
  • Content Count:  19
  • Reputation:   4
  • Joined:  04/18/23
  • Last Seen:  

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  232
  • Reputation:   86
  • Joined:  06/30/18
  • Last Seen:  

Hello,

try this:

 

-	script	MVP_DROP	FAKE_NPC,{
    OnNPCKillEvent:
		if(!getmonsterinfo(killedrid, MOB_MVPEXP)) end;

		.@rowCount = getarraysize(.itemInfos) / .columnCount;

		for (.@i = 0; .@i < .@rowCount; .@i++) {
			.@index = .@i * .@rowCount;
			.@randIndex = rand(.@i, .@rowCount - 1) * .@rowCount;

			copyarray .tmpItemInfo[0], .itemInfos[.@randIndex], .columnCount;
			copyarray .itemInfos[.@randIndex], .itemInfos[.@index], .columnCount;
			copyarray .itemInfos[.@index], .tmpItemInfo[0], .columnCount;
		}

		for(.@i = 0; .@i < getarraysize(.itemInfos); .@i += .columnCount) {
			if(rand(1, 100) <= .itemInfos[.@i + 2]) {
				getitem .itemInfos[.@i], .itemInfos[.@i + 1];
				announce "Congratulations! Player " + strcharinfo(0) + " has obtained "+ getitemname(.itemInfos[.@i]) +" [" + .itemInfos[.@i + 1] + "] from "+ getmonsterinfo(killedrid, 0) +" (chance: " + .itemInfos[.@i + 2] + "%) MVP Drop(s).", bc_all, 0x00FF00;
				
				if(.onlyOneDrop) end;
			}
		}
    end;

    OnInit:
		// item id, item amount, item chance in %
        setarray .itemInfos[0],
		7179, 1, 5,
		7227, 1, 25,
		7539, 1, 50;

		.onlyOneDrop = true;

		.columnCount = 3;
}

 

  • Upvote 1
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...