[💭​​​​​​​​​​​​​​] Another Floating Rates request

norightinfo

New member
Messages
12
Points
0
Hi,

I just started using Hercules and understand how it works. currently, I am trying to modify the included floating_rates script.

- script FloatingRates FAKE_NPC,{
OnInit:
//add any other HOURS
OnHour03:
OnHour05:
OnHour12:
OnHour18:
//-------------------
set $@brate,rand(100,150);
set $@jrate,rand(100,150);
set $@drate,rand(100,150);
//Base exp
setbattleflag("base_exp_rate",$@brate);
//Job exp
setbattleflag("job_exp_rate",$@jrate);
//Drops
setbattleflag("item_rate_common",$@drate);
setbattleflag("item_rate_heal",$@drate);
setbattleflag("item_rate_use",$@drate);
setbattleflag("item_rate_equip",$@drate);
//we don't change card drops rate, because these values won't change them anyway
atcommand "@reloadmobdb";

announce "Current Rune-Midgard rates are: 1."+($@brate-100)+"x 1."+($@jrate-100)+"x 1."+($@drate-100)+"x",bc_all,0xFF6060;
end;
}


So basically, I just want it to activate everyday,
let's say a certain time during the day:
example:
- start at 1AM 
- ends at 3AM
then start again at 9AM ends at 11AM, however between those times it will return to the server experience rate
example: server rate is 5x/5x/3x (base/job/drops)
then during floating rate hours it will be go a total of 10x/10x/4x

in addition, once it starts it announce, once it ends it also announce.

I tried looking up to different floating_rates request, however I am unable to understand much.
I really appreciate if anyone can enlighten me on this.
 

 
Last edited by a moderator:
Just create 2 separate scripts (see sample below). 

Code:
-	script	FloatingRatesStarter	FAKE_NPC,{
OnInit:
//add any other HOURS
OnHour01:
//-------------------
	set $@brate,rand(100,150);
	set $@jrate,rand(100,150);
	set $@drate,rand(100,150);
	//Base exp
	setbattleflag("base_exp_rate",$@brate);
	//Job exp
	setbattleflag("job_exp_rate",$@jrate);
	//Drops
	setbattleflag("item_rate_common",$@drate);
	setbattleflag("item_rate_heal",$@drate);
	setbattleflag("item_rate_use",$@drate);
	setbattleflag("item_rate_equip",$@drate);
	//we don't change card drops rate, because these values won't change them anyway
	atcommand "@reloadmobdb";

	announce "Current Rune-Midgard rates are: 1."+($@brate-100)+"x 1."+($@jrate-100)+"x 1."+($@drate-100)+"x",bc_all,0xFF6060;
	end;
}

-	script	FloatingRatesEnder	FAKE_NPC,{
OnInit:
//add any other HOURS
OnHour03:
//-------------------
	set $@brate,100;
	set $@jrate,100;
	set $@drate,100;
	//Base exp
	setbattleflag("base_exp_rate",$@brate);
	//Job exp
	setbattleflag("job_exp_rate",$@jrate);
	//Drops
	setbattleflag("item_rate_common",$@drate);
	setbattleflag("item_rate_heal",$@drate);
	setbattleflag("item_rate_use",$@drate);
	setbattleflag("item_rate_equip",$@drate);
	//we don't change card drops rate, because these values won't change them anyway
	atcommand "@reloadmobdb";

	announce "Current Rune-Midgard rates are back to normal!",bc_all,0xFF6060;
	end;
}
 
I think there are easier things with gettimetick (2) and doing one script than doing two separate scripts. But it's true that to make a script like this for a new one it's a little harder than doing two simplified like you did.

 
Hi @Neffletics ok I did try your code, however the script starts directly. Even if it wasn't the desired time yet.

image.png

Here's the script:

