Garry's Mod

Garry's Mod

Not enough ratings
Half-Life 2 Story on Garry's Mod (automatic changelevel)
By stbn.gc
this will allow you to automatically change the maps in the half life 2 campaing with the help of a lua script I found online
   
Award
Favorite
Favorited
Unfavorite
Info
I did NOT made this, so if it doesn't work or eventually stops working from future updates, I'll have no idea how to fix it.
I found this solution online to play the half life 2 campaing without changing levels manually so I'm sharing it here for easy access to everyone i guess.

Credits go to xenondice at GitHub for creating the script, I'm just sharing it as I said.
Cheers and happy co-op with friends!
lua
Copy this code into a file named 'changelevel2.lua' inside the folders: garrysmod\lua\autorun\server

concommand.Add("changelevelauto", function(ply,com,arg) local map = game.GetMap() local hl2maps = {"d1_trainstation_01","d1_trainstation_02","d1_trainstation_03","d1_trainstation_04","d1_trainstation_05","d1_trainstation_06","d1_canals_01","d1_canals_01a","d1_canals_02","d1_canals_03","d1_canals_05","d1_canals_06","d1_canals_07","d1_canals_08","d1_canals_09","d1_canals_10","d1_canals_11","d1_canals_12","d1_canals_13","d1_eli_01","d1_eli_02","d1_town_01","d1_town_01a","d1_town_02","d1_town_03","d1_town_04","d1_town_05","d2_coast_01","d2_coast_03","d2_coast_04","d2_coast_05","d2_coast_07","d2_coast_08","d2_coast_09","d2_coast_10","d2_coast_11","d2_coast_12","d2_prison_01","d2_prison_02","d2_prison_03","d2_prison_04","d2_prison_05","d2_prison_06","d2_prison_07","d2_prison_08","d3_c17_01","d3_c17_02","d3_c17_03","d3_c17_04","d3_c17_05","d3_c17_06a","d3_c17_06b","d3_c17_07","d3_c17_08","d3_c17_09","d3_c17_10a","d3_c17_10b","d3_c17_11","d3_c17_12","d3_c17_12b","d3_c17_13","d3_Citadel_01","d3_Citadel_02","d3_Citadel_03","d3_Citadel_04","d3_Citadel_05","d3_breen_01"}; for i=1,#hl2maps-1 do if (map == hl2maps) then
RunConsoleCommand("changelevel", hl2maps[i+1])
return
end
end
end)
cfg
After that you'll need to activate it by changing the command 'changelevel2' into the one from the script (changelevelauto).
Locate the file 'server.gfc' inside garrysmod/cfg, edit it and add the following line:
alias changelevel2 changelevelauto
4 Comments
madxruler [GE:S] 2 Jan, 2021 @ 1:02pm 
you might be right. I looked it up on google but came to no avail.
stbn.gc  [author] 1 Jan, 2021 @ 7:26pm 
yeah they added this function in an update recently so this is obsolete now, I don't believe you can disable level transitions though
madxruler [GE:S] 1 Jan, 2021 @ 5:44pm 
for some reason i dont have either of these files and it still automatically changes the level. do you know how to disable it?
stbn.gc  [author] 6 Jun, 2019 @ 8:12pm 
also I should mention, this will only work for half life 2 maps