User:Alvin/Sandbox: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
Line 265: Line 265:




----
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
AddCSLuaFile( "shared.lua" )

Revision as of 20:47, 19 July 2011

Source Engine 2009

"Garry's Mod" (Tools > Options > Edit > Add)

Game Data Files: (orangebox/bin) HalfLife2.fgd = Ep2 (HL2 as well) base.fgd cstrike.fgd = CS:S dod.fgd = DoD:S hl2mp.fgd = HL2:DM (could be needed) portal.fgd = Portal tf.fgd = TF2 (garrysmod/garrysmod) Garrysmod.fgd (optional lang.)


Default Point Entity class: info_player_start

Default SolidEntity class: func_detail

Cordon Texture: tools/toolsskybox

Game Executable Directory: $SteamUserDir\garrysmod

Game Directory: $SteamUserDir\garrysmod\garrysmod

Hammer VMF Directory: (Where you want to save and load VMF saves for Garrysmod) i use.. $SteamUserDir\garrysmod\garrysmod\maps\vmf

Now go to the last Tab, Build programs..

Game Executable: $SteamUserDir\garrysmod\hl2.exe

BSP $SteamUserDir\sourcesdk\bin\orangebox\bin\vbsp.exe

VIS $SteamUserDir\sourcesdk\bin\orangebox\bin\vvis.exe

RAD $SteamUserDir\sourcesdk\bin\orangebox\bin\vrad.exe

Place compiled maps... $SteamUserDir\garrysmod\garrysmod\maps

It will say that the changes will show when you open hammer another time but you need to restart Source SDK if you made a new config in order to see your new config in the selection menu.


