Xtremist Posted November 28, 2011 Posted November 28, 2011 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. Quote
0 Brian Posted November 28, 2011 Posted November 28, 2011 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 = "+.@rates+"x Job Exp = "+.@rates+"x", bc_all,0x00FF00; } end; function getDaysOfMonth { switch (gettime(6)) { case 2: // February set .@days, isLeapYear(gettime(7)) ? 29 : 28; break; case 9: // September case 4: // April case 6: // June case 11: // November set .@days, 30; break; default: set .@days, 31; break; } return .@days; } function isLeapYear { set .@year, getarg(0); return ( .@year%4 == 0 && (.@year%100 != 0 || .@year%400 == 0) ); } } Quote
0 Mystery Posted November 28, 2011 Posted November 28, 2011 (edited) 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. Edited November 28, 2011 by Mysterious Quote
0 Xtremist Posted November 28, 2011 Author Posted November 28, 2011 (edited) Hmm, good... only thing we will have to calculate if it is a leap year or not //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 November 28, 2011 by Xtremist Quote
0 Z3R0 Posted November 28, 2011 Posted November 28, 2011 Why do you need that function in VC++ why not just do it in your NPC? Quote
0 Brian Posted November 28, 2011 Posted November 28, 2011 agreed! function isLeapYear { set .@year, getarg(0); return ( .@year%4 == 0 && (.@year%100 != 0 || .@year%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 .@days, isLeapYear(gettime(7)) ? 29 : 28; break; case 9: // September case 4: // April case 6: // June case 11: // November set .@days, 30; break; default: set .@days, 31; break; } return .@days; } function isLeapYear { set .@year, getarg(0); return ( .@year%4 == 0 && (.@year%100 != 0 || .@year%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? Quote
0 Xtremist Posted November 28, 2011 Author Posted November 28, 2011 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 Quote
Question
Xtremist
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.
6 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.