Garry's Mod Wiki

Garry's Mod Wiki

  ENTITY:Initialize()

Description

Called when the entity is created. This is called when you Entity:Spawn the custom entity.

This is called after ENTITY:SetupDataTables and GM:OnEntityCreated.

Example

Example Initialize function

function ENT:Initialize() -- Sets what model to use self:SetModel( "models/props/cs_assault/money.mdl" ) -- Sets what color to use self:SetColor( Color( 200, 255, 200 ) ) -- Physics stuff self:SetMoveType( MOVETYPE_VPHYSICS ) self:SetSolid( SOLID_VPHYSICS ) -- Init physics only on server, so it doesn't mess up physgun beam if ( SERVER ) then self:PhysicsInit( SOLID_VPHYSICS ) end -- Make prop to fall on spawn self:PhysWake() end

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...