Hello, I'm a noob to making gamemodes and I need help with how to make classes in a gamemode. I'm basing it off of the laser dance gamemode but I don't know where to start. Please, I'm desperate! I want to make it so I can select the class with a menu, I currently have it randomly choosen through 10 different classes.
You're using Fretta right? If so look at this: [url=http://wiki.garrysmod.com/?search=Fretta][I]Fretta[/I] [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] The tutorial shows how to make a class.
The Fretta tutorial (from the above link) gives this example:
[lua]local CLASS = {}
CLASS.DisplayName = "Revolver Dude"
CLASS.WalkSpeed = 400
CLASS.CrouchedWalkSpeed = 0.2
CLASS.RunSpeed = 600
CLASS.DuckSpeed = 0.2
CLASS.JumpPower = 200
CLASS.PlayerModel = "models/players/breen.mdl"
CLASS.DrawTeamRing = true
CLASS.DrawViewModel = true
CLASS.CanUseFlashlight = true
CLASS.MaxHealth = 100
CLASS.StartHealth = 100
CLASS.StartArmor = 0
CLASS.RespawnTime = 0 // 0 means use the default spawn time chosen by gamemode
CLASS.DropWeaponOnDie = false
CLASS.TeammateNoCollide = false
CLASS.AvoidPlayers = false // Automatically avoid players that we're no colliding
CLASS.Selectable = true // When false, this disables all the team checking
CLASS.FullRotation = false // Allow the player's model to rotate upwards, etc etc
function CLASS:Loadout( pl )
pl:Give( "weapon_357" )
end
function CLASS:OnSpawn( pl )
end
function CLASS:OnDeath( pl, attacker, dmginfo )
end
function CLASS:Think( pl )
end
function CLASS:Move( pl, mv )
end
function CLASS:OnKeyPress( pl, key )
end
function CLASS:OnKeyRelease( pl, key )
end
function CLASS:ShouldDrawLocalPlayer( pl )
return false
end
function CLASS:CalcView( ply, origin, angles, fov )
end
player_class.Register( "Human", CLASS )[/lua]
I tested many possibilities, I'm not quite sure if I'm doing it right, but no class option shows. Here is my shared.lua
DeriveGamemode( "fretta" )
GM.Help = "Shoot the other team!\n\n Rack up as many kills as you can before the time-limit runs out!."
GM.TeamBased = true
GM.AllowAutoTeam = true
GM.AllowSpectating = true
GM.SelectClass = true
GM.SecondsBetweenTeamSwitches = 10
GM.GameLength = 10
GM.NoPlayerDamage = false
GM.NoPlayerSelfDamage = false
GM.NoPlayerTeamDamage = true
GM.NoPlayerPlayerDamage = false
GM.NoNonPlayerPlayerDamage = false
GM.TakeFragOnSuicide = false
GM.AddFragsToTeamScore = true
TEAM_RED = 1
TEAM_BLUE = 2
function GM:CreateTeams()
if ( !GAMEMODE.TeamBased ) then return end
team.SetUp( TEAM_RED, "Team Red", Color( 255, 80, 80 ) )
team.SetSpawnPoint( TEAM_RED, { "info_player_start", "info_player_terrorist", "info_player_counterterrorist" }, true )
team.SetClass( TEAM_RED, { "redkleiner, redbarney" } )
team.SetUp( TEAM_BLUE, "Team Blue", Color( 80, 150, 255 ) )
team.SetSpawnPoint( TEAM_BLUE, { "info_player_start", "info_player_terrorist", "info_player_counterterrorist" }, true )
team.SetClass( TEAM_BLUE, { "Bluepolice, Bluecombine" } )
team.SetUp( TEAM_SPECTATOR, "Spectators", Color( 200, 200, 200 ), true )
team.SetSpawnPoint( TEAM_SPECTATOR, { "info_player_start", "info_player_terrorist", "info_player_counterterrorist" } )
end
IncludePlayerClasses()
~I have 2 blue classes named bluepolice and bluecombine, I have 2 red ones called redkleiner and redbarney.
Sorry, you need to Log In to post a reply to this thread.