Jump to content
  • 0
Sign in to follow this  
keough

Happy Hour - DROP and EXP Event

Question

The script runs like this

 

Quote

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"

 

Edited by keough

Share this post


Link to post
Share on other sites

11 answers to this question

Recommended Posts

  • 0

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:

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

 

Share this post


Link to post
Share on other sites
  • 0
On 10/17/2019 at 7:42 AM, Virtue said:

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?

Share this post


Link to post
Share on other sites
  • 0
Guest
16 hours ago, hadiesyafiq said:

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;

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites
  • 0
On 11/2/2019 at 9:59 PM, Ridley said:

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

Edited by hadiesyafiq

Share this post


Link to post
Share on other sites
  • 0

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;
}

 

happyhour.txt

Share this post


Link to post
Share on other sites
  • 0
3 hours ago, Ridley said:

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;
}

 

happyhour.txt 2.19 kB · 1 download

Thank you very much sir...

Share this post


Link to post
Share on other sites
  • 0

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

 

Quote

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

 

Share this post


Link to post
Share on other sites
  • 0
2 hours ago, Ridley said:

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

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.