Jump to content
Angelix

Anomaly Tower

Recommended Posts

Anomaly Tower

 

Description:

  • The map "Anomaly" aims to be an instanced map with tower climb like features. The map is fixed, but the difficulty and monsters on each floor are gradually stronger from the previous floor. Every 5th floor will contain an extra monster that will be a mini-boss and every 10th floor will be a boss floor.
  • Players can enter solo or get help as a team, but only the players that are at that floor level will get the floor completion.
    • Those players at the current floor level will be treated as "main" players and have a set of rewards.
    • Those players not at the current floor level will be treated as "support" players and have a different set of rewards.
  • It can be customized how many players can enter the instance at once just in case. The monsters are chosen at random, they are set within a database so all players can expect the same monsters in that specific floor.
    • The floors are refreshed every month. So if new monsters are added to the lists as future updates, they can appear in lower floors when a new months starts.

 

Too lazy to write everything here, so just have some links directly from GitHub.

 

Links:

Edited by Angelix
  • Like 2
  • Thanks 2

Share this post


Link to post
Share on other sites
34 minutes ago, Timur said:

Is it possible to create an NPS top player by the number of floors passed? In order to give them rewards at the end of the month))

Yes, it is possible! You'd just have to add functionality and keep a main database file to keep track of all the players, then based off on that, do an internal ranking and then display that on an NPC.

Share this post


Link to post
Share on other sites
On 1/30/2023 at 5:08 PM, Timur said:

Is it possible to create an NPS top player by the number of floors passed? In order to give them rewards at the end of the month))

So I was thinking of implementing this, and the leaderboard within the NPC shouldn't be an issue, but the reward yes. The leaderboard can be shown, but the whole script itself doesn't reset, so the NPC would show how far a player has gotten through the map's existence. So you can't give out rewards at the end of the month if it's not resetting.

Share this post


Link to post
Share on other sites
8 часов назад, Angelix сказал:

So I was thinking of implementing this, and the leaderboard within the NPC shouldn't be an issue, but the reward yes. The leaderboard can be shown, but the whole script itself doesn't reset, so the NPC would show how far a player has gotten through the map's existence. So you can't give out rewards at the end of the month if it's not resetting.

Can you please tell me how to implement a table by the number of waves passed by the players?

Share this post


Link to post
Share on other sites
On 6/25/2023 at 3:30 PM, Ximboliex said:

image.png.ed4be806ebbf0f40e6d355d4bbfbdc65.png

 

i have this error, i dont move anithing, have CO Src

 

Should probably note when this is happening. If anything pops up in lua_err or console.

Share this post


Link to post
Share on other sites

I did my best to follow your guide on this but I failed to load this 2 files. I also confused how you define to have the npc and the map to be in the same origin map. This is the error that I get from my GS.2039761591_failanomaly.png.6f4e13eab3ea749fcfa3aabc2d453bf7.png

Share this post


Link to post
Share on other sites
14 hours ago, kyleflow said:

I did my best to follow your guide on this but I failed to load this 2 files. I also confused how you define to have the npc and the map to be in the same origin map. This is the error that I get from my GS.2039761591_failanomaly.png.6f4e13eab3ea749fcfa3aabc2d453bf7.png

It says you're missing that function. That function I think is loaded on "serialize.lua" that's in all custom files I think? So also double-check if you have that file loaded as well.

 

file_exists = file_exists or function(name)
	local f = io.open(name, 'r')
	if(f ~= nil)then
		io.close(f)
		return true
	else
		return false
	end
end

 

Share this post


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

It says you're missing that function. That function I think is loaded on "serialize.lua" that's in all custom files I think? So also double-check if you have that file loaded as well.

 

 

Thanks @Angelix for sharing the code. My serialize.lua probably not completed. I got it from the mega folder which stored PKO related stuff and the function you provided is not there. When I add the function, it solved 1 error but another 1 still persist. "AdjustTextSpace" error occur when I check with lua_err.log . So I tried the same way of introducing the other custom serialize function and the GS error is gone but inside the game, a parameter error persist. I will share here the current state of my serialize.lua and the error inside the game.

 

