There is getunitdata to retrieve x y for monster. Sample untested :
- script CustomDrop FAKE_NPC,{
function add_drop;
OnNPCKillEvent:
if (!playerattached())
end;
.@mob_id = killedrid;
.@size = getd(".size_" + .@mob_id);
if (.@size < 1)
end;
getunitdata killedgid, .@v;
.@x = .@v[UMOB_X];
.@y = .@v[UMOB_Y];
.@map$ = strcharinfo(3);
for (.@i = 0; .@i < .@size; .@i++) {
.@chance = getd(".chance_" + .@mob_id + "[" + .@i + "]");
if (rand(10000) < .@chance) {
.@id = getd(".item_id_" + .@mob_id + "[" + .@i + "]");
.@amt = getd(".item_amount_" + .@mob_id + "[" + .@i + "]");
while (.@amt > 0) {
makeitem .@id, 1, .@map$, .@x, .@y;
.@amt--;
}
}
}
end;
OnInit:
// <mob_id>, <item_id>, <item_amount>, <chance>
// Chance ========================
// 10000 = 100%
// 1000 = 10%
// 100 = 1%
// 99 = 0.99%
// 50 = 0.50%
// 1 = 0.01%
// ===============================
add_drop( 1002, 607, 2, 10000 ); // poring will drop 2 ygg berries on the floor with 100% chance
add_drop( 1002, 608, 3, 10000 ); // poring will drop 3 ygg seeds on the floor with 100% chance
end;
function add_drop {
.@arg_count = getargcount();
if (.@arg_count % 4)
return;
for (.@i = 0; .@i < .@arg_count; .@i += 4) {
.@mob_id = getarg(.@i);
.@size = getd(".size_" + .@mob_id);
setd ".item_id_" + .@mob_id + "[" + .@size + "]", getarg(.@i+1); // <item_id>
setd ".item_amount_" + .@mob_id + "[" + .@size + "]", getarg(.@i+2); // <item_amount>
setd ".chance_" + .@mob_id + "[" + .@size + "]", getarg(.@i+3); // <chance>
setd ".size_" + .@mob_id, .@size + 1;
}
return;
}
}