Jump to content
  • 0

Help for my Global Exp Event


Eross

Question


  • Group:  Members
  • Topic Count:  166
  • Topics Per Day:  0.09
  • Content Count:  377
  • Reputation:   12
  • Joined:  04/05/20
  • Last Seen:  

Hi guys, I need help for my ongoing scripting. 

This NPC will require players to donate zeny and reach the asking global donation target. when they reach it the server will change its rates to floating rates of EXP: 5x~8x and DROP: 1x~1.5x .. My problem here is im stuck in the initiation and timer of this script. 

This event should run for about 3 hours and every 60minutes the rates will change ... Also, there will be an announcement when the event is done. 

Your help will be well appreciated guys .. Thank You !!

valk_hall,97,92,6	script	Global Exp Amplifier#EventFloatingRates	10308,{
	mes .npc$;
	mes "Current funds collected:";
	mes "~ [^0000ff" + callfunc("F_InsertComma",$collected_funds) + "^000000] Zeny";
	mes "Target global funds:";
	mes "~ [^0000ff" + callfunc("F_InsertComma",.target_funds) + "^000000] Zeny";
	mes ""+callfunc("F_InsertComma",$donation_missing)+" more Zeny to reach target the funds.";
	next;
	switch (select("Donate Zeny", "Cancel")) {
		case 1:
			mes .npc$;
			mes "Please input your desired amount.";
			next;
			input .@donation;			
			if (.@donation < 1) {
				mes .npc$;
				mes "Input number greater than 0.";
				end;		
			}
			if (.@donation < .min_donation_zeny) {
				mes .npc$;
				mes "Minimum donation amount is "+callfunc("F_InsertComma",.min_donation_zeny)+".";
				end;		
			}
			switch(select("Change Amount:Confirm")) {
				case 1:
					.@donation = 0;
					next;
					goto Change_Amount;
					end;
				case 2:
					if (Zeny < .@donation) {
						mes .npc$;
						mes "Sorry, but you don't have enough";
						mes "zeny to donate.";
						end;
					}
					if (.@donation > $donation_missing) {
						mes .npc$;
						mes "The amount you entered will exceed on remaining balance.";
						mes "Remaining Balance: "+callfunc("F_InsertComma",$donation_missing)+" Zeny";
						mes "^ff0000*Please input exact amount next time*.";
						end;
					}	
					mes .npc$;
					mes "Zeny has been succesfully transfered.";
					Zeny -= .@donation;
					$collected_funds += .@donation;
					$donation_missing -= .@donation;	

					if ($collected_funds >= .target_funds) {
						$collected_funds = 0;	
						announce ""+.npc$+": We reached our target funds! Activating Floating Rates Event...",bc_all,0xFF6060;					
	
						donpcevent strnpcinfo(3)+"::OnStart";
					}
					end;
			}
	}
	
OnStart:


OnInit:
	.npc$ = "[Global Exp Amplifier]";
	.target_funds = 1000000;
	.min_donation_zeny = 10000;
	$donation_missing = .target_funds - $collected_funds;
							 
	
}

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  93
  • Reputation:   31
  • Joined:  11/08/15
  • Last Seen:  

prontera,193,124,6	script	Global Exp Amplifier#EventFloatingRates	10308,{

	mes "[Global Exp Amplifier]";
	mes "Current collected funds:";
	mes "~ [^0000ff" + callfunc("F_InsertComma", $collected_funds) + "^000000] Zeny";
	mes "Target global funds:";
	mes "~ [^0000ff" + callfunc("F_InsertComma", .target_funds) + "^000000] Zeny";
	mes "Still need " + callfunc("F_InsertComma", $donation_missing) + " Zeny to reach the target.";
	next;
	
	switch (select("Donate Zeny", "Cancel")) {
		case 1:
			mes "Enter the amount you want to donate:";
			next;
			input .@donation;

			// Validations
			if (.@donation < .min_donation_zeny) {
				mes "The minimum donation amount is " + callfunc("F_InsertComma", .min_donation_zeny) + " Zeny.";
				end;
			}
			if (Zeny < .@donation) {
				mes "You don't have enough Zeny.";
				end;
			}
			if (.@donation > $donation_missing) {
				mes "The amount exceeds the remaining balance.";
				mes "Remaining Balance: " + callfunc("F_InsertComma", $donation_missing) + " Zeny";
				end;
			}

			// Apply the donation
			Zeny -= .@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 3 hours.", bc_all, 0xFF6060;
				donpcevent strnpcinfo(3) + "::OnStart"; // Ensure the event is triggered
			}
			end;
	}

OnStart:
	if (.EventActive) end; // Prevent multiple activations

	// Start the event for 3 hours
	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;

OnTimer10800000: // Event ends after 3 hours (3,600,000 * 3)
	// 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, 1000000; // Target donation amount
	set .min_donation_zeny, 10000; // Minimum donation amount
	set .EventActive, 0;
	set $donation_missing, .target_funds - $collected_funds;
	end;

}

