Happy Hour - DROP and EXP Event

keough

New member
Messages
173
Points
0
Emulator
The script runs like this

Default BASE and JOB EXP is 7x = 700
Default DROP RATE is 3x = 300

Happy Hour Starts
Only Available on Monday to Thursday

It will start on certain time
9:00AM to 11:00AM
3:00PM to 5:00PM
8:00PM to 10:00PM
Bonus Base and EXP Rates will be 10x = 10000
Bonus Drop Rate will be x5 = 500

It will announce when it start and when it ends

Start
"Happy Hour has been started! Current rates: BASE - 10x | JOB - 10x | DROP - 5x"

End
"Happy Hour is over! Current rates: BASE - 7x | JOB - 7x | DROP - 3x"

 
Last edited by a moderator:
There's one included in Herc. 

\npc\custom\etc\floating_rates

just set it up to your preferred time.

OnInit:
//add any other HOURS
OnHour00:
OnHour06:
OnHour12:
OnHour18:


Then the rates here:

Code:
//-------------------
	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
 
There's one included in Herc. 

\npc\custom\etc\floating_rates

just set it up to your preferred time.

OnInit:
//add any other HOURS
OnHour00:
OnHour06:
OnHour12:
OnHour18:

OnInit:
//add any other HOURS
OnHour00:
OnHour06:
OnHour12:
OnHour18:


Then the rates here:

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

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

And how to add the announcement when the floating rate event start and end?

 
And how to add the announcement when the floating rate event start and end?
//Base exp
setbattleflag("base_exp_rate",$@brate);



After setbattleflag just use this with your message    

announce "[Floating EXP]: Event has started;

 
This script changes the rates random at a specific time. If you want it as some kind of event, it would be good to know your basic rates, the rates you want to take effect during the event, how long the event should take and when it should start (everyday? Only on specific dates,...)

The more info you provide, the easier it is to help.

 
This script changes the rates random at a specific time. If you want it as some kind of event, it would be good to know your basic rates, the rates you want to take effect during the event, how long the event should take and when it should start (everyday? Only on specific dates,...)

The more info you provide, the easier it is to help.
Ya everyday sir...9am to 11am...when event start server will announce and event end also server announce..

normal rates 25x

when happy hour it will be 50x like that

 
Last edited by a moderator:
I try to explain it on this custom script. You have several options to customize it. Please read the comments. Also added @happy and @endhappy. Duration is always 2 hours. Card rates are not affected by this.

Be aware this script won't work if loaded with @loadnpc. It needs to start with your server.

- script Happy Hour FAKE_NPC,{

OnInit: // fetch your basic rates on server start
bindatcmd("happy", strnpcinfo(0) +"::OnAtcommand", 93, 99);
bindatcmd("endhappy", strnpcinfo(0) +"::OnAtcommand2", 93, 99);

// BaseExp
.base_exp_rate = getbattleflag("base_exp_rate");
// JobExp
.job_exp_rate = getbattleflag("job_exp_rate");
// Drops
.item_rate_common = getbattleflag("item_rate_common");
.item_rate_heal = getbattleflag("item_rate_heal");
.item_rate_use = getbattleflag("item_rate_use");
.item_rate_equip = getbattleflag("item_rate_equip");
end;

OnAtcommand:
OnClock0900: // you can add more times to trigger using https://github.com/HerculesWS/Hercules/blob/857650c4f58d347455b0d075b49a53f69e6d0c51/doc/script_commands.txt#L1013
//OnWed1500: // would start at Wednesday, 3pm server time
announce("Happy Hour has started!", bc_blue|bc_all); // Announce Happy Hour
callsub(L_rate, 2); // L_rate, 2 = your basic rate *2, L_rate,3 = your basic rate *3. You said basic is 25 and you want happy hour to be 50. So 25*2 = 50x rates
end;

OnAtcommand2:
OnTimer7200000: // When the Timer from line 49 reaches 7200000ms (2 hours) reset the rates to 1x
stopnpctimer(); // stop the timer
announce("Happy Hour has ended!", bc_blue|bc_all); // Announce Happy Hour
callsub(L_rate, 1); // L_rate, 25*1 = 25x
end;

L_rate:
.@rate = getarg(0);
.@base_exp_rate = (.@rate * .base_exp_rate);
.@job_exp_rate = (.@rate * .job_exp_rate);
.@item_rate_common = (.@rate * .item_rate_common);
.@item_rate_heal = (.@rate * .item_rate_heal);
.@item_rate_use = (.@rate * .item_rate_use);
.@item_rate_equip = (.@rate * .item_rate_equip);

setbattleflag("base_exp_rate",.@base_exp_rate);
setbattleflag("job_exp_rate",.@job_exp_rate);
setbattleflag("item_rate_common",.@item_rate_common);
setbattleflag("item_rate_heal",.@item_rate_heal);
setbattleflag("item_rate_use",.@item_rate_use);
setbattleflag("item_rate_equip",.@item_rate_equip);

atcommand("@reloadmobdb");
initnpctimer(); // start the timer
announce(sprintf("Current rates are: Base %dx, Job %dx, Drop %dx.", (.@base_exp_rate/100), (.@job_exp_rate/100), (.@item_rate_common/100)), bc_blue|bc_all); // Announce the rates
end;
}




