prontera,193,124,6 script Global Exp Amplifier#EventFloatingRates 10308,{
mes "[Global Exp Amplifier]";
mes "Current collected items:";
mes "~ [^0000ff" + callfunc("F_InsertComma", $collected_funds) + "^000000] Items";
mes "Target global items:";
mes "~ [^0000ff" + callfunc("F_InsertComma", .target_funds) + "^000000] Items";
mes "Still need " + callfunc("F_InsertComma", $donation_missing) + " Items to reach the target.";
next;
switch (select("Donate Items", "Cancel")) {
case 1:
mes "Enter the amount you want to donate:";
next;
input .@donation;
// Validations
if (.@donation < .min_donation_items) {
mes "The minimum donation amount is " + callfunc("F_InsertComma", .min_donation_items) + " Items.";
end;
}
if (countitem(.donation_item) < .@donation) {
mes "You don't have enough items.";
end;
}
if (.@donation > $donation_missing) {
mes "The amount exceeds the remaining balance.";
mes "Remaining Balance: " + callfunc("F_InsertComma", $donation_missing) + " Items";
end;
}
// Apply the donation
delitem .donation_item, .@donation;
$collected_funds += .@donation;
$donation_missing -= .@donation;
mes "Donation successful. Thank you for your contribution!";
// Start the event if the target is reached
if ($collected_funds >= .target_funds) {
$collected_funds = 0;
announce "[Global Exp Amplifier]: Target reached! Activating Floating Rates Event for 1 hour.", bc_all, 0xFF6060;
donpcevent strnpcinfo(3) + "::OnStart"; // Ensure the event is triggered
}
end;
}
OnStart:
if (.EventActive) end; // Prevent multiple activations
// Start the event for 1 hour
set .EventActive, 1;
announce "[Floating Rates]: The event has now officially started!", bc_all, 0x00FF00;
initnpctimer; // Start the NPC timer
end;
OnTimer60000: // Every 60 minutes (60,000 milliseconds)
if (!.EventActive) end;
// Assign random rates within the specified range
set .@expRate, rand(5,8);
set .@dropRate, rand(10,15) / 10; // 1.0x - 1.5x
setbattleflag("base_exp_rate", .@expRate * 100);
setbattleflag("job_exp_rate", .@expRate * 100);
setbattleflag("item_rate_common", .@dropRate * 100);
announce "[Floating Rates]: New Rates -> EXP: " + .@expRate + "x, DROP: " + .@dropRate + "x", bc_all, 0xFFD700;
// This function is automatically repeated due to `initnpctimer`
end;
OnTimer3600000: // Event ends after 1 hour
// Reset rates to normal
setbattleflag("base_exp_rate", 100);
setbattleflag("job_exp_rate", 100);
setbattleflag("item_rate_common", 100);
announce "[Floating Rates]: The event has ended. Rates are now back to normal.", bc_all, 0xFF0000;
set .EventActive, 0;
stopnpctimer; // Stops the NPC timer system
end;
OnInit:
set .target_funds, 500; // Target donation amount (change this based on your needs)
set .min_donation_items, 5; // Minimum donation amount
set .donation_item, 501; // Example Item ID (Change to the correct one)
set .EventActive, 0;
set $donation_missing, .target_funds - $collected_funds;
end;
}
Zeny changed to an item donation (Replace 501 with the actual item ID you want).
Event lasts only 1 hour (OnTimer3600000).
Minimum donation is now in item quantity (set .min_donation_items, 5;).