Code:
-	script	FloatingRatesStart	FAKE_NPC,{
OnInit:
//add HOURS for starting
OnHour03:
OnHour09:
OnHour15:
OnHour21:
//-------------------
	set $@brate,1000;
	set $@jrate,1000;
	set $@drate,500;
	//Base exp
	setbattleflag("base_exp_rate",$@brate);
	//Job exp
	setbattleflag("job_exp_rate",$@jrate);
	//Drops
	setbattleflag("item_rate_common",$@drate);
	setbattleflag("item_rate_heal",$@drate);
	setbattleflag("item_rate_use",$@drate);
	setbattleflag("item_rate_equip",$@drate);
	//we don't change card drops rate, because these values won't change them anyway
	atcommand "@reloadmobdb";

	announce "The Floating rates has started, rates are: 10x 10x 5x",bc_all,0xFF6060;
	end;
}

-	script	FloatingRatesEnd	FAKE_NPC,{
OnInit:
//add HOUR for ending
OnHour05:
OnHour12:
OnHour17:
OnHour23:
//-------------------
	set $@brate,500;
	set $@jrate,500;
	set $@drate,300;
	//Base exp
	setbattleflag("base_exp_rate",$@brate);
	//Job exp
	setbattleflag("job_exp_rate",$@jrate);
	//Drops
	setbattleflag("item_rate_common",$@drate);
	setbattleflag("item_rate_heal",$@drate);
	setbattleflag("item_rate_use",$@drate);
	setbattleflag("item_rate_equip",$@drate);
	//we don't change card drops rate, because these values won't change them anyway
	atcommand "@reloadmobdb";

	announce "The Floating rates has ended, rates are back to normal!",bc_all,0xFF6060;
	end;
}
 
Hi @Neffletics ok I did try your code, however the script starts directly. Even if it wasn't the desired time yet.

View attachment 6754

Here's the script:

- script FloatingRatesStart FAKE_NPC,{
OnInit:
//add HOURS for starting
OnHour03:
OnHour09:
OnHour15:
OnHour21:
//-------------------
set $@brate,1000;
set $@jrate,1000;
set $@drate,500;
//Base exp
setbattleflag("base_exp_rate",$@brate);
//Job exp
setbattleflag("job_exp_rate",$@jrate);
//Drops
setbattleflag("item_rate_common",$@drate);
setbattleflag("item_rate_heal",$@drate);
setbattleflag("item_rate_use",$@drate);
setbattleflag("item_rate_equip",$@drate);
//we don't change card drops rate, because these values won't change them anyway
atcommand "@reloadmobdb";

announce "The Floating rates has started, rates are: 10x 10x 5x",bc_all,0xFF6060;
end;
}

- script FloatingRatesEnd FAKE_NPC,{
OnInit:
//add HOUR for ending
OnHour05:
OnHour12:
OnHour17:
OnHour23:
//-------------------
set $@brate,500;
set $@jrate,500;
set $@drate,300;
//Base exp
setbattleflag("base_exp_rate",$@brate);
//Job exp
setbattleflag("job_exp_rate",$@jrate);
//Drops
setbattleflag("item_rate_common",$@drate);
setbattleflag("item_rate_heal",$@drate);
setbattleflag("item_rate_use",$@drate);
setbattleflag("item_rate_equip",$@drate);
//we don't change card drops rate, because these values won't change them anyway
atcommand "@reloadmobdb";

announce "The Floating rates has ended, rates are back to normal!",bc_all,0xFF6060;
end;
}

- script FloatingRatesStart FAKE_NPC,{
OnInit:
//add HOURS for starting
OnHour03:
OnHour09:
OnHour15:
OnHour21:
//-------------------
set $@brate,1000;
set $@jrate,1000;
set $@drate,500;
//Base exp
setbattleflag("base_exp_rate",$@brate);
//Job exp
setbattleflag("job_exp_rate",$@jrate);
//Drops
setbattleflag("item_rate_common",$@drate);
setbattleflag("item_rate_heal",$@drate);
setbattleflag("item_rate_use",$@drate);
setbattleflag("item_rate_equip",$@drate);
//we don't change card drops rate, because these values won't change them anyway
atcommand "@reloadmobdb";

announce "The Floating rates has started, rates are: 10x 10x 5x",bc_all,0xFF6060;
end;
}

