Jump to content
Methz

Specific time to open portal

Recommended Posts

Hello, can you help me?

 

I want to open two maps, one in even hours, the other in odd hours.

For example, Chaos Argent at 2, 4, 6 hours, and Arena at 1, 3, 5 hours.My goal is not to let these maps open at the same time.

If I put one to open every 2 hours, and another in 3, at some point they will open up together, and I don't want this. Any idea?

 

Thanks in advance.


“So the problem is not so much to see what nobody has yet seen, as to think what nobody has yet thought concerning that which everybody sees.”


― Arthur Schopenhauer

Share this post


Link to post
Share on other sites
15 minutes ago, Methz said:

If I put one to open every 2 hours, and another in 3, at some point they will open up together, and I don't want this. Any idea?

"x" map opens: 0,3,6,9,12,15,18,21,23

"y" map opens: 0,2,4,6,8,10,12,14,16,18,20,22

 

Hours of collision: 0,6,12,18

 

Your question is unclear.

1) You can make "x" map open every 2 hours and on odd hours.

2) You can make "y" map open every 3 hours but 1 hour ahead/before "x" opening interval {1,4,5,...}

3) The logic to avoid collision hours according to per thread's question:

"x" map opens: 0,3,6,9,12,15,18,21,23
"y" map opens: 0,2,4,6,8,10,12,14,16,18,20,22

does not make sense.


kong.png

a2.png

Share this post


Link to post
Share on other sites

One way to make that would be them opening every two hours:

SetMapEntryTime(map, "2006/10/18/14/0", "0/2/0", "0/0/30", "0/0/45")
SetMapEntryTime(map, "2006/10/18/15/0", "0/2/0", "0/0/30", "0/0/45")

That way they wouldn't overlap, but it's not what you wanted of one map being every two hours and another every three hours without overlapping.

Share this post


Link to post
Share on other sites

@KONG @Angelix

 

Sorry if I was not clear. What I want is for one map to open in even hours and another on odd hours, so not overlapping with one another.

 

For example:

"x" map opens: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23
"y" map opens: 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22

 

Borth using the same times. For example:

SetMapEntryTime(map, "2006/10/18/15/0", "0/2/0", "0/0/30", "0/0/45")

 

 

Some years ago I did this using GetNowTime running in can_open_entry_map function of the corresponding map, but I'm not sure about it. But I did some way, I just can't remember how :x

 

 

Thanks in advance.


“So the problem is not so much to see what nobody has yet seen, as to think what nobody has yet thought concerning that which everybody sees.”


― Arthur Schopenhauer

Share this post


Link to post
Share on other sites
21 hours ago, Angelix said:

Well, in that case I already gave you the answer then.

 

I tried it but doesn't worked. 


“So the problem is not so much to see what nobody has yet seen, as to think what nobody has yet thought concerning that which everybody sees.”


― Arthur Schopenhauer

Share this post


Link to post
Share on other sites

Solved!

 

I did it this way:

In the ctrl.lua (/server file/mapName/) file of the desired map (in this case in Arena), I added the following code in the function can_open_entry_PKmap (map)

 

function can_open_entry_PKmap( map ) 
	-- Specific portal time to open
	local hour = os.date ("%H")
    local hournum = tonumber(hour)
	if hournum == 01 or hournum == 03 or hournum == 05 or hournum == 07 or hournum == 09 or hournum == 11 or hournum == 13 or hournum == 15 or hournum == 17 or hournum == 19 or hournum == 21 or hournum == 23 then
		return 1
	else
		return 0
	end
end 

 

01 means 1am

03    " "    3am

05    " "    5am

 

And so on...


“So the problem is not so much to see what nobody has yet seen, as to think what nobody has yet thought concerning that which everybody sees.”


― Arthur Schopenhauer

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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