Jump to content
Faller

Chaos Argent monsters spawning late

Recommended Posts

Hey there! How are you doing? :) I hope you're doing good.

 

I'm having a small problem with my garner2 monsters spawning, the thing is:

 

The first wave of monsters spawn around :18 instead of 6~7 minutes.

I've tried modifying Every_5_minutes = 0 to Every_5_minutes = 1.. but no success either.

I was thinking of using "NowMin" script to spawn the monsters, but I'm not really sure where I can put it on (surely not insisde map_run_special, since it runs every 5 mins).

I could put it inside functions, but, I don't know how I'd spawn the monsters inside garner2 from the functions, since the monster spawning script doesn't define the map, like "50,50,garner2"...

 

I hope you can help me, thank you!

Share this post


Link to post
Share on other sites
Guest

In original scripts the counter starts as soon as any character enters the map. That's why sometimes mobs spawning time is incorrect. You might wanna try to mess with os.time functions

Share this post


Link to post
Share on other sites

Hey! Thanks @Rinor and @qwerty.

If I enter on :00, they will spawn on :18, so basically, would be even later if nobody entered.. xD

Any tips on how I could spawn a mob using os.time? Maybe just add it inside the map's ctrl? I'll give it a try!

#EDIT

I'm not sure in which function tho. :\

Edited by Faller

Share this post


Link to post
Share on other sites

@qwerty @Rinor

I have found out that I get the following error every time the script runs:

Quote

