• Gamemode help
    3 replies, posted
Hi. Im a newbie Lua scripter and I'm trying to make a test gamemode. So far, so good. I followed some Gamemode tutorials on the wiki, but: I stumpled on a problem. When I have a team, how do I add classes to that team ? Like, Team 1 and Team 2, then I would like to add Armsman and a magician and a Fighter and an assassin to Team 2. First, I would set-up the teams: [lua] TEAM_ONE = 1 function GM:CreateTeams() if ( !GAMEMODE.TeamBased ) then return end team.SetUp( TEAM_ONE, "Team 1", Color( 50, 255, 50 ), true ) team.SetSpawnPoint( TEAM_ONE, { "info_player_start", "info_player_terrorist", "info_player_rebel", "info_player_deathmatch" } ) team.SetClass( TEAM_ONE, { "Team 1" } ) // "Human" is the class we want players to use team.SetUp( TEAM_SPECTATOR, "Spectators", Color( 200, 200, 200 ), true ) team.SetSpawnPoint( TEAM_SPECTATOR, { "info_player_start", "info_player_terrorist", "info_player_counterterrorist", "info_player_combine", "info_player_rebel" } ) end TEAM_TWO = 2 function GM:CreateTeams() if ( !GAMEMODE.TeamBased ) then return end team.SetUp( TEAM_TWO, "Team 2", Color( 50, 255, 50 ), true ) team.SetSpawnPoint( TEAM_TWO, { "info_player_start", "info_player_terrorist", "info_player_rebel", "info_player_deathmatch" } ) team.SetClass( TEAM_TWO, { "Team 2" } ) // "Human" is the class we want players to use team.SetUp( TEAM_SPECTATOR, "Spectators", Color( 200, 200, 200 ), true ) team.SetSpawnPoint( TEAM_SPECTATOR, { "info_player_start", "info_player_terrorist", "info_player_counterterrorist", "info_player_combine", "info_player_rebel" } ) end [/lua] (Dont mind the comments, it's copy pasted) Ok, then I would add a class; [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] Now; How can I add this specific class to this team only ? I hope I get some respond on this. Thanks in advance! - Busy
I am assuming this is Fretta? Cause Fretta is the only gamemode base that has the abillity to use CLASSES for team. Correct me if I am wrong.
This is Fretta, yes. But is it possible ?
This would be the correct code for shared.lua, yes? : [lua] TEAM_ONE = 1 TEAM_TWO = 2 function GM:CreateTeams() if ( !GAMEMODE.TeamBased ) then return end team.SetUp( TEAM_ONE, "Team ONE Members", Color( 255, 0, 0, 255 ), true ) team.SetSpawnPoint( TEAM_ONE, { "info_player_terrorist" } ) team.SetClass( TEAM_ONE, { "Armsman", "Magician" } ) team.SetUp( TEAM_TWO, "Team TWO Member", Color( 0, 0, 255, 255 ), true ) team.SetSpawnPoint( TEAM_TWO, { "info_player_counterterrorist" } ) team.SetClass( TEAM_TWO, { "Fighter", "Assassin" } ) team.SetUp( TEAM_SPECTATOR, "Spectators", Color( 200, 200, 200 ), true ) team.SetSpawnPoint( TEAM_SPECTATOR, { "info_player_start", "info_player_terrorist", "info_player_counterterrorist", "info_player_combine", "info_player_rebel" } ) end [/lua]
Sorry, you need to Log In to post a reply to this thread.