Tagalog, pwede ba? :(

CS:S NPC Lua Script

local Category = "CSS"

local NPC = { Name = "Hostage 1", Class = "npc_citizen", Model = "models/characters/hostage_01.mdl", Health = "100", KeyValues = { Squadname = "hostages" }, KeyValues = { citizentype = 4 }, Category = Category }


list.Set( "NPC", "css_hostage_1", NPC )


local NPC = { Name = "Hostage 2", Class = "npc_citizen", Model = "models/characters/hostage_02.mdl", Health = "100", KeyValues = { Squadname = "hostages" }, KeyValues = { citizentype = 4 }, Category = Category }


list.Set( "NPC", "css_hostage_2", NPC )


local NPC = { Name = "Hostage 3", Class = "npc_citizen", Model = "models/characters/hostage_03.mdl", Health = "100", KeyValues = { Squadname = "hostages" }, KeyValues = { citizentype = 4 }, Category = Category }


list.Set( "NPC", "css_hostage_3", NPC )


local NPC = { Name = "Hostage 4", Class = "npc_citizen", Model = "models/characters/hostage_04.mdl", Health = "100", KeyValues = { Squadname = "hostages" }, KeyValues = { citizentype = 4 }, Category = Category }


list.Set( "NPC", "css_hostage_4", NPC )


local NPC = { Name = "T Arctic", Class = "npc_combine_s", Model = "models/characters/arctic.mdl", Health = "100", KeyValues = { Squadname = "terrors" }, KeyValues = { Numgrenades = "2" }, Category = Category }


list.Set( "NPC", "css_t_arctic", NPC )


local NPC = { Name = "T Guerilla", Class = "npc_combine_s", Model = "models/characters/guerilla.mdl", Health = "100", KeyValues = { Squadname = "terrors" }, KeyValues = { Numgrenades = "2" }, Category = Category }


list.Set( "NPC", "css_t_guerilla", NPC )


local NPC = { Name = "T Leet", Class = "npc_combine_s", Model = "models/characters/leet.mdl", Health = "100", KeyValues = { Squadname = "terrors" }, KeyValues = { Numgrenades = "2" }, Category = Category }


list.Set( "NPC", "css_t_leet", NPC )


local NPC = { Name = "T Phoenix", Class = "npc_combine_s", Model = "models/characters/phoenix.mdl", Health = "100", KeyValues = { Squadname = "terrors" }, KeyValues = { Numgrenades = "2" }, Category = Category }


list.Set( "NPC", "css_t_phoenix", NPC )


local NPC = { Name = "CT SAS", Class = "npc_citizen", Model = "models/characters/gasmask.mdl", Health = "100", KeyValues = { Squadname = "counters" }, KeyValues = { citizentype = 4 }, Category = Category }


list.Set( "NPC", "css_ct_sas", NPC )


local NPC = { Name = "CT GIGN", Class = "npc_citizen", Model = "models/characters/swat.mdl", Health = "100", KeyValues = { Squadname = "counters" }, KeyValues = { citizentype = 4 }, Category = Category }


list.Set( "NPC", "css_ct_gign", NPC )


local NPC = { Name = "CT GSG-9", Class = "npc_citizen", Model = "models/characters/riot.mdl", Health = "100", KeyValues = { Squadname = "counters" }, KeyValues = { citizentype = 4 }, Category = Category }


list.Set( "NPC", "css_ct_gsg9", NPC )


local NPC = { Name = "CT ST-6", Class = "npc_citizen", Model = "models/characters/urban.mdl", Health = "100", KeyValues = { Squadname = "counters" }, KeyValues = { citizentype = 4 }, Category = Category }


list.Set( "NPC", "css_ct_st6", NPC )

Freeman.lua

local Category = "Humans + Resistance"


local NPC = { Name = "Gordon Freeman", Class = "npc_citizen", Model = "models/katharsmodels/gordon_freeman/gordon_freeman.mdl", Health = "100", KeyValues = { citizentype = 4 }, Category = Category }

list.Set( "NPC", "npc_freeman", NPC )

Stargate.lua

-- Small library loader! Therefore no GPL Header (but it's GPLed) StarGate = StarGate or {}; include("stargate/VERSION.lua"); -- Only loads serverside files on server,clientside files on client, shared on both and vgui on client local function ValidToInclude(state) return (state == "server" and SERVER) or ((state == "client" or state == "vgui") and CLIENT) or state == "shared"; end --################# Loads the libraries @aVoN function StarGate.Load() MsgN("======================================================="); MsgN("StarGate Pack: Initializing"); MsgN("Version: "..StarGate.VERSION.."\n"); for _,state in pairs({"shared","server","client","vgui"}) do -- Init always comes at first! if(ValidToInclude(state) and #file.FindInLua("stargate/"..state.."/init.lua") == 1) then MsgN("Loading: stargate/"..state.."/init.lua"); include("stargate/"..state.."/init.lua"); end for _,v in pairs(file.FindInLua("stargate/"..state.."/*.lua")) do if(SERVER and state ~= "server") then AddCSLuaFile("stargate/"..state.."/"..v); -- Add clientside files end if(ValidToInclude(state) and v ~= "init.lua") then MsgN("Loading: stargate/"..state.."/"..v); include("stargate/"..state.."/"..v); end end end if(SERVER) then AddCSLuaFile("autorun/stargate.lua"); -- Ourself of course! AddCSLuaFile("stargate/VERSION.lua"); -- Version AddCSLuaFile("weapons/gmod_tool/stargate_base_tool.lua"); -- Special GMOD Basetool end MsgN("======================================================="); end StarGate.Load();

--################# For the concommand @aVoN function StarGate.CallReload(p,override) -- Override is called in stargate_base/init.lua if someone calls lua_reloadents if(override or (not ValidEntity(p) or SinglePlayer() or p:IsAdmin())) then StarGate.Load(); for _,v in pairs(player.GetAll()) do v:SendLua("StarGate.Load()"); end else p:SendLua("StarGate.Load()"); end end

if SERVER then concommand.Add("stargate_reload",StarGate.CallReload); end

Ringtransporter init.lua

AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) include('shared.lua')

function ENT:Initialize() self.Entity:SetModel("models/Zup/sg_rings/ring.mdl") self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType(MOVETYPE_VPHYSICS) self.Entity:SetSolid(SOLID_VPHYSICS)

self.Phys=self.Entity:GetPhysicsObject() self.Phys:EnableCollisions(false) self.Phys:Wake() self.Phys:EnableMotion(true)

self.Parent=self.Entity:GetParent() self.Entity:SetParent(nil)

self.ReachedPos=true self.DesiredPos=self.Entity:GetPos() self.Return=true self.Ang=self.Entity:GetAngles() self.Entity:StartMotionController()

self.Entity:SetTrigger(true) end

function ENT:PhysicsSimulate( phys, deltatime ) phys:Wake() local pr={} pr.secondstoarrive = 1 local pos=self.Parent:LocalToWorld(self.DesiredPos) pr.pos = pos if self.Return then pr.pos = self.Parent:GetPos() end pr.maxangular = 5000 pr.maxangulardamp = 10000 pr.maxspeed = 10000 pr.maxspeeddamp = 100000 pr.dampfactor = 0.2 if not self.Return and self.ReachedPos then pr.secondstoarrive = 0.01 pr.dampfactor = 1 end pr.teleportdistance = 10000 pr.angle = self.Ang pr.deltatime = deltatime phys:ComputeShadowControl(pr) end

function ENT:GotoPos(len) if not self or not self.Entity or not self.Entity:IsValid() then return end self.Return=false self.ReachedPos=false self.DesiredPos=len end

function ENT:StartTouch(ent) if self.ReachedPos then return end if ent:GetClass()=="prop_physics" or ent:IsPlayer() then ent:TakeDamage(1000, self.Entity) end end

function ENT:ReturnPos() if not self or not self.Entity or not self.Entity:IsValid() then return end self.Return=true end

function ENT:Think() if not self.ReachedPos then local pos=self.Parent:LocalToWorld(self.DesiredPos) if self.Entity:GetPos():Distance(pos)<10 then self.ReachedPos=true self.Parent:ReportReachedPos(self.Entity) end end end