[01-27 16:27:06]resource/garner2\ctrl.lua:344: attempt to perform arithmetic on global `Every_5_minute' (a nil value)

 

And in ctrl line 344 I've got: Every_5_minute = Every_5_minute+1

 

Any tips? Thanks!

 

#EDIT

Error solved adding Every_5_minute to Variable, but now just the first wave of monsters spawns, the others won't show up...

Edited by Faller

Share this post


Link to post
Share on other sites

Hello. As mentioned here you can done this using Os Library to determine current server minute. Here a example:

 

-- Avoid re-spawning waves
MAPNAME_init = function()
	MAPNAME_Wave01 = 0;
end
MAPNAME_init()

function map_copy_run_MAPNAME(map_copy)
    local ClockMinute = tonumber(os.date("%M"))
    if ClockMinute == 5 then
		if MAPNAME_Wave01 == 0 then 
		-- Monster wave;
		MAPNAME_Wave01 = MAPNAME_Wave01 + 1; 
		end
	end
end

It will execute the body of function at the determined time on local ClokMinute. https://www.lua.org/pil/22.1.html

  • Like 2

Share this post


Link to post
Share on other sites
7 hours ago, Satan said:

Hello. As mentioned here you can done this using Os Library to determine current server minute. Here a example:

 


-- Avoid re-spawning waves
MAPNAME_init = function()
	MAPNAME_Wave01 = 0;
end
MAPNAME_init()

function map_copy_run_MAPNAME(map_copy)
    local ClockMinute = tonumber(os.date("%M"))
    if ClockMinute == 5 then
		if MAPNAME_Wave01 == 0 then 
		-- Monster wave;
		MAPNAME_Wave01 = MAPNAME_Wave01 + 1; 
		end
	end
end

It will execute the body of function at the determined time on local ClokMinute. https://www.lua.org/pil/22.1.html

 

Hey @Satan! Thanks for sharing this script. :)

I've fixed the problem somehow, but your script may be of use in the very near future, thanks a lot!

Share this post


Link to post
Share on other sites

It seems you fixed it, but just in case, here is something I use within my files.

function map_copy_run_garner2(MapCopy)
	ChaosArgent.Alive = GetMapActivePlayer(MapCopy)
	if ChaosArgent.Alive > 0 then
		ChaosArgentCheater(MapCopy)
	end
	local Second = tonumber(os.date("%S"))
	local Minute = tonumber(os.date("%M"))
	if (Minute - math.floor(Minute / 5) * 5) == 0 and Second == 0 then
		Notice("<"..ChaosArgent.Config.General.MapName..">: There are still "..ChaosArgent.Alive.." players alive.")
		ChaosArgent.SpawnNum = Minute/5
		if ChaosArgent.Config.Monsters[ChaosArgent.SpawnNum] ~= nil then
			if ChaosArgent.Alive >= 1 then
				for i = 1, table.getn(ChaosArgent.Config.Monsters[ChaosArgent.SpawnNum]), 1 do
					local ID = ChaosArgent.Config.Monsters[ChaosArgent.SpawnNum][i].ID
					local X = ChaosArgent.Config.Monsters[ChaosArgent.SpawnNum][i].X * 100
					local Y = ChaosArgent.Config.Monsters[ChaosArgent.SpawnNum][i].Y * 100
					local Monster = CreateChaEx(ID, X, Y, 145, 60, MapCopy)
					SetChaLifeTime(Monster, 299000)
				end
			end
		end
	end
end

And this would be the first wave of spawning monsters.

ChaosArgent.Config.Monsters[1] = {}

ChaosArgent.Config.Monsters[1][1] = {ID = 859, X = 63, Y = 35}
ChaosArgent.Config.Monsters[1][2] = {ID = 859, X = 67, Y = 130}
ChaosArgent.Config.Monsters[1][3] = {ID = 859, X = 108, Y = 249}
ChaosArgent.Config.Monsters[1][4] = {ID = 859, X = 146, Y = 208}
ChaosArgent.Config.Monsters[1][5] = {ID = 859, X = 123, Y = 161}
ChaosArgent.Config.Monsters[1][6] = {ID = 859, X = 120, Y = 139}
ChaosArgent.Config.Monsters[1][7] = {ID = 859, X = 123, Y = 123}
ChaosArgent.Config.Monsters[1][8] = {ID = 859, X = 143, Y = 129}
ChaosArgent.Config.Monsters[1][9] = {ID = 859, X = 184, Y = 128}
ChaosArgent.Config.Monsters[1][10] = {ID = 859, X = 187, Y = 75}
ChaosArgent.Config.Monsters[1][11] = {ID = 859, X = 143, Y = 75}
ChaosArgent.Config.Monsters[1][12] = {ID = 859, X = 101, Y = 62}
ChaosArgent.Config.Monsters[1][13] = {ID = 859, X = 100, Y = 96}
ChaosArgent.Config.Monsters[1][14] = {ID = 859, X = 171, Y = 33}

Players would have to be inside at minute "5" exactly, otherwise first spawn would be skipped. Again, if there's nobody inside by minute "10", no monsters would be spawned and so on. No more "entering at minute 20 to avoid black dragon monster spawning".

  • Like 3

Share this post


Link to post
Share on other sites
On 1/29/2017 at 3:19 AM, Angelix said:

It seems you fixed it, but just in case, here is something I use within my files.


function map_copy_run_garner2(MapCopy)
	ChaosArgent.Alive = GetMapActivePlayer(MapCopy)
	if ChaosArgent.Alive > 0 then
		ChaosArgentCheater(MapCopy)
	end
	local Second = tonumber(os.date("%S"))
	local Minute = tonumber(os.date("%M"))
	if (Minute - math.floor(Minute / 5) * 5) == 0 and Second == 0 then
		Notice("<"..ChaosArgent.Config.General.MapName..">: There are still "..ChaosArgent.Alive.." players alive.")
		ChaosArgent.SpawnNum = Minute/5
		if ChaosArgent.Config.Monsters[ChaosArgent.SpawnNum] ~= nil then
			if ChaosArgent.Alive >= 1 then
				for i = 1, table.getn(ChaosArgent.Config.Monsters[ChaosArgent.SpawnNum]), 1 do
					local ID = ChaosArgent.Config.Monsters[ChaosArgent.SpawnNum][i].ID
					local X = ChaosArgent.Config.Monsters[ChaosArgent.SpawnNum][i].X * 100
					local Y = ChaosArgent.Config.Monsters[ChaosArgent.SpawnNum][i].Y * 100
					local Monster = CreateChaEx(ID, X, Y, 145, 60, MapCopy)
					SetChaLifeTime(Monster, 299000)
				end
			end
		end
	end
end

And this would be the first wave of spawning monsters.


ChaosArgent.Config.Monsters[1] = {}

ChaosArgent.Config.Monsters[1][1] = {ID = 859, X = 63, Y = 35}
ChaosArgent.Config.Monsters[1][2] = {ID = 859, X = 67, Y = 130}
ChaosArgent.Config.Monsters[1][3] = {ID = 859, X = 108, Y = 249}
ChaosArgent.Config.Monsters[1][4] = {ID = 859, X = 146, Y = 208}
ChaosArgent.Config.Monsters[1][5] = {ID = 859, X = 123, Y = 161}
ChaosArgent.Config.Monsters[1][6] = {ID = 859, X = 120, Y = 139}
ChaosArgent.Config.Monsters[1][7] = {ID = 859, X = 123, Y = 123}
ChaosArgent.Config.Monsters[1][8] = {ID = 859, X = 143, Y = 129}
ChaosArgent.Config.Monsters[1][9] = {ID = 859, X = 184, Y = 128}
ChaosArgent.Config.Monsters[1][10] = {ID = 859, X = 187, Y = 75}
ChaosArgent.Config.Monsters[1][11] = {ID = 859, X = 143, Y = 75}
ChaosArgent.Config.Monsters[1][12] = {ID = 859, X = 101, Y = 62}
ChaosArgent.Config.Monsters[1][13] = {ID = 859, X = 100, Y = 96}
ChaosArgent.Config.Monsters[1][14] = {ID = 859, X = 171, Y = 33}

Players would have to be inside at minute "5" exactly, otherwise first spawn would be skipped. Again, if there's nobody inside by minute "10", no monsters would be spawned and so on. No more "entering at minute 20 to avoid black dragon monster spawning".

 

Great script! I'll surely implement it, thanks for sharing. :)

Edited by Faller

Share this post


Link to post
Share on other sites
On 1/27/2017 at 10:32 PM, Faller said:

@qwerty @Rinor

I have found out that I get the following error every time the script runs:

 

And in ctrl line 344 I've got: Every_5_minute = Every_5_minute+1

 

Any tips? Thanks!

 

#EDIT

Error solved adding Every_5_minute to Variable, but now just the first wave of monsters spawns, the others won't show up...

Hello can you please share where you added variable for every_5_minute? coz i think i have the same problem too. thank you.

Share this post


Link to post
Share on other sites
8 minutes ago, saa0d said:

Hello can you please share where you added variable for every_5_minute? coz i think i have the same problem too. thank you.

It's in variable.lua

Share this post


Link to post
Share on other sites
21 minutes ago, Onioni said:

It's in variable.lua

I don't have a variable called Every_5_minute in variable.lua

 

if i have to make it, im wondering how am i supposed to initialize it and what value should i assign it.

Edited by saa0d

Share this post


Link to post
Share on other sites
7 hours ago, saa0d said:

I don't have a variable called Every_5_minute in variable.lua

 

if i have to make it, im wondering how am i supposed to initialize it and what value should i assign it.

Just add anywhere Every_5_minute = 0

Share this post


Link to post
Share on other sites
5 hours ago, Onioni said:

Just add anywhere Every_5_minute = 0

Should I initialize it? like 

local Every_5_minute = 0?

 

im new at this, please help

Share this post


Link to post
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

×