Try this. Maye it should help you.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  75
  • Reputation:   11
  • Joined:  12/16/11
  • Last Seen:  

 ?????

2 hours ago, Scanty said:
prontera,193,124,6	script	Global Exp Amplifier#EventFloatingRates	10308,{

	mes "[Global Exp Amplifier]";
	mes "Current collected funds:";
	mes "~ [^0000ff" + callfunc("F_InsertComma", $collected_funds) + "^000000] Zeny";
	mes "Target global funds:";
	mes "~ [^0000ff" + callfunc("F_InsertComma", .target_funds) + "^000000] Zeny";
	mes "Still need " + callfunc("F_InsertComma", $donation_missing) + " Zeny to reach the target.";
	next;
	
	switch (select("Donate Zeny", "Cancel")) {
		case 1:
			mes "Enter the amount you want to donate:";
			next;
			input .@donation;

			// Validations
			if (.@donation < .min_donation_zeny) {
				mes "The minimum donation amount is " + callfunc("F_InsertComma", .min_donation_zeny) + " Zeny.";
				end;
			}
			if (Zeny < .@donation) {
				mes "You don't have enough Zeny.";
				end;
			}
			if (.@donation > $donation_missing) {
				mes "The amount exceeds the remaining balance.";
				mes "Remaining Balance: " + callfunc("F_InsertComma", $donation_missing) + " Zeny";
				end;
			}

			// Apply the donation
			Zeny -= .@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 3 hours.", bc_all, 0xFF6060;
				donpcevent strnpcinfo(3) + "::OnStart"; // Ensure the event is triggered
			}
			end;
	}

OnStart:
	if (.EventActive) end; // Prevent multiple activations

	// Start the event for 3 hours
	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;

OnTimer10800000: // Event ends after 3 hours (3,600,000 * 3)
	// 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, 1000000; // Target donation amount
	set .min_donation_zeny, 10000; // Minimum donation amount
	set .EventActive, 0;
	set $donation_missing, .target_funds - $collected_funds;
	end;

}

Try this. Maye it should help you.

you have to initnpctimer every tick, or just do 1 time the timer

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  224
  • Topics Per Day:  0.14
  • Content Count:  797
  • Reputation:   12
  • Joined:  12/04/20
  • Last Seen:  

On 2/5/2025 at 6:04 AM, Scanty said:
prontera,193,124,6	script	Global Exp Amplifier#EventFloatingRates	10308,{

	mes "[Global Exp Amplifier]";
	mes "Current collected funds:";
	mes "~ [^0000ff" + callfunc("F_InsertComma", $collected_funds) + "^000000] Zeny";
	mes "Target global funds:";
	mes "~ [^0000ff" + callfunc("F_InsertComma", .target_funds) + "^000000] Zeny";
	mes "Still need " + callfunc("F_InsertComma", $donation_missing) + " Zeny to reach the target.";
	next;
	
	switch (select("Donate Zeny", "Cancel")) {
		case 1:
			mes "Enter the amount you want to donate:";
			next;
			input .@donation;

			// Validations
			if (.@donation < .min_donation_zeny) {
				mes "The minimum donation amount is " + callfunc("F_InsertComma", .min_donation_zeny) + " Zeny.";
				end;
			}
			if (Zeny < .@donation) {
				mes "You don't have enough Zeny.";
				end;
			}
			if (.@donation > $donation_missing) {
				mes "The amount exceeds the remaining balance.";
				mes "Remaining Balance: " + callfunc("F_InsertComma", $donation_missing) + " Zeny";
				end;
			}

			// Apply the donation
			Zeny -= .@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 3 hours.", bc_all, 0xFF6060;
				donpcevent strnpcinfo(3) + "::OnStart"; // Ensure the event is triggered
			}
			end;
	}

OnStart:
	if (.EventActive) end; // Prevent multiple activations

	// Start the event for 3 hours
	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;

OnTimer10800000: // Event ends after 3 hours (3,600,000 * 3)
	// 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, 1000000; // Target donation amount
	set .min_donation_zeny, 10000; // Minimum donation amount
	set .EventActive, 0;
	set $donation_missing, .target_funds - $collected_funds;
	end;

}

Try this. Maye it should help you.

hello regarding this script instead of zeny can i chaged it to item? also for everyone hour only ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  43
  • Reputation:   2
  • Joined:  08/27/13
  • Last Seen:  

12 minutes ago, Sallycantdance said:

hello regarding this script instead of zeny can i chaged it to item? also for everyone hour only ?

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;).

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  224
  • Topics Per Day:  0.14
  • Content Count:  797
  • Reputation:   12
  • Joined:  12/04/20
  • Last Seen:  

34 minutes ago, Paul said:
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;).

thank you sir

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...