Jump to content

Tutorial - Event activated by date.


Weylon Santana

Recommended Posts

Hello guys, I came to present a simple tutorial that I haven't seen in other tutorials about the intersect and that I use my game a lot. Running events at the exact time, or the exact day. The usefulness of this system serves as a basis for more complex systems that you want to make, such as daily prize for the player, giving or withdrawing vip ingame with exact date and time, home system (rent, take the player's house when renting end ..) and etc.

 

For this system we will need 1 variable (preferably global) and 1 common event. Only that.

be4d5618a11cd6500ec2a71592d8c91b.png

 

I call GBtime to remember Global Time. Call your variable as you like.

 

For the common event use...

229d78e5644459a43b3943d24f622c1f.png

fe99e074c7861e88f2290d911f9bb728.png

93151c3c67dd6558019281b3c3293861.png

 

And ready. End of system. Use as you wish

 

hahaha kidding, this is the center of everything. Now I'm going to show you how you can activate any event at exactly the right time. Everything is done with the condition of comparing variables. If you are experienced, you know how it works.

 

One shot trigger.

Spoiler

Requirements:

 

You will need 2 variable. It must be global, at the end you will understand why.

One variable will be integer and the other will be boolean.

efacf8f15c809e57dfe74a93ef34bae4.png

 

1 - In the Event [which can be on the map or common event], place the condition:

If (your variable) is less than (GBtime)

2ba9f0783e655bc27c2538651497816d.png

 

2 - In this area you will insert all the commands you want

5bc88d1908e31283807828e199732c6e.png

 

and at the end you will insert the command
set (boolean variable) to true.

16435d8f960d3373412099baafc7eb53.png

 

3 - Finally create a new page, and place the condition:
if (its boolean variable) is true.

4297915ed6e7c7025342725bf7f899cc.png

96f7187517f00640eb4aadbec0437c8b.png

 

All your actions will be carried out and the event will come to a standstill. Of course, this will be something for all players. 

 

If you want something more specific for someone, put more conditions
Class is X
Player variable is X
The player has X item
There are several conditions and combination of conditions that you can specify.

 

Return to the variable editor and enter the exact date and time when you want the event to run at the variable value.

(look at the end of the tutorial to learn how)

f7fca8a47ec455b6ad74e4e266d8bba1.png

 

 

Auto Trigger (periodic events)

Spoiler

Requirements:
You will not need the global boolean variable only the integer global variable.

 

Repeat steps 1 and 2 above.

Only this time, you will not use the boolean variable but will use the same variable, using the command, '' add '' to add a specific value.

 

3bc1dac9def6d3c449d82203b5c1cd8f.png

3143f70cbfe8e301070c59a9a4fa179c.png

 

The logic here is simple. The event will always be activated in the same time interval defined for you.

 

Remember that to activate the event you must enter the date and time.

(look at the end of the tutorial to learn how)

f7fca8a47ec455b6ad74e4e266d8bba1.png

 

How to add the date and time.

Spoiler

There, the most important part. To add date and time is simple. But you must understand something.

1 - The time used by this intersect's time system is in timestamp, which ignores game time if your game uses more advanced time to simulate several days that is configured in the time editor.

2 - The time taken into account is the machine time. If you change the time of the machine, change the time in timestamp used in that system.

 

Okay, come on.

1 - First use a timestamp converter (ask to "father of all": google)

I use this: https://timestamp.online/

 

2 - Set date and time

0b40efa4124ae99c7a188ba1b82a82c9.png

 

3 - Copy this value and paste it into the variable value.

39325a82f2fde32913125fa02be2e845.png

 

VERY IMPORTANT NOTE: The intersect uses time in ms, this site gives the time in s, that is, you must add 3 times the number 0 in the variable value.

 

533fd2a85ae6a151824231f77fc8c426.png

 

If you want, look in father of all, for a converter that already responds in ms.

 

When setting dates, always put the date in future of the current time and take a 5 minute break.

For example, now it is 10:30 AM, if I were to put a date I would put 10:35 AM for today.

 

If you have doubts you can send that I will try to answer, as well as better ideas and etc. Maybe later on, when I stop being lazy, present my periodic dungeon system (like the one that many people want to use) as a tutorial, to provide the basis for other future systems, which will contribute a lot to the growth of the intersect.

 

I made a video showing everything working.

https://reccloud.com/u/gj9swqy

If the video is crashing, take my 2 GB of ram with discord, chrome, server, editor and open client into account.

Link to comment
Share on other sites

I am terribly scared that such exceptional and useful content has not yet been commented on and its reach is not the highest.
After all, this is of unprecedented importance.
Dear Weylon, congratulations. I come here first of all to congratulate you for your incredible action in making this magnificent tutorial available!

 

