Jump to content
  • 0

Help whit variable reset al server 00:00


EspectroW

Question

Hello, I am looking for help since I cannot find the correct logic to do the following:

 

I want to make certain player variables reset automatically when there is a change of day on the server.

 

For example, a variable called "dungeon entries" that has a value of 3. Each time the player enters the dungeon it will decrease by 1 until it reaches 0.

 

That same variable must be reset when the server time is 00:00

 

I found a way to do it but it only works if the player is online at the time of the time change, but if they are offline and log in right after the change, the variable is not reset.

 

how can I do it?

 

Thanks for the help.

 

I apologize for the English, I am using Google Translate

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0
8 hours ago, Artheios said:

Maybe by adding another variable (boolean) that is switched to true when passing on the next day (00h00). On player login verify if the boolean is on or not. If it's on, get your dungeon variable to 3 and set the boolean off.

The question would be, how to activate the variable to true. Since it is a player variable, the player will have to be online for it to be activated.

 

If it is a global variable, it will change to false with the first player who enters after 00:00 which will make it not work for the others

Link to comment
Share on other sites

  • 0

Not sure if theres a cleaner way than mine but how I did it was creating a Global Variable called "Server_Day_Count". Everytime the server time hits 00:00 i increase that global variable by 1 to mark a new day. For daily resets, you create a Player Variable called Player_Day_Count and then on Login If (Player_Day_Count < Server_Day_Count) then set (Player_Day_Count = Server_Day_Count). Then you can set any personal variables you need like dungeon entry to 3 in the same event.

 

Basically when the player logs in it will check to see if they are on the same daily reset as the server, and if not theyll catch up, be reset and then be aligned with server time again

 

Link to comment
Share on other sites

  • 0
1 hour ago, Aesthetic said:

Not sure if theres a cleaner way than mine but how I did it was creating a Global Variable called "Server_Day_Count". Everytime the server time hits 00:00 i increase that global variable by 1 to mark a new day. For daily resets, you create a Player Variable called Player_Day_Count and then on Login If (Player_Day_Count < Server_Day_Count) then set (Player_Day_Count = Server_Day_Count). Then you can set any personal variables you need like dungeon entry to 3 in the same event.

 

Basically when the player logs in it will check to see if they are on the same daily reset as the server, and if not theyll catch up, be reset and then be aligned with server time again

 

 

Sounds functional to me. I'm going to try it, how do you increase the "Server_Day_Count" variable? I mean, with a common event?

Link to comment
Share on other sites

  • 0
On 9/25/2023 at 7:27 PM, EspectroW said:

 

Sounds functional to me. I'm going to try it, how do you increase the "Server_Day_Count" variable? I mean, with a common event?

 

Yup common event with the "Variable Change" trigger and run conditions set to "Server_Time = 00:00"

Link to comment
Share on other sites

  • 0
16 hours ago, EspectroW said:

I can't get it to work :sob:

 

You may want to try creating a Time Global variable that gets stored. Its really ghetto but you can create an account that only you have access to, warp it to a special map where no one can interact with it, then use that character as an anchor for global events to ensure they go off properly and only one time. Using that character as your anchor you can increase "Server_Hour" by 1 every in game hour until it hits 24 then you reset it to 0.

 

The reason I suggest that is because Time-Based events simply don't work 99% of the time in Intersect, I'm not sure why but its been like that basically since there has been events that can reference that time. I'm sure it'll be fixed in the future, but in the meantime this bandaid works pretty nicely

Link to comment
Share on other sites

  • 0
55 minutes ago, Aesthetic said:

 

You may want to try creating a Time Global variable that gets stored. Its really ghetto but you can create an account that only you have access to, warp it to a special map where no one can interact with it, then use that character as an anchor for global events to ensure they go off properly and only one time. Using that character as your anchor you can increase "Server_Hour" by 1 every in game hour until it hits 24 then you reset it to 0.

 

The reason I suggest that is because Time-Based events simply don't work 99% of the time in Intersect, I'm not sure why but its been like that basically since there has been events that can reference that time. I'm sure it'll be fixed in the future, but in the meantime this bandaid works pretty nicely

 

 

Yes, I understand that there always has to be at least 1 user online for the events be executed correctly.

 

I think what I will do for the moment is manually increase the "Server_Day_Count" variable by giving it a value from the console.

 

It is a very rudimentary way but for now it will work for me, and I avoid having an online character that consumes resources.

 

Thank you for your help and interest

Link to comment
Share on other sites

  • 0

Other choice is using Intersect API with little console app maybe beside the server for do background task based on your timezone

 

It's possible to do this but you need to know if change work only when player is online it's because server do this individually for each user logged like this server don't use ressources for this

 

Reset variable for all characters is heavy task for server but if you do good code you can do it with api for create cron job task :)

 

(if I remember well change variable for player work for offline player but not sure) 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...