Jump to content
Sign in to follow this  
Shako

How to make a map tick?

Recommended Posts

Hello guys,

 

I'm trying to write a script for maps which require the map to tick. (every second counter).

 

Right now the only way I see is Every_5_Minutes which ticks.. every 5 minutes!

 

What if I wanted a map tick that has more frequency than that? How do I do so?

 

Thanks!

SHAKO


logo-big.png   logo.png

                                   Sunny Go! Online                                                                    pko.host                                                 

Share this post


Link to post
Share on other sites

Tick everyone second? good luck spamming system =D
map tick? what u mean? like Chaos Argent map tick for monster spawnining while there are active players? or map tick for map close down time?
If like CA, What's your purpose for make a ticking that is faster than usual? If you really do, u can just do every_5_minutes - certain time so it will be faster.
Try to play around with

    Every_5_minute = Every_5_minute+1
    if Every_5_minute == 2 then -- ³õ¼¶±¦Ïä

    --direct monster create

    end

like instead of going +(plus), you will go -(minus). there should be another way for ticking. maybe ask someone to make u one that will tick after seconds (ofc, it will spam your system if the time is short but mainly depend on what u tick on)

Share this post


Link to post
Share on other sites

Hi ! its been awhile but lemme see if i can remember some things...
map_copy_run_special_* ticks every 5 minutes. (so use this function if you want to do a set of routine every 5 minutes)
the Every_5_Minutes is only a counter so don't mistake it as anything special... (I can change the variable name to Every_10_Minutes and it will still counter every 5 minutes
because of it being incremented inside the map_copy_run_special_* function.

 

The function you want to deal with is: map_copy_run_*
 


kong.png

a2.png

Share this post


Link to post
Share on other sites

@KONG is indeed correct. "map_copy_run_X" is a function like "cha_timer", it "ticks" every second only if a player is inside or has been inside the map. The tick won't start unless someone steps inside the map for it to begin.

Share this post


Link to post
Share on other sites
1 hour ago, Angelix said:

@KONG is indeed correct. "map_copy_run_X" is a function like "cha_timer", it "ticks" every second only if a player is inside or has been inside the map. The tick won't start unless someone steps inside the map for it to begin.

 

5 hours ago, KONG said:

Hi ! its been awhile but lemme see if i can remember some things...
map_copy_run_special_* ticks every 5 minutes. (so use this function if you want to do a set of routine every 5 minutes)
the Every_5_Minutes is only a counter so don't mistake it as anything special... (I can change the variable name to Every_10_Minutes and it will still counter every 5 minutes
because of it being incremented inside the map_copy_run_special_* function.

 

The function you want to deal with is: map_copy_run_*
 

Thanks a lot! Is there a way to make the map's tick start when the portal opens, where anything scripted will spawn regardless of player count?
 

6 hours ago, DangThao said:

Tick everyone second? good luck spamming system =D
map tick? what u mean? like Chaos Argent map tick for monster spawnining while there are active players? or map tick for map close down time?
If like CA, What's your purpose for make a ticking that is faster than usual? If you really do, u can just do every_5_minutes - certain time so it will be faster.
Try to play around with

    Every_5_minute = Every_5_minute+1
    if Every_5_minute == 2 then -- ³õ¼¶±¦Ïä

    --direct monster create

    end

like instead of going +(plus), you will go -(minus). there should be another way for ticking. maybe ask someone to make u one that will tick after seconds (ofc, it will spam your system if the time is short but mainly depend on what u tick on)

In case I want to make something spawn every 3 minutes instead of 5 minutes, how will I do that? :P


logo-big.png   logo.png

                                   Sunny Go! Online                                                                    pko.host                                                 

Share this post


Link to post
Share on other sites

Also, does anyone know WHAT function draws the map_copy_run_special to tick once every minutes? 


logo-big.png   logo.png

                                   Sunny Go! Online                                                                    pko.host                                                 

Share this post


Link to post
Share on other sites
11 minutes ago, Shako said:

Thanks a lot! Is there a way to make the map's tick start when the portal opens, where anything scripted will spawn regardless of player count?

Currently no, or not any that I have found yet. If someone knows, please show us the way.

11 minutes ago, Shako said:

In case I want to make something spawn every 3 minutes instead of 5 minutes, how will I do that? :P

Try this. Since the function works with seconds, not minutes, then a minute translates into 60 seconds, then 180 would be 3 minutes.

RandomTickVariable = 0
function map_copy_run_X(MapCopy)
	RandomTickVariable = RandomTickVariable + 1
	if (RandomTickVariable - math.floor(RandomTickVariable/180)*180) == 0 then
		...
	end
end
Edited by Angelix
  • Like 1

Share this post


Link to post
Share on other sites

@Angelix

RandomTickVariable = 0
function map_copy_run_X(MapCopy)

	RandomTickVariable = RandomTickVariable + 1
	
	if math.mod(RandomTickVariable, 180) == 0 then
		-- ticks every 180 seconds or 3 minutes
		-- do something
	end
	
end

 


Share this post


Link to post
Share on other sites
30 minutes ago, V3ct0r said:

@Angelix


RandomTickVariable = 0
function map_copy_run_X(MapCopy)

	RandomTickVariable = RandomTickVariable + 1
	
	if math.mod(RandomTickVariable, 180) == 0 then
		-- ticks every 180 seconds or 3 minutes
		-- do something
	end
	
end

 

Wouldn't it be same? Or what's the difference?

Share this post


Link to post
Share on other sites

@Angelix it is same code but a bit easier.

 

math.mod(RandomTickVariable, 180) equals to RandomTickVariable % 180.

 

180 % 180 = 0

200 % 180 =  20

300 % 180 = 120

360 % 180 = 0

720 % 180 = 0

799 % 180 = 79


Share this post


Link to post
Share on other sites
3 hours ago, V3ct0r said:

@Angelix it is same code but a bit easier.

 

math.mod(RandomTickVariable, 180) equals to RandomTickVariable % 180.

 

180 % 180 = 0

200 % 180 =  20

300 % 180 = 120

360 % 180 = 0

720 % 180 = 0

799 % 180 = 79

basically it happens every 180 ticks @Angelix

 

although I haven't tested yours yet, i would assume its the same thing O.o

Edited by Shako

logo-big.png   logo.png

                                   Sunny Go! Online                                                                    pko.host                                                 

Share this post


Link to post
Share on other sites
1 час назад, Shako сказал:

basically it happens every 180 ticks @Angelix

 

although I haven't tested yours yet, i would assume its the same thing O.o

Yes it is the same thing


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.

Sign in to follow this  

×
×
  • Create New...