Jump to content
  • 0
Xtremist

Double exp last 3 days of the month

Question

Hey guyz,

I request for a script which will automatically calculate

if its the last 3 day of the month...using the system time...

and then just make it double exp for those 3 days.

Thank you.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Here you go:

// http://rathena.org/board/topic/53708-double-exp-last-3-days-of-the-month/

-	script	DoubleExp_Last3days	-1,{
function getDaysOfMonth;
function isLeapYear;
OnInit:
// save the "regular" rates, as defined in /conf/battle/exp.conf
set .base_exp_rate, getbattleflag("base_exp_rate");
set .job_exp_rate, getbattleflag("job_exp_rate");
OnClock0000: // every day, check if it's the last 3 days
sleep 500; // slow script execution
if (gettime(5) == 1 && 
    (getbattleflag("base_exp_rate")!=.base_exp_rate || getbattleflag("job_exp_rate")!=.job_exp_rate)) {
		// if it's the 1st of the month and rates are doubled, end the event
		setbattleflag "base_exp_rate", .base_exp_rate;
		setbattleflag "job_exp_rate",  .job_exp_rate;
		atcommand "@reloadmobdb";
		announce "[server] : the Double Exp Event has ended.", bc_blue
		announce "Current Rates:     Base Exp = "+ .base_exp_rate/100 +"x    Job Exp = "+ .job_exp_rate/100 +"x", bc_all,0x00FF00;
	}
} else if (gettime(5) > (getDaysOfMonth() -3)) {
	// start the Double Exp event
	setbattleflag "base_exp_rate", .base_exp_rate*2;
	setbattleflag "job_exp_rate",  .job_exp_rate*2;
	atcommand "@reloadmobdb";
	announce "[server] : It's the last 3 days of the month... the Double Exp Event has started!", bc_blue;
	announce "Current Rates:     Base Exp = "[email protected]+"x    Job Exp = "[email protected]+"x", bc_all,0x00FF00;
}
end;

function getDaysOfMonth {
switch (gettime(6)) {
case 2: // February
	set [email protected], isLeapYear(gettime(7)) ? 29 : 28;
	break;
case 9: // September
case 4: // April
case 6: // June
case 11: // November
	set [email protected], 30;
	break;
default:
	set [email protected], 31;
	break;
}
return [email protected];
}

function isLeapYear {
set [email protected], getarg(0);
return ( [email protected]%4 == 0 && ([email protected]%100 != 0 || [email protected]%400 == 0) );
}
}

Link to comment
Share on other sites

  • 0

Hey guyz,

I request for a script which will automatically calculate

if its the last 3 day of the month...using the system time...

and then just make it double exp for those 3 days.

Thank you.

Try using:

OnDay<month><day>:

OnDay<month><day>:

OnDay<month><day>:

For example:

OnDay1128:

OnDay1129:

OnDay1130:

<script>

OnClock<hour><minute>:

OnMinute<minute>:

OnHour<hour>:

On<weekday><hour><minute>:

OnDay<month><day>:

This will execute when the server clock hits the specified date or time. Hours and minutes are given in military time. ('0105' will mean 01:05 AM). Weekdays are Sun,Mon,Tue,Wed,Thu,Fri,Sat. Months are 01 to 12, days are 01 to 31. Remember the zero. :D

Edited by Mysterious
Link to comment
Share on other sites

  • 0

Hmm,

good... only thing we will have to calculate if it is a leap year or not :D

//checks for leap year
bool checkLeapYr(int year)
{
   return year%4 == 0 && (year %100 != 0 || year%400 == 0);
}//end function check leap year//checks for leap year

Will this function work with vc++?

or we will have to add a header file or what?

Edited by Xtremist
Link to comment
Share on other sites

  • 0

agreed!

function isLeapYear {
set [email protected], getarg(0);
return ( [email protected]%4 == 0 && ([email protected]%100 != 0 || [email protected]%400 == 0) );
}

@Xtremist: here's what I have so far

-	script	DoubleExp_Last3days	-1,{
function getDaysOfMonth;
function isLeapYear;
OnInit:
OnClock0000: // every day, check if it's the last 3 days
if (gettime(5) == 1) {
	// if it's the 1st of the month, end the event


} else if (gettime(5) >= (getDaysOfMonth() -3)) {
	// start the Double Exp event




}
end;

function getDaysOfMonth {
switch (gettime(6)) {
case 2: // February
	set [email protected], isLeapYear(gettime(7)) ? 29 : 28;
	break;
case 9: // September
case 4: // April
case 6: // June
case 11: // November
	set [email protected], 30;
	break;
default:
	set [email protected], 31;
	break;
}
return [email protected];
}

function isLeapYear {
set [email protected], getarg(0);
return ( [email protected]%4 == 0 && ([email protected]%100 != 0 || [email protected]%400 == 0) );
}
}

How do you want the Double Exp to work?

1. the script uses 'setbattleflag' then @reloadmobdb (like the /npc/custom/floating_rates.txt example)

2. OR use sc_start SC_EXPBOOST on every player?

Link to comment
Share on other sites

  • 0

How do you want the Double Exp to work?

1. the script uses 'setbattleflag' then @reloadmobdb (like the /npc/custom/floating_rates.txt example)

2. OR use sc_start SC_EXPBOOST on every player?

It would be good to see the 1st option integrated in the same script.

Thanks Brian

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

Important Information

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