When making an endlevel script (SOLVED)
Quote from StGinger on March 8, 2012, 9:41 amHey, it was - good for you - a long time ago I asked you something. But me and my friend are now done with two full .vmf files, so I think i'm gonna need some advice from you of how to make an endlevel script. I've been reading how to do it at the Mapping Wiki and I think I get almost everything of it. But there is just one (or two) questions, so far. When I go to the script map to create my own script I recognize that those files are .nut files. My computer can not handle that kind of files so do I need to download a .nut program to fix that or can hammer accept a normal .txt file?
Another question as well, When I make my modified instance with the new scrips. Do I need to have a modified one at the ending of mapp 2 as well if I want to take the players to the lobby, or does it somehow "remember" what the script said in the endlevel_room of the first map?
Hey, it was - good for you - a long time ago I asked you something. But me and my friend are now done with two full .vmf files, so I think i'm gonna need some advice from you of how to make an endlevel script. I've been reading how to do it at the Mapping Wiki and I think I get almost everything of it. But there is just one (or two) questions, so far. When I go to the script map to create my own script I recognize that those files are .nut files. My computer can not handle that kind of files so do I need to download a .nut program to fix that or can hammer accept a normal .txt file?
Another question as well, When I make my modified instance with the new scrips. Do I need to have a modified one at the ending of mapp 2 as well if I want to take the players to the lobby, or does it somehow "remember" what the script said in the endlevel_room of the first map?
Quote from Lpfreaky90 on March 8, 2012, 9:58 amStGinger wrote:Hey, it was - good for you - a long time ago I asked you something. But me and my friend are now done with two full .vmf files, so I think i'm gonna need some advice from you of how to make an endlevel script. I've been reading how to do it at the Mapping Wiki and I think I get almost everything of it. But there is just one (or two) questions, so far. When I go to the script map to create my own script I recognize that those files are .nut files. My computer can not handle that kind of files so do I need to download a .nut program to fix that or can hammer accept a normal .txt file?It needs to be a .nut file.
To create this just open the .nut file with notpad and save it under another name, once again with the .nut extention, that shouldn't be much of a problem.StGinger wrote:Another question as well, When I make my modified instance with the new scrips. Do I need to have a modified one at the ending of mapp 2 as well if I want to take the players to the lobby, or does it somehow "remember" what the script said in the endlevel_room of the first map?If you just make a transition list with these two maps finishing the second will automatically sent you back to the main menu
It needs to be a .nut file.
To create this just open the .nut file with notpad and save it under another name, once again with the .nut extention, that shouldn't be much of a problem.
If you just make a transition list with these two maps finishing the second will automatically sent you back to the main menu ![]()
Quote from StGinger on March 8, 2012, 10:58 amOfc I was wrong. If I describe how I do, I would be glad if someone could detect any fails i'm making.
First I make a .vmf file named "mp_coop_moose", there i make just 4 walls and place a coop spawnroom and my modified endlevel room. Then I compile it.
Then I make a new .vmf file named "mp_coop_moose_two", I do exactly as the first map and then I compile it.
This is my script:
// Map order
MapPlayOrder<- [
"mp_coop_moose",
"mp_coop_moose_two",
"mp_coop_lobby_2"
]function TransitionFromMap()
{
local nextmap = -2// Loop through maps
foreach( index, map in MapPlayOrder )
{
if( GetMapName() == MapPlayOrder[index] )
{
// This is the map we're on
nextmap = -1
}
else
{
if (nextmap == -1)
{
// This is the first map past that one
nextmap = index
}
}
}printl( "nextmap = " + nextmap )
if (nextmap > 0)
{
// We found a map; go to it
EntFire( "@command", "command", "changelevel " + MapPlayOrder[nextmap], 1.0 )
}
else
{
// No map found; we're done
EntFire( "@command", "command", "disconnect", 2.0 )
}When I load the mp_coop_moose map (in splitscreen mode) and try to get to the next level, it just keeps loading. In the consle I can see that the "nextmap" was set to 1.
Can anyone see the problem, or is it simply becouse I cant try this in splitscreen mode?
Ofc I was wrong. If I describe how I do, I would be glad if someone could detect any fails i'm making.
First I make a .vmf file named "mp_coop_moose", there i make just 4 walls and place a coop spawnroom and my modified endlevel room. Then I compile it.
Then I make a new .vmf file named "mp_coop_moose_two", I do exactly as the first map and then I compile it.
This is my script:
// Map order
MapPlayOrder<- [
"mp_coop_moose",
"mp_coop_moose_two",
"mp_coop_lobby_2"
]
function TransitionFromMap()
{
local nextmap = -2
// Loop through maps
foreach( index, map in MapPlayOrder )
{
if( GetMapName() == MapPlayOrder[index] )
{
// This is the map we're on
nextmap = -1
}
else
{
if (nextmap == -1)
{
// This is the first map past that one
nextmap = index
}
}
}
printl( "nextmap = " + nextmap )
if (nextmap > 0)
{
// We found a map; go to it
EntFire( "@command", "command", "changelevel " + MapPlayOrder[nextmap], 1.0 )
}
else
{
// No map found; we're done
EntFire( "@command", "command", "disconnect", 2.0 )
}
When I load the mp_coop_moose map (in splitscreen mode) and try to get to the next level, it just keeps loading. In the consle I can see that the "nextmap" was set to 1.
Can anyone see the problem, or is it simply becouse I cant try this in splitscreen mode?
Quote from StGinger on March 8, 2012, 11:10 amBtw, I did not REPLACE the existing script, I only made the transition_script find my own script AS WELL
Btw, I did not REPLACE the existing script, I only made the transition_script find my own script AS WELL
Quote from StGinger on March 8, 2012, 11:36 amOh God I hate this. When I used my modified endlevel it went well at first to aty least be in the map (even if I could not change map). But ever since the second time I loaded it, the player completelly ignores the rule of gravity, and i cant even move with the players unless I use noclip. I have even tested to make new maps and it is the endlevels fault. How can I even manage to do so many wrongs? And why the f*ck did it work the first time?
Oh God I hate this. When I used my modified endlevel it went well at first to aty least be in the map (even if I could not change map). But ever since the second time I loaded it, the player completelly ignores the rule of gravity, and i cant even move with the players unless I use noclip. I have even tested to make new maps and it is the endlevels fault. How can I even manage to do so many wrongs? And why the f*ck did it work the first time?
Quote from StGinger on March 8, 2012, 11:53 amOkey so I solved the latest problem through REPLACING. But it does still not yet switch maps.
Okey so I solved the latest problem through REPLACING. But it does still not yet switch maps.
Quote from Spam Nugget on March 8, 2012, 4:23 pmDO NOT post 5 times in a row. Not unless you wish for a painful death.
DO NOT post 5 times in a row. Not unless you wish for a painful death.

I think in terms of boolean variables. Generally, it makes things easier.
Quote from ChickenMobile on March 8, 2012, 8:12 pmCheck the console to see if you are getting any errors (like map doesn't exist) to see if the transition script is actually doing something but not changing the map.
Check the console to see if you are getting any errors (like map doesn't exist) to see if the transition script is actually doing something but not changing the map.