--[[
   Save Table to File/Stringtable
   Load Table from File/Stringtable
   v 0.94
   
   Lua 5.1 compatible
   
   Userdata and indices of these are not saved
   Functions are saved via string.dump, so make sure it has no upvalues
   References are saved
   ----------------------------------------------------
   table.save( table [, filename] )
   
   Saves a table so it can be called via the table.load function again
   table must a object of type 'table'
   filename is optional, and may be a string representing a filename or true/1
   
   table.save( table )
      on success: returns a string representing the table (stringtable)
      (uses a string as buffer, ideal for smaller tables)
   table.save( table, true or 1 )
      on success: returns a string representing the table (stringtable)
      (uses io.tmpfile() as buffer, ideal for bigger tables)
   table.save( table, "filename" )
      on success: returns 1
      (saves the table to file "filename")
   on failure: returns as second argument an error msg
   ----------------------------------------------------
   table.load( filename or stringtable )
   
   Loads a table that has been saved via the table.save function
   
   on success: returns a previously saved table
   on failure: returns as second argument an error msg
   ----------------------------------------------------
   
   chillcode, http://lua-users.org/wiki/SaveTableToFile
   Licensed under the same terms as Lua itself.
]]--
do
   -- declare local variables
   --// exportstring( string )
   --// returns a "Lua" portable version of the string
   local function exportstring( s )
      s = string.format( "%q",s )
      -- to replace
      s = string.gsub( s,"\\\n","\\n" )
      s = string.gsub( s,"\r","\\r" )
      s = string.gsub( s,string.char(26),"\"..string.char(26)..\"" )
      return s
   end
--// The Save Function
function table.save(  tbl,filename )
   local charS,charE = "   ","\n"
   local file,err
   -- create a pseudo file that writes to a string and return the string
   if not filename then
      file =  { write = function( self,newstr ) self.str = self.str..newstr end, str = "" }
      charS,charE = "",""
   -- write table to tmpfile
   elseif filename == true or filename == 1 then
      charS,charE,file = "","",io.tmpfile()
   -- write table to file
   -- use io.open here rather than io.output, since in windows when clicking on a file opened with io.output will create an error
   else	  
      file,err = io.open( filename, "w" )
      if err then 
		return _,err 
		end
   end
   -- initiate variables for save procedure
   local tables,lookup = { tbl },{ [tbl] = 1 }
   
   file:write( "return {"..charE )
   for idx,t in ipairs( tables ) do
      if filename and filename ~= true and filename ~= 1 then
         file:write( "-- Table: {"..idx.."}"..charE )
      end
      file:write( "{"..charE )
      local thandled = {}
      for i,v in ipairs( t ) do
         thandled[i] = true
         -- escape functions and userdata
         if type( v ) ~= "userdata" then
            -- only handle value
            if type( v ) == "table" then
               if not lookup[v] then
                  table.insert( tables, v )
                  lookup[v] = table.getn(tables)
               end
               file:write( charS.."{"..lookup[v].."},"..charE )
            elseif type( v ) == "function" then
               file:write( charS.."loadstring("..exportstring(string.dump( v )).."),"..charE )
            else
               local value =  ( type( v ) == "string" and exportstring( v ) ) or tostring( v )
               file:write(  charS..value..","..charE )
            end
         end
      end
      for i,v in pairs( t ) do
         -- escape functions and userdata
         if (not thandled[i]) and type( v ) ~= "userdata" then
            -- handle index
            if type( i ) == "table" then
               if not lookup[i] then
                  table.insert( tables,i )
                  lookup[i] = table.getn(tables)
               end
               file:write( charS.."[{"..lookup[i].."}]=" )
            else
               local index = ( type( i ) == "string" and "["..exportstring( i ).."]" ) or string.format( "[%d]",i )
               file:write( charS..index.."=" )
            end
            -- handle value
            if type( v ) == "table" then
               if not lookup[v] then
                  table.insert( tables,v )
                  lookup[v] = table.getn(tables)
               end
               file:write( "{"..lookup[v].."},"..charE )
            elseif type( v ) == "function" then
               file:write( "loadstring("..exportstring(string.dump( v )).."),"..charE )
            else
               local value =  ( type( v ) == "string" and exportstring( v ) ) or tostring( v )
               file:write( value..","..charE )
            end
         end
      end
      file:write( "},"..charE )
   end
   file:write( "}" )
   -- Return Values
   -- return stringtable from string
   if not filename then
      -- set marker for stringtable
      return file.str.."--|"
   -- return stringttable from file
   elseif filename == true or filename == 1 then
      file:seek ( "set" )
      -- no need to close file, it gets closed and removed automatically
      -- set marker for stringtable
      return file:read( "*a" ).."--|"
   -- close file and return 1
   else
      file:close()
      return 1
   end
