Calm down, m8. It works in the console. Must be another broken script function in MoHAA. It's in the game module classes, clearly. See for yourself:
map ( String map_name )
Starts the specified map.
You can stufftext it but I think all your clients just will load that map clientside, but you don't want to use the "map"-command anyways 'cause you'll play the map as if it were singleplayer (immediately spawned and requiring script to get a gun).
Method 1
I'll try to explain how to go from level to level. Best to have your maplist backed up or something. I don't know what effects this has on the server rotation.
You got two choices:
bsptransition ( String next_map )
Transitions to the next BSP. Keeps player data, and game data.
and...
leveltransition ( String next_map )
Transitions to the next Level. Statistics to Map Loading, does not keep player data or game data.
I'll use bsptransition in this case, but it works with both the same way.
These commands were originally meant to be used in singleplayer. In singleplayer they can respond to mapnames. In multiplayer these commands just go to the next map in the maplist.
As a workaround you can set the map you want to switch to, thus over-riding the current "next map". So to preserve this we'll record the original setting of the nextmap cvar and set to the one we want for a split second:
Code: Select all
//save nextmap cvar
local.orig_nextmap = getcvar "nextmap"
//set to the map we want
setcvar "nextmap" "folder/mapname"
Folder being either dm, obj or nothing (no / in the latter one) and mapname, the name of the bsp without extensions (no .bsp etc...).
It still won't work, because since these were made for singleplayer, bsptransition and leveltransition commands get ignored if a stock gametype is set. So we'll record the current gametype, set g_gametype to 0 and then when the map is transitioning we set it back to the original gametype setting.
Code: Select all
//save gametype
local.gametype = getcvar "g_gametype"
//set to "singleplayer gametype"
setcvar "g_gametype" "0"
//change map...use nextmap or use dm/mohdm7 or something,
// it will always go to the next map
//doesn't really matter what is put here
bsptransition nextmap
//set back to original gametype
setcvar "g_gametype" local.gametype
waitframe // (!!)
//restore the nextmap cvar
setcvar "nextmap" local.orig_nextmap
Method 2
There's also another method using a trigger_changelevel. Kind of the same, I don't think it saves game data etc...
First record and set the nextmap cvar because it unfortunately also takes the next map in the maplist (because it was used in singleplayer as well). So we'll alter this first:
Code: Select all
//save nextmap cvar
local.orig_nextmap = getcvar "nextmap"
//set to the map we want
setcvar "nextmap" "folder/mapname"
Next set up the trigger and set the target map (doesn't matter what you put here, same for the bsptransition. Nextmap or dm/mohdm3... it just goes to the next map).
Code: Select all
local.trigger = spawn trigger_changelevel origin ( 0 0 0 ) map nextmap
Now we're not going to wait for a player to trigger it, so we'll do it script-wise:
Code: Select all
// Activate trigger for the "world"
local.trigger doActivate $world
waitframe // (!!)
//restore nextmap cvar
setcvar "nextmap" local.orig_nextmap
I hope it helps
