Offer of new script for "Random Map" mode

Everything about our W:ET servers. New ideas, wishes are welcome.
N!tmod, Trickjump, Jaymod, Sniper N!tmod, Headshot ETPro.

Offer of new script for "Random Map" mode

Postby nick » 14 Sep 2018, 11:01

Hello. I've found file of my old server with modified script files of "Random Map" mode. I detected that when somebody sets next map via !setnext command (for example !setnext eagles_2ways_b3) there are still old message in g_msg1 area. So, if you add this code

Code: Select all

name = setnextmap
exec = set nextmap "map [1]"; set g_msg1 "^9Next map is ^7[1]"; set nextmapinfo "echo Next map is [1]"; vstr nextmapinfo
desc = Sets the next map
levels = 1 2

into "commands.db" file and add this code

Code: Select all
function et_InitGame(levelTime, randomSeed, restart)
   et.RegisterModname("(Map Vote Cycle & Random Map Mode & N!tmod) v1.0")
   local maps = {"railgun"}
   local maps_excluded = {"mp_bin", "pak0", "pak1", "pak2", "goldendunk_a2", "baserace", "baserace_b3c", "baserace_desert", "ctf-face-fp1_fixed", "purefrag"}
   local map_last = et.trap_Cvar_Get("nextmapinfo")
   if (map_last ~= "") then
      map_last = string.sub(map_last, 18)
   local map_current = et.trap_Cvar_Get("mapname")
   local map_next = ""
   if (et.trap_Cvar_Get("warmup") == "1" and (map_last == map_current or map_last == "")) then
      et.trap_Cvar_Set("warmup", "0")
      local a = io.popen('dir "C:/Users/Admin/Desktop/ALL-OLD/Wolfenstein ET Servers/new/etmain/" /b')
      for b in a:lines() do
         local c = string.sub(b, 1, string.len(b) - 4)
         if (string.sub(b, string.len(b) - 2) == "pk3") then
            for d, e in ipairs(maps_excluded) do
               if (c == e) then
                  c = nil
            if (c ~= nil) then
               table.insert(maps, c)
      local c = "chat List of maps:\n"
      for d, e in ipairs(maps) do
         c = c.." chat "..e.."\n"
      et.trap_Cvar_Set("maplist", c.."chat\n")
      while (true) do
         map_next = maps[math.random(table.getn(maps))]
         if (map_next ~= map_current and map_next ~= map_last) then
      et.trap_Cvar_Set("nextmap", "map "..map_next)
      et.trap_Cvar_Set("g_msg1", "^9Next map is ^7"..map_next)
      et.trap_Cvar_Set("nextmapinfo", "echo Next map is "..map_next)
      if (et.trap_Cvar_Get("g_weaponScriptsDir") == "") then
         et.trap_Cvar_Set("g_weaponScriptsDir", "g_weaponScriptsDir/default")
      et.trap_Cvar_Set("warmup", "1")

into your "randommap.lua" file (or some file, which included into server as Lua Module) you will see, that messages are not obsolete. So, I offer you to make full modify of this file, I see something here is not really need.

It should be very great because when you joining the game and seeing message "The next map is ctf-face-fp1_fixed" you are happy, but when next map is loading you are seeing for example "gold rush".. (i mean server loads some map which you don't like) :shock: :? ...

I have script of PPSH for nitmod. But i can't load it here. If you want this I can send it to you to set it up on server.
Posts: 7
Joined: 01 Jan 2018, 19:59
Cash on hand: 13,460.00

Re: Offer of new script for "Random Map" mode

Postby ETc|Exagone » 14 Sep 2018, 14:52

The updated version of the random next map Lua script is here. It was completely rewritten compared to the older version written by Nitrox and I.
As far as I understand it, when it does not load the next map that was set, it is caused by a nitmod bug. But since nitmod is not open source I can't debug and make sure this is the case.
When you have access to server logs, you see that it loads the Lua script as usual, but instead of entering in warmup, it skips the map and loads the new next one, and it does that like 4 times before going back to a normal state. The only idea I have would be to set the current map as next map until we are sure to be in warmup, but it's not very clean behavior (haven't tested, I don't know how nitmod would react). I think this is close to what I see here in your script with the custom "warmup" cvar, but instead it does not set a nextmap for the first InitGame hook call.
ETc|Exagone aka Exagone313
User avatar
ETc| Member
Posts: 42
Joined: 23 Oct 2009, 11:52
Cash on hand: 37,178.00
Location: France

Return to Wolfenstein Enemy Territory

Who is online

Users browsing this forum: No registered users and 2 guests