end
file_exists = file_exists or function(name) 
	local f = io.open(name, 'r')
	if(f ~= nil)then
		io.close(f)
		return true
	else
		return false
	end
end

AdjustTextSpace = AdjustTextSpace or function(name) --custom function with reference to the one you provided Angelix
	local f = io.open(name, 'r')
	if(f ~= nil) then
		io.close(f)
		return true
	else
		return false
	end
end

--// The Load Function
function table.load( sfile )
   -- catch marker for stringtable
   if string.sub( sfile,-3,-1 ) == "--|" then
      tables,err = loadstring( sfile )
   else
	  fd = nil
	  while(fd == nil) do
		fd, err = io.open(sfile, "rw")
	  end
      tables,err = loadfile( sfile )  
	  io.close(fd)
   end
   if err then return _,err
   end
   tables = tables()
   for idx = 1,table.getn(tables) do
      local tolinkv,tolinki = {},{}
      for i,v in pairs( tables[idx] ) do
         if type( v ) == "table" and tables[v[1]] then
            table.insert( tolinkv,{ i,tables[v[1]] } )
         end
         if type( i ) == "table" and tables[i[1]] then
            table.insert( tolinki,{ i,tables[i[1]] } )
         end
      end
      -- link values, first due to possible changes of indices
      for _,v in ipairs( tolinkv ) do
         tables[idx][v[1]] = v[2]
      end
      -- link indices
      for _,v in ipairs( tolinki ) do
         tables[idx][v[2]],tables[idx][v[1]] =  tables[idx][v[1]],nil
      end
   end
   return tables[1]
end
-- close do
end

1033046419_lua_erranomaly.png.c5ed6701c5b750ccf67f2b411e1ebcff.png

I also check inside your github page, and I find a file under .vscode with a list of probably serialize that I should have? or there is a way to utilize the file you provided there.

Share this post


Link to post
Share on other sites

 

14 hours ago, kyleflow said:

Thanks @Angelix for sharing the code. My serialize.lua probably not completed. I got it from the mega folder which stored PKO related stuff and the function you provided is not there. When I add the function, it solved 1 error but another 1 still persist. "AdjustTextSpace" error occur when I check with lua_err.log . So I tried the same way of introducing the other custom serialize function and the GS error is gone but inside the game, a parameter error persist. I will share here the current state of my serialize.lua and the error inside the game.

The function I provided was only for checking if the file existed. The other function is completely different. Check GitHub, I added a new file there with the 2 functions.

  • Thanks 1

Share this post


Link to post
Share on other sites
24 minutes ago, Angelix said:

 

The function I provided was only for checking if the file existed. The other function is completely different. Check GitHub, I added a new file there with the 2 functions.

Thanks on the functions. It worked well. My bad for not understanding things on this. Just weird that with every floor, it kept closing maps and the mobs is the same for each entry. Is it supposed to be like that or I need configure with your configuration guide in github?

Share this post


Link to post
Share on other sites
9 minutes ago, kyleflow said:

Thanks on the functions. It worked well. My bad for not understanding things on this. Just weird that with every floor, it kept closing maps and the mobs is the same for each entry. Is it supposed to be like that or I need configure with your configuration guide in github?

Have you added more monsters? Are the levels increasing each level? And yes, it's built upon the cycle of "enter->defeat floor->exit->repeat" until you reach the highest floor available or you can't beat the floor. You can increase number of floors if I remember correctly and it will adjust accordingly.

Share this post


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

Have you added more monsters? Are the levels increasing each level? And yes, it's built upon the cycle of "enter->defeat floor->exit->repeat" until you reach the highest floor available or you can't beat the floor. You can increase number of floors if I remember correctly and it will adjust accordingly.

Not yet. Still testing the current test and I'm able to save the progress by simply created a Cache folder. Just one thing I notice, the mobs is not attacking the player. Let me check if the monster spawn is the same as other map. Probably can make it aggro. Thanks for this wonderful addition. Probably after I complete with adjusting this, will release back what I had that would make a solo RPG style TOP.

Share this post


Link to post
Share on other sites

@Angelix

 

Propose fix for the mobs not aggro. I change this part of the Anomaly Function.lua to make mobs agro the player.

 

for _, MonsterID in pairs(Anomaly.Floor[Floor].Monsters) do
		local PosX = math.random(Anomaly.Conf.MonsterSpawn.PosX.Min, Anomaly.Conf.MonsterSpawn.PosX.Max)
		local PosY = math.random(Anomaly.Conf.MonsterSpawn.PosY.Min, Anomaly.Conf.MonsterSpawn.PosY.Max)
		local Monster2 = CreateChaEx(0883, (PosX * 100), (PosY * 100), 145, 60, MapCopy) -- I use BD mobs here but you can use the preset mobs made by Angelix
		local Monster3 = CreateChaEx(0884, (PosX * 100), (PosY * 100), 145, 60, MapCopy)
		local Monster4 = CreateChaEx(0885, (PosX * 100), (PosY * 100), 145, 60, MapCopy)
		local Monster5 = CreateChaEx(0886, (PosX * 100), (PosY * 100), 145, 60, MapCopy)
		SetChaLifeTime(Monster2, 999999999)
		SetChaLifeTime(Monster3, 999999999)
		SetChaLifeTime(Monster4, 999999999)
		SetChaLifeTime(Monster5, 999999999)
		Anomaly.SetAttribute(Monster, Anomaly.Monster, Normal, Floor) 

Can implemented it into other part of the function for mini and Main boss. I summon it as garner2 does and still using the same files as you already set for the "SetAttribute". It work like a charm and now I can enjoy it better since the mobs is not static.

Share this post


Link to post
Share on other sites

Additional finding on Anomaly Tower. With the summon method above, I add more monster but after killing all mobs, the maps does not instantly enter 5 sec mode count down. This also affect the mini boss and main boss spawn. none spawn even when it suppose to spawn. Still checking if I can find where the conflicted setup. Need assistance also.

Share this post


Link to post
Share on other sites
4 hours ago, kyleflow said:

@Angelix

 

Propose fix for the mobs not aggro. I change this part of the Anomaly Function.lua to make mobs agro the player.

 


for _, MonsterID in pairs(Anomaly.Floor[Floor].Monsters) do
		local PosX = math.random(Anomaly.Conf.MonsterSpawn.PosX.Min, Anomaly.Conf.MonsterSpawn.PosX.Max)
		local PosY = math.random(Anomaly.Conf.MonsterSpawn.PosY.Min, Anomaly.Conf.MonsterSpawn.PosY.Max)
		local Monster2 = CreateChaEx(0883, (PosX * 100), (PosY * 100), 145, 60, MapCopy) -- I use BD mobs here but you can use the preset mobs made by Angelix
		local Monster3 = CreateChaEx(0884, (PosX * 100), (PosY * 100), 145, 60, MapCopy)
		local Monster4 = CreateChaEx(0885, (PosX * 100), (PosY * 100), 145, 60, MapCopy)
		local Monster5 = CreateChaEx(0886, (PosX * 100), (PosY * 100), 145, 60, MapCopy)
		SetChaLifeTime(Monster2, 999999999)
		SetChaLifeTime(Monster3, 999999999)
		SetChaLifeTime(Monster4, 999999999)
		SetChaLifeTime(Monster5, 999999999)
		Anomaly.SetAttribute(Monster, Anomaly.Monster, Normal, Floor) 

Can implemented it into other part of the function for mini and Main boss. I summon it as garner2 does and still using the same files as you already set for the "SetAttribute". It work like a charm and now I can enjoy it better since the mobs is not static.

Before doing this modification, did you read the configuration file? There's a special line in there. If you search that variable within the files, you should be able to see what it does, that way you don't replace things you don't fully understand.

Anomaly.Conf.Test = true

If you set that to "false", monsters should attack...

 

Also, since you "fixed" it, you actually broke it! So that's on you. That's why it's not triggering the rest of the script. Since you went out of your way to replace essential parts of the scripts, I take it you understand what you're doing and no more support is given.

Edited by Angelix

Share this post


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

Before doing this modification, did you read the configuration file? There's a special line in there. If you search that variable within the files, you should be able to see what it does, that way you don't replace things you don't fully understand.


Anomaly.Conf.Test = true

If you set that to "false", monsters should attack...

 

Also, since you "fixed" it, you actually broke it! So that's on you. That's why it's not triggering the rest of the script. Since you went out of your way to replace essential parts of the scripts, I take it you understand what you're doing and no more support is given.

I do read it. Well since a standard things happen when you are doing this with scripting, a simplest of details you could have missed. I did asked in previous reply if that behavior of mobs is normal but I don't see any response from you which is okay that make me assume things are not working in certain part somehow. If my take on it is wrong, than it is wrong. Please don't cynically says that I "fixed" it as something that I do it out of bad intention to point out the things that is "wrong" with the script. Anyhow, thanks @Angelix on the release and point out my mistake again.

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