• Error loading gamemode: !IsValidGamemode [sim]
    6 replies, posted
I've Googled this problem a lot and haven't been able to find a solution. I have no idea why it won't work since I have exactly the same code on [url=http://wiki.garrysmod.com/page/Gamemode_Creation]Gamemode Creation[/url] on the wiki (except with my information in it). I've made Lua addons before, but I thought I might try my hand at making a gamemode, and fell at the first hurdle. My folder structure: [code]garrysmod - gamemodes -- sim --- content --- entities --- gamemode ---- cl_init.lua ---- init.lua ---- shared.lua --- icon24.png --- logo.png --- sim.txt[/code] And here's the code I have: [b]cl_init.lua[/b] [lua]include("shared.lua")[/lua] [b]init.lua[/b] [lua]AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua")[/lua] [b]shared.lua[/b] [lua]GM.Name = "Sim" GM.Author = "Chifilly" GM.Email = "admin@chifilly.co.uk" GM.Website = "http://www.chifilly.co.uk" function GM:Initialize() end[/lua] [b]sim.txt[/b] [code]"sim" { "base" "base" "title" "Sim" "maps" "^sim_" "menusystem" "1" "settings" { } }[/code] I have a feeling that it's something to do with include() because I had problems getting it to work in an addon I was making, so scrapped it and put it all in 1 file. For some reason whenever I use include() it always says that it can't find the file. Any ideas and help would be much appreciated EDIT: In addition to the point about include(), it wasn't because I missed out AddCSLuaFile() because the addons I tried to make with it were serverside only
Why would your lua files not be in the gamemode folder?
Change "sim" to "Gamemode" in sim.txt [QUOTE=Chifilly;40189689] [b]sim.txt[/b] [code]"[b]Gamemode[/b]" { "base" "base" "title" "Sim" "maps" "^sim_" "menusystem" "1" "settings" { } }[/code][/QUOTE] [QUOTE=Hydrogengamin;40203231]Why would your lua files not be in the gamemode folder?[/QUOTE] They are. Each "-" represent the file is inside a folder. [QUOTE=Chifilly;40189689] garrysmod - gamemodes -- sim --- content --- entities --- gamemode ---[b]-[/b] cl_init.lua ---[b]-[/b] init.lua ---[b]-[/b] shared.lua --- icon24.png --- logo.png --- sim.txt [/QUOTE]
[QUOTE=Nak;40203592]Change "sim" to "Gamemode" in sim.txt[/QUOTE] Thanks for the help, but that didn't work unfortunately. I've looked at LuaBin too, and seen the TTT gamemode has "terrortown" where "Gamemode" is in terrortown.txt, so it must be something else. It would be SO helpful if the error message was a bit more descriptive, but you can't have it all I suppose. Are there any minimum requirements to have a valid gamemode? (and if that's the case, maybe the wiki could be more helpful and actually tell you that) because all I can think at the moment is either "I'm missing something" or "Lua really doesn't like include() on my game".
How exactly are you chaning the gamemode to "Sim"?
Well originally my sim.txt was [code]"sim" { "base" "base" "title" "Sim" "maps" "^sim_" "menusystem" "1" "settings" { } }[/code] and now it's [code]"Gamemode" { "base" "base" "title" "Sim" "maps" "^sim_" "menusystem" "1" "settings" { } }[/code] if that's what you mean? If you mean how am I loading the gamemode in-game, then I'm just selecting it from the main menu in the selector at the bottom right and starting a new game
[QUOTE=Nak;40203592]Change "sim" to "Gamemode" in sim.txt They are. Each "-" represent the file is inside a folder.[/QUOTE] I'm very sorry but I have done what you have said and it still doesn't work
Sorry, you need to Log In to post a reply to this thread.