Ohmyuniverse Posted March 7, 2024 Posted March 7, 2024 (edited) how to auto reset the attendance when the attendance reached the final day. thanks here's my script Quote ########################################################################### # Attendance Database ########################################################################### # # Attendance Settings # ########################################################################### # - Start Start date. # End End date. # Rewards: List of rewards for each day. # - Day Reward day. # ItemId Item ID. ########################################################################### Header: Type: ATTENDANCE_DB Version: 1 Body: - Start: 20240306 End: 20240326 Rewards: - Day: 1 ItemId: 501 - Day: 2 ItemId: 501 - Day: 3 ItemId: 501 Amount: 5 - Day: 4 ItemId: 501 Amount: 5 - Day: 5 ItemId: 501 - Day: 6 ItemId: 501 - Day: 7 ItemId: 501 Amount: 3 - Day: 8 ItemId: 501 Amount: 5 - Day: 9 ItemId: 501 Amount: 5 - Day: 10 ItemId: 501 - Day: 11 ItemId: 501 Amount: 2 - Day: 12 ItemId: 501 Amount: 3 - Day: 13 ItemId: 501 Amount: 5 - Day: 14 ItemId: 501 Amount: 5 - Day: 15 ItemId: 501 Amount: 5 - Day: 16 ItemId: 501 Amount: 5 - Day: 17 ItemId: 501 Amount: 5 - Day: 18 ItemId: 501 Amount: 5 - Day: 19 ItemId: 501 - Day: 20 ItemId: 501 Edited March 7, 2024 by Ohmyuniverse Quote
1 Sapito Sucio Posted March 7, 2024 Posted March 7, 2024 int counter = static_cast<int>(pc_readreg2( sd, ATTENDANCE_COUNT_VAR )); // Check if we have a remaining counter from a previous period if( counter >= 25 && !pc_attendance_rewarded_today(sd) ){ pc_setreg2( sd, ATTENDANCE_COUNT_VAR, 0 ); return 0; } 1 Quote
0 sfj209jfo-p Posted March 7, 2024 Posted March 7, 2024 (edited) in your script: - Start: 20240306 End: 20240326 are dates... just change the start date and a new event will start. Edited March 7, 2024 by sfj209jfo-p Quote
0 Ohmyuniverse Posted March 8, 2024 Author Posted March 8, 2024 19 hours ago, Sapito Sucio said: int counter = static_cast<int>(pc_readreg2( sd, ATTENDANCE_COUNT_VAR )); // Check if we have a remaining counter from a previous period if( counter >= 25 && !pc_attendance_rewarded_today(sd) ){ pc_setreg2( sd, ATTENDANCE_COUNT_VAR, 0 ); return 0; } where should i paste this? Quote
0 Sapito Sucio Posted March 9, 2024 Posted March 9, 2024 On 3/8/2024 at 12:16 AM, Ohmyuniverse said: where should i paste this? Search for this line in your emulator, and you will find it int counter = static_cast<int>(pc_readreg2( sd, ATTENDANCE_COUNT_VAR )); 1 Quote
0 PsyOps Posted April 11, 2024 Posted April 11, 2024 int32 pc_attendance_counter( map_session_data* sd ){ std::shared_ptr<s_attendance_period> period = pc_attendance_period(); // No running attendance period if( period == nullptr ){ return 0; } // Get the counter for the current period int counter = static_cast<int>(pc_readreg2( sd, ATTENDANCE_COUNT_VAR )); + // Check if we have a remaining counter from a previous period + if( counter >= 20 && !pc_attendance_rewarded_today(sd) ){ + pc_setreg2( sd, ATTENDANCE_COUNT_VAR, 0 ); + return 0; + } // Check if we have a remaining counter from a previous period if( counter > 0 && pc_readreg2( sd, ATTENDANCE_DATE_VAR ) < period->start ){ // Reset the counter to zero pc_setreg2( sd, ATTENDANCE_COUNT_VAR, 0 ); return 0; } return 10 * counter + ( ( pc_attendance_rewarded_today(sd) ) ? 1 : 0 ); } I think this is what @Sapito Sucio is trying to tell you to do. Though you have to really understand that attendance forces players to login/attend. On the days you want them active. It would be best if you just use a daily reward script for the purpose of resetting your daily rewards. 1 Quote
0 Speedrun Posted April 11, 2024 Posted April 11, 2024 1 hour ago, PsyOps said: int32 pc_attendance_counter( map_session_data* sd ){ std::shared_ptr<s_attendance_period> period = pc_attendance_period(); // No running attendance period if( period == nullptr ){ return 0; } // Get the counter for the current period int counter = static_cast<int>(pc_readreg2( sd, ATTENDANCE_COUNT_VAR )); + // Check if we have a remaining counter from a previous period + if( counter >= 20 && !pc_attendance_rewarded_today(sd) ){ + pc_setreg2( sd, ATTENDANCE_COUNT_VAR, 0 ); + return 0; + } // Check if we have a remaining counter from a previous period if( counter > 0 && pc_readreg2( sd, ATTENDANCE_DATE_VAR ) < period->start ){ // Reset the counter to zero pc_setreg2( sd, ATTENDANCE_COUNT_VAR, 0 ); return 0; } return 10 * counter + ( ( pc_attendance_rewarded_today(sd) ) ? 1 : 0 ); } I think this is what @Sapito Sucio is trying to tell you to do. Though you have to really understand that attendance forces players to login/attend. On the days you want them active. It would be best if you just use a daily reward script for the purpose of resetting your daily rewards. @PsyOps and @Sapito Sucio you are the best!!! 1 Quote
Question
Ohmyuniverse
how to auto reset the attendance when the attendance reached the final day. thanks
here's my script
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.