[PT-BR]

Estou terrivelmente assustado como um conteúdo tão excepcional e útil ainda não foi comentado e seu alcance não é dos mais altos.
Afinal, isto é de uma importância sem precedentes.
Querido Weylon, parabéns. Venho aqui antes de tudo parabenizar sua incrível ação em disponibilizar este tutorial magnífico!

 

Link to comment
Share on other sites

This is a very impressive system and works in a similar fashion to my day tracker I made a while back (Post for some reason can't be found o.O)
It has ONE inherent flaw from using the Event system, for the Common Events to trigger there has to be at LEAST one player online at any time for this to work, but other than that, GREAT work buddy :)
 

Link to comment
Share on other sites

5 hours ago, BabyLoves said:

I am terribly scared that such exceptional and useful content has not yet been commented on and its reach is not the highest.
After all, this is of unprecedented importance.
Dear Weylon, congratulations. I come here first of all to congratulate you for your incredible action in making this magnificent tutorial available!

 

[PT-BR]

Estou terrivelmente assustado como um conteúdo tão excepcional e útil ainda não foi comentado e seu alcance não é dos mais altos.
Afinal, isto é de uma importância sem precedentes.
Querido Weylon, parabéns. Venho aqui antes de tudo parabenizar sua incrível ação em disponibilizar este tutorial magnífico!

 

hahahahah thank you very much, I feel awkward like that.

[hahahahah muito obrigado, eu fico sem jeito assim]

 

2 hours ago, AisenArvalis said:

This is a very impressive system and works in a similar fashion to my day tracker I made a while back (Post for some reason can't be found o.O)
It has ONE inherent flaw from using the Event system, for the Common Events to trigger there has to be at LEAST one player online at any time for this to work, but other than that, GREAT work buddy :)
 

I know that. In fact, all event systems only work if you have an online player. I did not mention this because it is something more advanced and complicated, those who already move and manipulate the intersect would know that it only works with at least one online player.
In addition to your comment, I can say that php scripts are able to change and update variables even offline. But I don't know about it so I didn't bring it to this tutorial.
One last thing. The autotrigger, self-regulates itself when a player enters. For example, you have an event that happens every 2 hrs and is 2 days without entering, when you enter it will be adding every 2 hours until the time is greater than gb. Happening even at times determined by you. Which is cool. But thank you very much for your note.

Link to comment
Share on other sites

  • 8 months later...
  • 7 months later...

Thank you for the thread. I just needed to read it to figure out how I could create a Daily Reward System / Claim Items After x Time System. 

 

Global Variable (int): "Server Timestamp" = 0

Player Variable (int): "Next Claimable Timestamp" = 0

 

Autorun ->

"Server Timestamp" = Server Time (ms)

 

If player claims daily reward ->

"Next Claimable Timestamp" = "Server Timestamp"

"Next Claimable Timestamp" + 86,400,000

 

If "Next Claimable Timestamp" is less than "Server Timestamp" ->

player can claim reward again

 

:)

Link to comment
Share on other sites

@izakt Until now, I would say this topic is a bit outdated, currently you can't use an autorun event as explained above, because that will make your server not support more than 3-5 players online. An autorun event cannot exist without a condition (and a good reason too).
Finding a way to constantly update the Server Timestamp variable value without autorun is currently a problem.

But for a Daily Reward System, no problems
 

This is correct:

9 hours ago, izakt said:

Global Variable (int): "Server Timestamp" = 0

Player Variable (int): "Next Claimable Timestamp" = 0

And this also:

9 hours ago, izakt said:

If player claims daily reward ->

"Next Claimable Timestamp" = "Server Timestamp"

"Next Claimable Timestamp" + 86,400,000

 

If "Next Claimable Timestamp" is less than "Server Timestamp" ->

player can claim reward again

 

The changes I suggest are:

 

1 - If player claims daily reward ->

"Server Timestamp" = Server Time (ms)
"Next Claimable Timestamp" = Server Time (ms) (not = var int value)

"Next Claimable Timestamp" + 86,400,000

 

2 -  Commom event  with "On login" trigger without conditions

"Server Timestamp" = Server Time (ms)
If "Next Claimable Timestamp" is less than "Server Timestamp" ->
player can claim reward again

 

Did you get the idea?

 

So far I haven't found a good way to keep the Server Timestamp variable constantly updated, so I'm using this command -> "Server Timestamp" = Server Time (ms) <- in all player interactions with events (on respawn, on teleport, on login, on equip, on pvp kill/death, etc), to keep the value updated without weighing on server performance. Even if the event does something simple, like teleport the player when he dies, I update the value before.

 

If you have any questions, feel free to express them.

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