View attachment happyhour.txt

 
Last edited by a moderator:
I try to explain it on this custom script. You have several options to customize it. Please read the comments. Also added @happy and @endhappy. Duration is always 2 hours. Card rates are not affected by this.

Be aware this script won't work if loaded with @loadnpc. It needs to start with your server.

- script Happy Hour FAKE_NPC,{

OnInit: // fetch your basic rates on server start
bindatcmd("happy", strnpcinfo(0) +"::OnAtcommand", 93, 99);
bindatcmd("endhappy", strnpcinfo(0) +"::OnAtcommand2", 93, 99);

// BaseExp
.base_exp_rate = getbattleflag("base_exp_rate");
// JobExp
.job_exp_rate = getbattleflag("job_exp_rate");
// Drops
.item_rate_common = getbattleflag("item_rate_common");
.item_rate_heal = getbattleflag("item_rate_heal");
.item_rate_use = getbattleflag("item_rate_use");
.item_rate_equip = getbattleflag("item_rate_equip");
end;

OnAtcommand:
OnClock0900: // you can add more times to trigger using https://github.com/HerculesWS/Hercules/blob/857650c4f58d347455b0d075b49a53f69e6d0c51/doc/script_commands.txt#L1013
//OnWed1500: // would start at Wednesday, 3pm server time
announce("Happy Hour has started!", bc_blue|bc_all); // Announce Happy Hour
callsub(L_rate, 2); // L_rate, 2 = your basic rate *2, L_rate,3 = your basic rate *3. You said basic is 25 and you want happy hour to be 50. So 25*2 = 50x rates
end;

OnAtcommand2:
OnTimer7200000: // When the Timer from line 49 reaches 7200000ms (2 hours) reset the rates to 1x
stopnpctimer(); // stop the timer
announce("Happy Hour has ended!", bc_blue|bc_all); // Announce Happy Hour
callsub(L_rate, 1); // L_rate, 25*1 = 25x
end;

L_rate:
.@rate = getarg(0);
.@base_exp_rate = (.@rate * .base_exp_rate);
.@job_exp_rate = (.@rate * .job_exp_rate);
.@item_rate_common = (.@rate * .item_rate_common);
.@item_rate_heal = (.@rate * .item_rate_heal);
.@item_rate_use = (.@rate * .item_rate_use);
.@item_rate_equip = (.@rate * .item_rate_equip);

setbattleflag("base_exp_rate",.@base_exp_rate);
setbattleflag("job_exp_rate",.@job_exp_rate);
setbattleflag("item_rate_common",.@item_rate_common);
setbattleflag("item_rate_heal",.@item_rate_heal);
setbattleflag("item_rate_use",.@item_rate_use);
setbattleflag("item_rate_equip",.@item_rate_equip);

atcommand("@reloadmobdb");
initnpctimer(); // start the timer
announce(sprintf("Current rates are: Base %dx, Job %dx, Drop %dx.", (.@base_exp_rate/100), (.@job_exp_rate/100), (.@item_rate_common/100)), bc_blue|bc_all); // Announce the rates
end;
}




View attachment 5512
Thank you very much sir...

 
Sir @Ridley it possible if i make it 2 times?i mean happy hour 2 times daily...morning 9am-11am and 9pm-11pm weekdays and for weekends 24hours happy hour(Saturday and sunday)

 
If you had read this script, you would have seen the instructions and examples for times

Code:
[COLOR=#000000]OnClock0900[/COLOR]:	// you can add more times to trigger using https://github.com/HerculesWS/Hercules/blob/857650c4f58d347455b0d075b49a53f69e6d0c51/doc/script_commands.txt#L1013
//OnWed1500:	// would start at Wednesday, 3pm server time

 
If you had read this script, you would have seen the instructions and examples for times
yes i follow your guide and use your script i set 2

onClock0900:

onClock2100:

but sometimes it will start on random times and not the script setting..

 
Back
Top