- script FloatingRatesEnd FAKE_NPC,{
OnInit:
//add HOUR for ending
OnHour05:
OnHour12:
OnHour17:
OnHour23:
//-------------------
set $@brate,500;
set $@jrate,500;
set $@drate,300;
//Base exp
setbattleflag("base_exp_rate",$@brate);
//Job exp
setbattleflag("job_exp_rate",$@jrate);
//Drops
setbattleflag("item_rate_common",$@drate);
setbattleflag("item_rate_heal",$@drate);
setbattleflag("item_rate_use",$@drate);
setbattleflag("item_rate_equip",$@drate);
//we don't change card drops rate, because these values won't change them anyway
atcommand "@reloadmobdb";

announce "The Floating rates has ended, rates are back to normal!",bc_all,0xFF6060;
end;
}

just removed OnInit: 

This will solved the auto start.

 
Oops. Sorry, I overlooked the OnInit part. Yeah, please remove it.

OnInit - Gets triggered as soon as you start the server or whenever you reload scripts.

Alternatively, you can follow @Daraen's recommendation to simplify or shorten your script once you get more knowledge about scripting. But for the time being, you can follow my script and remove the OnInit before OnHour.

 
Hi~

Okay so the script works and I have been checking on this for awhile, However I notice something.
Everytime I close the emulator and re-run it again, the floating rates resets back to the server exp setup.
Example:
at 3PM, the floating rates starts with the adjusted experience set, however at around 3PM and 4minutes (3:04pm) I closed the emulator to like apply some other npc.
when I restarted the emulator, and check the rates it adjusted back to the original server experience., How do I improved on this? I tried checking the gettimetick function but can't seem to make it work.
I tried to apply something like:

if(gettimetick(GETTIME_HOUR) >= 15  && gettimetick(GETTIME_HOUR) < 18)
as I understand 15 = 3PM / 18 = 6pm so like 17 would be 5pm (since I want it to work from 3PM to 5PM)

But I don't know if I am on the correct path.

 
Hi so I have been testing the floating rates, and tried the gettimetick(); function, however it seems that it goes straight to else and I can't seem to figure out the logic issue

Here's my code:
 

Code:
-	script	FloatingRatesStart	FAKE_NPC,{
OnInit:
//add HOURS for starting
OnClock0300:
OnClock0900:
OnClock1500:
OnClock2100:
//-------------------
	if((gettimetick(GETTIME_HOUR) >= 15 && gettimetick(GETTIME_HOUR) < 18) ||  (gettimetick(GETTIME_HOUR) >= 21 && gettimetick(GETTIME_HOUR) < 24) || (gettimetick(GETTIME_HOUR) >= 3 && gettimetick(GETTIME_HOUR) < 6)) {
		set $@brate,1000;
		set $@jrate,1000;
		set $@drate,500;
		//Base exp
		setbattleflag("base_exp_rate",$@brate);
		//Job exp
		setbattleflag("job_exp_rate",$@jrate);
		//Drops
		setbattleflag("item_rate_common",$@drate);
		setbattleflag("item_rate_heal",$@drate);
		setbattleflag("item_rate_use",$@drate);
		setbattleflag("item_rate_equip",$@drate);
		//we don't change card drops rate, because these values won't change them anyway
		atcommand "@reloadmobdb";

		announce "The floatings rates has started, rates are: 10x 10x 5x",bc_all,0xFF6060;
		end;
	}
	else {
		set $@brate,500;
		set $@jrate,500;
		set $@drate,300;
		//Base exp
		setbattleflag("base_exp_rate",$@brate);
		//Job exp
		setbattleflag("job_exp_rate",$@jrate);
		//Drops
		setbattleflag("item_rate_common",$@drate);
		setbattleflag("item_rate_heal",$@drate);
		setbattleflag("item_rate_use",$@drate);
		setbattleflag("item_rate_equip",$@drate);
		//we don't change card drops rate, because these values won't change them anyway
		atcommand "@reloadmobdb";

		announce "The floating rates has ended, rates are back to normal!",bc_all,0xFF6060;
		end;
	}
}
 
Back
Top