Changing the base for Sandbox

I’m working on a new custom base to make gamemodes with (DSGM: http://forum.facepunch.com/showthread.php?t=1272290 )
Its been a while since ive coded on gmod and things have changed. I want to just copy the entire sandbox gamemode and just change the base to my base. I’ve changed its base in the info file but it seems like that didnt change anything. I am seeing DEFINE_BASECLASS( “gamemode_base” ) but i dont know if i need to register my gamemode as a baseclass or something. I’m lost.

Have you tried running your gamemode with the base set as sandbox instead of base, not sure if it would work but its something to try atleast.

Well, the goal is for my gamemode to be a base for other gamemodes. But for testing purposes thats a really great idea! thanks. I’ll just do that for now :slight_smile:

After a bit of research I found this:

[lua]–
– The baseclass module uses upvalues to give the impression of inheritence.

– At the top of your class file add

– DEFINE_BASECLASS( “base_class_name” )

– Now the local variable BaseClass will be available.
– ( in engine DEFINE_BASECLASS is replaced with “local BaseClass = baseclass.Get” )

– Baseclasses are added using baseclass.Set - this is done automatically for:

– > widgets
– > panels
– > drive modes
– > entities
– > weapons

– Classes don’t have to be created in any particular order. The system is
– designed to work with whatever order the classes are defined.

– The only caveat is that classnames must be unique.
– eg Creating a panel and widget with the same name will cause problems.
–[/lua]

Looks like you might need to baseclass.Set(“dsgm”, GM) in your base gamemode and then add DEFINE_BASECLASS(“dsgm”) in your derived gamemode.

DEFINE_BASECLASS seems to simply define a local variable named BaseClass in the current script, so that might not be enough to derive a gamemode from your base gamemode. Try adding DeriveGamemode(“dsgm”) near the beginning of shared.lua too.

Never really messed with custom base gamemodes though so I’m just speculating. I’m a bit surprised that Garry would make it so hard to use custom base gamemodes though. Might be a silly question but just in case:

You do know that the info file is no longer named info.txt, and is named after the gamemode instead, right?

Thank you! I was trying to find some documentation on that. I will see what i can do to get this all working.

yeah I used “Info file” For the lack of a better term.

[editline]23rd May 2013[/editline]

IT WORKS! thanks man :slight_smile:

[editline]23rd May 2013[/editline]

Now I’m getting Couldn’t include file ‘spawnmenu\spawnmenu.lua’ (File not found)
Its totally there too… tableflip

[editline]23rd May 2013[/editline]

Is it AddCSLuaFile()'d and are there no errors pertaining to it at initialize?
Try running:

con_filter_text_out couldn’t
con_filter_enable

to enable a filter that prevents any errorspam if that is an issue. This will let you scroll up and find errors on Initialize.

AddCSLuaFile()'d everything. It works great. Thank you guys so much for all the help :smiley: