rookies Posted June 17, 2023 Posted June 17, 2023 Hello can anyone help me about MVP kill reward via random item with chances in the latest update of rathena Quote
0 xJohn Posted June 19, 2023 Posted June 19, 2023 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; } Quote
0 rookies Posted June 19, 2023 Author Posted June 19, 2023 3 hours ago, xJohn said: Hello i tried this but i got more than 1 item everytime i kill mvp Quote
0 Winterfox Posted June 19, 2023 Posted June 19, 2023 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; } 1 Quote
Question
rookies
Hello can anyone help me about MVP kill reward via random item with chances in the latest update of rathena
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.