Gmod cannot find my entity?

Alright so I’ve been trying my best to find a solution on my own with the various resources given to me, but I cant seem to find my problem, so please help my sorry ass with this code.
The item is called a sun_cannon, its located within the gamemode’s entities/entites folder. Ive been trying to spawn this thing via the concommand i added in the shared file, but when I try it it says that the entity is null, and that it cant find any entity called sun_cannon. thank you.

init.lua



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

ENT.MODEL = "models/props_c17/oildrum001.mdl"

function ENT:SpawnFunction( ply, tr ) 
        if ( !tr.Hit ) then return end       
        local SpawnPos = tr.HitPos + tr.HitNormal * 16      
        local ent = ents.Create( "sun_cannon" )
                ent:SetPos( SpawnPos )
        ent:Spawn()
        ent:Activate()       
        return ent
       
end

function ENT:Initialize()	
	print("I wonder if it reads this before I spawn?")
	self.Entity:SetName("sun_cannon")
	self.topos = self.Entity:GetPos()
	self.Entity:SetColor(0,0,0,256)
	self.Entity:SetMaterial("")
	self.Entity:DrawShadow(true)
	self.Entity:PhysicsInit(SOLID_VPHYSICS)
	self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
	self.Entity:SetSolid(SOLID_VPHYSICS)
	local phys = self:GetPhysicsObject()
	if (phys:IsValid()) then	
		phys:SetMass( 100 )
		phys:Wake()
		phys:EnableGravity( false )		
	end	
	self.Entity:SetCollisionGroup(COLLISION_GROUP_DEBRIS)	
	self.explode = false;
	self:Entity:SetVar("IAmA","sun_cannon")
	self:Entity:SetVar("IBelongIn","towers")
	local phys = self.Entity:GetPhysicsObject()  	
	if (phys:IsValid()) then  		
		phys:EnableMotion(false)
		phys:SetMass(10)
	end
end

function ENT:OnTakeDamage(dmg)
	
end

function ENT:OnRemove()
	if (self.light:IsValid()) then
		self.light:SetParent()
		self.light:Fire("TurnOff",0,0);
		self.light:Fire("kill",0,0.1)
	end
end

function ENT:Explode(pos,magnitude,time)
	local time_ = time or 0
	local bang = ents.Create("env_explosion")
	bang:SetPos(pos)
	bang:SetKeyValue("iMagnitude",magnitude) 
	bang:Spawn()
	bang:Fire("explode","",time_)
	bang:Fire("kill","",time_+1.5)
end


cl_init.lua



include("shared.lua")


shared.lua



ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Sun Cannon"
ENT.Author = "Gnossienne"
ENT.Spawnable = true
ENT.AdminSpawnable = true
 
function SpawnSunCannon()
	local ply = Entity(1) 
	local tr = ply:GetEyeTrace() 
	local ent = ents.Create("sun_cannon") 
	ent:SetPos(tr.HitPos) 
	if(ent:IsValid()) then
		ent:Spawn(ply, tr)
	else
		print("Object missing parameters?")
	end
end

concommand.Add( "Spawn_Sun_Cannon", SpawnSunCannon)


Odds are you fucked up something in your code and it cannot load.
Errors in console when the gamemode loads?

[editline]30th June 2012[/editline]

ENT.MODEL = “models/props_c17/oildrum001.mdl”

That… Thats probably whats screwing you over.
You cannot do this. You must use self:SetModel(“models/props_c17/oildrum001.mdl”)

I changed the code you pointed out but its still erroring out, here whats happening in console.



] spawn_sun_cannon
Can't find factory for entity: sun_cannon
[@gamemodes
etstorm\entities\entities\sun_cannon\shared.lua:12] Tried to use a NULL entity!


Are you able to spawn it normally via the Q menu?

[editline]30th June 2012[/editline]

Also… When you change the level with the gamemode loaded… It has to load the entities first… look for errors in that section.

Excuse my console, my game is a broken mess.



maxplayers set to 8
Network: IP 192.168.0.108, mode MP, dedicated No, ports 27015 SV / 27005 CL
Browser Message: Uncaught ReferenceError: SetStatusChanged is not defined - (null):0
Browser Message: Uncaught ReferenceError: SetStatusChanged is not defined - (null):0
Lua initialized (Lua 5.1)
======== Installing Table (De)Serialiser Module | ver: 1.4 ========
================================
===  Wire  2137 (exported)   Installed  ===
================================
======== Beam NetVars Lib v0.71 Installed ========
ERROR! Module 'zlib_b64' not found!
==== Advanced Duplicator v.1.72 shared module installed! ====
Added EntCheckHook: AdvDupe_NoItems
Added EntCheckHook: AdvDupe_DisallowedClasses
Added EntCheckHook: AdvDupe_ModelCheck
==== Advanced Duplicator v.1.85 server module installed! ====
Registering gamemode 'NetStorm' derived from 'base'
ScriptEnforce is disabled
[addons\wire\lua\entities\gmod_wire_expression2\core\core.lua:230] '=' expected near 'number'
[addons\wire\lua\entities\gmod_wire_expression2\core\array.lua:29] '=' expected near 'array'
[addons\wire\lua\entities\gmod_wire_expression2\core
umber.lua:234] '=' expected near 'number'
[addons\wire\lua\entities\gmod_wire_expression2\core\vector.lua:197] '=' expected near 'normal'
[addons\wire\lua\entities\gmod_wire_expression2\core\string.lua:110] '=' expected near 'number'
[addons\wire\lua\entities\gmod_wire_expression2\core\angle.lua:23] '=' expected near 'angle'
[addons\wire\lua\entities\gmod_wire_expression2\core\entity.lua:53] '=' expected near 'entity'
[addons\wire\lua\entities\gmod_wire_expression2\core\player.lua:19] '=' expected near 'number'
[addons\wire\lua\entities\gmod_wire_expression2\core	imer.lua:64] '=' expected near 'void'
[addons\wire\lua\entities\gmod_wire_expression2\core\selfaware.lua:7] '=' expected near 'entity'
[addons\wire\lua\entities\gmod_wire_expression2\core\unitconv.lua:86] '=' expected near 'number'
[addons\wire\lua\entities\gmod_wire_expression2\core\wirelink.lua:106] '=' expected near 'wirelink'
[addons\wire\lua\entities\gmod_wire_expression2\core\console.lua:30] '=' expected near 'number'
[addons\wire\lua\entities\gmod_wire_expression2\core\find.lua:314] '=' expected near 'number'
[addons\wire\lua\entities\gmod_wire_expression2\core\files.lua:28] '=' expected near 'void'
[addons\wire\lua\entities\gmod_wire_expression2\core\globalvars.lua:32] '=' expected near 'void'
[addons\wire\lua\entities\gmod_wire_expression2\core\ranger.lua:135] '=' expected near 'ranger'
[addons\wire\lua\entities\gmod_wire_expression2\core\sound.lua:56] '=' expected near 'void'
[addons\wire\lua\entities\gmod_wire_expression2\core\color.lua:14] '=' expected near 'vector'
[addons\wire\lua\entities\gmod_wire_expression2\core\serverinfo.lua:5] '=' expected near 'string'
[addons\wire\lua\entities\gmod_wire_expression2\core\chat.lua:51] '=' expected near 'void'
[addons\wire\lua\entities\gmod_wire_expression2\core\constraint.lua:31] '=' expected near 'array'
[addons\wire\lua\entities\gmod_wire_expression2\core\weapon.lua:7] '=' expected near 'entity'
[addons\wire\lua\entities\gmod_wire_expression2\core\gametick.lua:15] '=' expected near 'void'
[addons\wire\lua\entities\gmod_wire_expression2\core
pc.lua:13] '=' expected near 'void'
[addons\wire\lua\entities\gmod_wire_expression2\core\matrix.lua:57] '=' expected near 'matrix2'
[addons\wire\lua\entities\gmod_wire_expression2\core\vector2.lua:149] '=' expected near 'normal'
[addons\wire\lua\entities\gmod_wire_expression2\core\signal.lua:106] '=' expected near 'void'
[addons\wire\lua\entities\gmod_wire_expression2\core\bone.lua:109] '=' expected near 'number'
[addons\wire\lua\entities\gmod_wire_expression2\core	able.lua:63] '=' expected near 'table'
[addons\wire\lua\entities\gmod_wire_expression2\core\glon.lua:6] '=' expected near 'string'
[addons\wire\lua\entities\gmod_wire_expression2\core\hologram.lua:377] '=' expected near 'entity'
[addons\wire\lua\entities\gmod_wire_expression2\core\complex.lua:86] '=' expected near 'complex'
[addons\wire\lua\entities\gmod_wire_expression2\core\bitwise.lua:3] '=' expected near 'number'
[addons\wire\lua\entities\gmod_wire_expression2\core\quaternion.lua:111] '=' expected near 'quaternion'
[addons\wire\lua\entities\gmod_wire_expression2\core\debug.lua:27] '=' expected near 'void'
[addons\wire\lua\entities\gmod_wire_expression2\core\compat.lua:3] '=' expected near 'string'
[addons\wire\lua\entities\gmod_wire_expression2\core\datasignal.lua:231] '=' expected near 'void'
[gamemodes
etstorm\entities\entities\sun_cannon\init.lua:36] function arguments expected near ':'
Compressing lua files into data pack..
Skipped. Datapack exists.
Couldn't find scene 'scenes/npc/female01/question21.vcd'
Couldn't find scene 'scenes/npc/female01/question31.vcd'
Couldn't find scene 'scenes/npc/female01/answer35.vcd'
Couldn't find scene 'scenes/npc/female01/gordead_ques03a.vcd'
Couldn't find scene 'scenes/npc/female01/gordead_ques03b.vcd'
Couldn't find scene 'scenes/npc/female01/nice.vcd'
Couldn't find scene 'scenes/npc/male01/nice01.vcd'
Couldn't find scene 'scenes/npc/male01/nice02.vcd'
Couldn't find scene 'scenes/npc/female01/oneforme.vcd'
Couldn't find scene 'scenes/npc/Barney/ba_run.vcd'
Couldn't find scene 'scenes/npc/Barney/ba_ohshit.vcd'
Couldn't find scene 'scenes/npc/Barney/ba_thisisbad.vcd'
Couldn't find scene 'scenes/npc/Barney/ba_headcrabs.vcd'
Hook 'gmod_wire_hologram_shared' Failed: [addons\wire\lua\entities\gmod_wire_hologram\shared.lua:14] attempt to index field 'base_gmodentity' (a nil value)
Executing main config file... 
Unknown command "pausable"
Unknown command "sbox_playergod"
Unknown command "sbox_allownpcs"
Unknown command "sv_client_interpolate"
Unknown command "mp_logmessages"
Server configuration was successfully updated! 
'cheaters.cfg' not present; not executing.

[L] NetStorm (Whats below Alpha?)
Map: gm_construct
Players: 1 / 8
Build: 4981
Server Number: 1

No pure server whitelist. sv_pure = 0
DOWNLOAD FAILED CODE: 52
Toybox Auth Error: [Download Failed] (retying in 0 seconds)
Browser Message: Uncaught ReferenceError: SetStatusChanged is not defined - (null):0
Decompressing data pack into virtual file system..
Data pack loaded: 466 files. (1.597s)
Lua initialized (Lua 5.1)
======== Installing Table (De)Serialiser Module | ver: 1.4 ========
======== Beam NetVars Lib v0.71 Installed ========
--- Missing Vgui material ignore_this_error
loading materials
loading material: cable/rope_icon
loading material: cable/cable2
loading material: cable/xbeam
loading material: cable/redlaser
loading material: cable/blue_elec
loading material: cable/physbeam
loading material: cable/hydra
loading material: arrowire/arrowire
loading material: arrowire/arrowire2
=== Loading Wire Model Packs ===
	Loaded: bull_buttons.txt
	Loaded: cheeze_buttons2.txt
	Loaded: default.txt
	Loaded: expression2.txt
	Loaded: PHXWireModels.txt
	Loaded: wire_model_pack_1.txt
	Loaded: wire_model_pack_1plus.txt
	Adding Cheeze's Buttons Pack
	Adding various Buttons from HL2 and Portal
	Jaanus' Thruster Pack
	Beer's Model pack
RunConsoleCommand blocked - sent before player spawned (sv_tags)
==== Advanced Duplicator v.1.72 shared module installed! ====
==== Advanced Duplicator v.1.741 client module installed! ====
Registering gamemode 'NetStorm' derived from 'base'
Warning: vgui.Create failed to create the VGUI component (Central_Box)
Sending 9 'User Info' ConVars to server (cl_spewuserinfoconvars to see)
Scanning for downloaded fonts..
Reloading Particles..
Didn't find particle function oscillating_movement
Didn't find particle function random_number
Didn't find particle function oscillating_movement
Didn't find particle function oscillating_movement
Didn't find particle function random_number
Didn't find particle function oscillating_movement
Didn't find particle function oscillating_movement
AdvDupeShared: Server Compression: false
================================
===  Wire revision: 0     ===
=== Local Wire revision:0 ===
================================
Hook 'gmod_wire_hologram_shared' Failed: [entities\gmod_wire_hologram\shared.lua:14] attempt to index field 'base_gmodentity' (a nil value)


thanks for pointing this out, I saw the error now, I’m doing my best to fix it myself.

[gamemodes
etstorm\entities\entities\sun_cannon\init.lua:36] function arguments expected near ‘:’

Not sure which one is line 36 since you changed your code since OP

[editline]30th June 2012[/editline]

also, PLEASE use [ LUA ] [ /LUA ] tags instead of code! It puts line numbers…

[editline]30th June 2012[/editline]

Nevermind… I see it

[lua]
self:Entity:SetVar(“IAmA”,“sun_cannon”)
self:Entity:SetVar(“IBelongIn”,“towers”)
[/lua]

use a ’ . ’ instead of ’ : ’

You got it. so heres where I am, there are no more errors appearing in console but the entity is still getting that null error when i try to spawn it.

[LUA]
AddCSLuaFile( “cl_init.lua” )
AddCSLuaFile( “shared.lua” )
include(“shared.lua”)

function ENT:SpawnFunction( ply, tr )
self:SetModel(“models/props_c17/oildrum001.mdl”)
if ( !tr.Hit ) then return end
local SpawnPos = tr.HitPos + tr.HitNormal * 16
local ent = ents.Create( “sun_cannon” )
ent:SetPos( SpawnPos )
ent:Spawn()
ent:Activate()
return ent

end

function ENT:Initialize()
print(“I wonder if it reads this before I spawn?”)
self.Entity:SetName(“sun_cannon”)
self.topos = self.Entity:GetPos()
self.Entity:SetColor(0,0,0,256)
self.Entity:SetMaterial("")
self.Entity:DrawShadow(true)
self.Entity:PhysicsInit(SOLID_VPHYSICS)
self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
self.Entity:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
if (phys:IsValid()) then
phys:SetMass( 100 )
phys:Wake()
phys:EnableGravity( false )
end
self.Entity:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
self.explode = false;
– self:Entity:SetVar(“IAmA”,“sun_cannon”)
– self:Entity:SetVar(“IBelongIn”,“towers”)
local phys = self.Entity:GetPhysicsObject()
if (phys:IsValid()) then
phys:EnableMotion(false)
phys:SetMass(10)
end
end

function ENT:OnTakeDamage(dmg)

end

function ENT:OnRemove()
if (self.light:IsValid()) then
self.light:SetParent()
self.light:Fire(“TurnOff”,0,0);
self.light:Fire(“kill”,0,0.1)
end
end

function ENT:Explode(pos,magnitude,time)
local time_ = time or 0
local bang = ents.Create(“env_explosion”)
bang:SetPos(pos)
bang:SetKeyValue(“iMagnitude”,magnitude)
bang:Spawn()
bang:Fire(“explode”,"",time_)
bang:Fire(“kill”,"",time_+1.5)
end
[/LUA]

cl_init and shared remains unchanged.
thanks for the help.

And you are positively SURE that there is no error being displayed in your console?

The only time the factory error ever occurs is if the entity cannot be generated due to an error in the init, shared, or cl_init…

Could you post your console again? But this time, please delete the wiremod errors :pwn:

Alright, heres what I got with your edits in the code (I changed the : to .)

[LUA]
maxplayers set to 8
Browser Message: Uncaught ReferenceError: SetStatusChanged is not defined - (null):0
Lua initialized (Lua 5.1)
======== Installing Table (De)Serialiser Module | ver: 1.4 ========

=== Wire 2137 (exported) Installed ===

======== Beam NetVars Lib v0.71 Installed ========
==== Advanced Duplicator v.1.72 shared module installed! ====
Added EntCheckHook: AdvDupe_NoItems
Added EntCheckHook: AdvDupe_DisallowedClasses
Added EntCheckHook: AdvDupe_ModelCheck
==== Advanced Duplicator v.1.85 server module installed! ====
Registering gamemode ‘NetStorm’ derived from ‘base’
ScriptEnforce is disabled
Compressing lua files into data pack…
Skipped. Datapack exists.
Hook ‘gmod_wire_hologram_shared’ Failed: [addons\wire\lua\entities\gmod_wire_hologram\shared.lua:14] attempt to index field ‘base_gmodentity’ (a nil value)
Executing main config file…
Unknown command “pausable”
Unknown command “sbox_playergod”
Unknown command “sbox_allownpcs”
Unknown command “sv_client_interpolate”
Unknown command “mp_logmessages”
Server configuration was successfully updated!
‘cheaters.cfg’ not present; not executing.

[L] NetStorm (Whats below Alpha?)
Map: gm_construct
Players: 1 / 8
Build: 4981
Server Number: 4

No pure server whitelist. sv_pure = 0
Decompressing data pack into virtual file system…
Data pack loaded: 468 files. (0.507s)
Lua initialized (Lua 5.1)
======== Installing Table (De)Serialiser Module | ver: 1.4 ========
======== Beam NetVars Lib v0.71 Installed ========
— Missing Vgui material ignore_this_error
loading materials
loading material: cable/rope_icon
loading material: cable/cable2
loading material: cable/xbeam
loading material: cable/redlaser
loading material: cable/blue_elec
loading material: cable/physbeam
loading material: cable/hydra
loading material: arrowire/arrowire
loading material: arrowire/arrowire2
=== Loading Wire Model Packs ===
Loaded: bull_buttons.txt
Loaded: cheeze_buttons2.txt
Loaded: default.txt
Loaded: expression2.txt
Loaded: PHXWireModels.txt
Loaded: wire_model_pack_1.txt
Loaded: wire_model_pack_1plus.txt
Adding Cheeze’s Buttons Pack
Adding various Buttons from HL2 and Portal
Jaanus’ Thruster Pack
Beer’s Model pack
RunConsoleCommand blocked - sent before player spawned (sv_tags)
==== Advanced Duplicator v.1.72 shared module installed! ====
==== Advanced Duplicator v.1.741 client module installed! ====
Registering gamemode ‘NetStorm’ derived from ‘base’
Sending 9 ‘User Info’ ConVars to server (cl_spewuserinfoconvars to see)
Scanning for downloaded fonts…
Reloading Particles…
Didn’t find particle function oscillating_movement
Didn’t find particle function random_number
Didn’t find particle function oscillating_movement
Didn’t find particle function oscillating_movement
Didn’t find particle function random_number
Didn’t find particle function oscillating_movement
Didn’t find particle function oscillating_movement
AdvDupeShared: Server Compression: false

=== Wire revision: 0 ===
=== Local Wire revision:0 ===

Redownloading all lightmaps
] Spawn_Sun_Cannon
Can’t find factory for entity: sun_cannon
[@entities\sun_cannon\shared.lua:12] Tried to use a NULL entity!
[/LUA]

Don’t know mate… I don’t see anything. Although you might have accidentally deleted it for all I know…

You are on GMod12 right? Type “lua_reloadents” in console and show me the results…

I’ve been looking over it and I don’t see anything blatantly wrong with it… but the variable “time_” is messing with it. I’m not too sure you can do that without having something else at the end of the _ …

[editline]30th June 2012[/editline]

Also, just being nitpickey… in your initialization function… you are setting the mass and stuff twice…

[lua]
local phys = self:GetPhysicsObject()
if (phys:IsValid()) then
phys:SetMass( 100 )
phys:Wake()
phys:EnableGravity( false )
end
self.Entity:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
self.explode = false;
self.Entity:SetVar(“IAmA”,“sun_cannon”)
self.Entity:SetVar(“IBelongIn”,“towers”)
local phys = self.Entity:GetPhysicsObject()
if (phys:IsValid()) then
phys:EnableMotion(false)
phys:SetMass(10)
end
[/lua]

[LUA]
] lua_reloadents
[cpp] Reloading Scripted Entities…
[addons\wire\lua\entities\gmod_wire_expression2\core\core.lua:230] ‘=’ expected near ‘number’
[addons\wire\lua\entities\gmod_wire_expression2\core\array.lua:29] ‘=’ expected near ‘array’
[addons\wire\lua\entities\gmod_wire_expression2\core
umber.lua:234] ‘=’ expected near ‘number’
[addons\wire\lua\entities\gmod_wire_expression2\core\vector.lua:197] ‘=’ expected near ‘normal’
[addons\wire\lua\entities\gmod_wire_expression2\core\string.lua:110] ‘=’ expected near ‘number’
[addons\wire\lua\entities\gmod_wire_expression2\core\angle.lua:23] ‘=’ expected near ‘angle’
[addons\wire\lua\entities\gmod_wire_expression2\core\entity.lua:53] ‘=’ expected near ‘entity’
[addons\wire\lua\entities\gmod_wire_expression2\core\player.lua:19] ‘=’ expected near ‘number’
[addons\wire\lua\entities\gmod_wire_expression2\core imer.lua:64] ‘=’ expected near ‘void’
[addons\wire\lua\entities\gmod_wire_expression2\core\selfaware.lua:7] ‘=’ expected near ‘entity’
[addons\wire\lua\entities\gmod_wire_expression2\core\unitconv.lua:86] ‘=’ expected near ‘number’
[addons\wire\lua\entities\gmod_wire_expression2\core\wirelink.lua:106] ‘=’ expected near ‘wirelink’
[addons\wire\lua\entities\gmod_wire_expression2\core\console.lua:30] ‘=’ expected near ‘number’
[addons\wire\lua\entities\gmod_wire_expression2\core\find.lua:314] ‘=’ expected near ‘number’
[addons\wire\lua\entities\gmod_wire_expression2\core\files.lua:28] ‘=’ expected near ‘void’
[addons\wire\lua\entities\gmod_wire_expression2\core\globalvars.lua:32] ‘=’ expected near ‘void’
[addons\wire\lua\entities\gmod_wire_expression2\core\ranger.lua:135] ‘=’ expected near ‘ranger’
[addons\wire\lua\entities\gmod_wire_expression2\core\sound.lua:56] ‘=’ expected near ‘void’
[addons\wire\lua\entities\gmod_wire_expression2\core\color.lua:14] ‘=’ expected near ‘vector’
[addons\wire\lua\entities\gmod_wire_expression2\core\serverinfo.lua:5] ‘=’ expected near ‘string’
[addons\wire\lua\entities\gmod_wire_expression2\core\chat.lua:51] ‘=’ expected near ‘void’
[addons\wire\lua\entities\gmod_wire_expression2\core\constraint.lua:31] ‘=’ expected near ‘array’
[addons\wire\lua\entities\gmod_wire_expression2\core\weapon.lua:7] ‘=’ expected near ‘entity’
[addons\wire\lua\entities\gmod_wire_expression2\core\gametick.lua:15] ‘=’ expected near ‘void’
[addons\wire\lua\entities\gmod_wire_expression2\core
pc.lua:13] ‘=’ expected near ‘void’
[addons\wire\lua\entities\gmod_wire_expression2\core\matrix.lua:57] ‘=’ expected near ‘matrix2’
[addons\wire\lua\entities\gmod_wire_expression2\core\vector2.lua:149] ‘=’ expected near ‘normal’
[addons\wire\lua\entities\gmod_wire_expression2\core\signal.lua:106] ‘=’ expected near ‘void’
[addons\wire\lua\entities\gmod_wire_expression2\core\bone.lua:109] ‘=’ expected near ‘number’
[addons\wire\lua\entities\gmod_wire_expression2\core able.lua:63] ‘=’ expected near ‘table’
[addons\wire\lua\entities\gmod_wire_expression2\core\glon.lua:6] ‘=’ expected near ‘string’
[addons\wire\lua\entities\gmod_wire_expression2\core\hologram.lua:377] ‘=’ expected near ‘entity’
[addons\wire\lua\entities\gmod_wire_expression2\core\complex.lua:86] ‘=’ expected near ‘complex’
[addons\wire\lua\entities\gmod_wire_expression2\core\bitwise.lua:3] ‘=’ expected near ‘number’
[addons\wire\lua\entities\gmod_wire_expression2\core\quaternion.lua:111] ‘=’ expected near ‘quaternion’
[addons\wire\lua\entities\gmod_wire_expression2\core\debug.lua:27] ‘=’ expected near ‘void’
[addons\wire\lua\entities\gmod_wire_expression2\core\compat.lua:3] ‘=’ expected near ‘string’
[addons\wire\lua\entities\gmod_wire_expression2\core\datasignal.lua:231] ‘=’ expected near ‘void’
[cpp] Reloading Scripted Entities…
Unknown command: wire_expression2_friend_status
[/LUA]

Im not sure either, Ive tried changing my code around to where it will spawn something built into the sandbox like dynamite and it works just fine, so it has to be something with the entity.

edit: lol yeah, my minds been in a jumble with this code, it would be easier to organize my thoughts if it would just spawn :<

You know… I feel like an idiot. Im sitting here looking at init thinking thats the issue… Here:

[lua]
ENT.Type = “anim”
ENT.Base = “base_gmodentity”
ENT.PrintName = “Sun Cannon”
ENT.Author = “Gnossienne”
ENT.Spawnable = true
ENT.AdminSpawnable = true

function SpawnSunCannon(ply, cmd, args)
local tr = ply:GetEyeTrace()
local ent = ents.Create(“sun_cannon”)
ent:SetPos(tr.HitPos)
if(ent:IsValid()) then
ent:Spawn()
else
print(“Object missing parameters?”)
end
end
concommand.Add( “Spawn_Sun_Cannon”, SpawnSunCannon)
[/lua]

Use that as your shared.lua… Run that. If it works, Ill explain.

[LUA]
maxplayers set to 8
Browser Message: Uncaught ReferenceError: SetStatusChanged is not defined - (null):0
Lua initialized (Lua 5.1)
======== Installing Table (De)Serialiser Module | ver: 1.4 ========

=== Wire 2137 (exported) Installed ===

======== Beam NetVars Lib v0.71 Installed ========
==== Advanced Duplicator v.1.72 shared module installed! ====
Added EntCheckHook: AdvDupe_NoItems
Added EntCheckHook: AdvDupe_DisallowedClasses
Added EntCheckHook: AdvDupe_ModelCheck
==== Advanced Duplicator v.1.85 server module installed! ====
Registering gamemode ‘NetStorm’ derived from ‘base’
ScriptEnforce is disabled
Compressing lua files into data pack…
Compression complete. 468 files. (0.480s)
Executing main config file…
Unknown command “pausable”
Unknown command “sbox_playergod”
Unknown command “sbox_allownpcs”
Unknown command “sv_client_interpolate”
Unknown command “mp_logmessages”
Server configuration was successfully updated!
‘cheaters.cfg’ not present; not executing.

[L] NetStorm (Whats below Alpha?)
Map: gm_construct
Players: 1 / 8
Build: 4981
Server Number: 6

No pure server whitelist. sv_pure = 0
Browser Message: Uncaught ReferenceError: SetStatusChanged is not defined - (null):0
Browser Message: Uncaught ReferenceError: SetStatusChanged is not defined - (null):0
Decompressing data pack into virtual file system…
Data pack loaded: 468 files. (0.396s)
Lua initialized (Lua 5.1)
======== Installing Table (De)Serialiser Module | ver: 1.4 ========
======== Beam NetVars Lib v0.71 Installed ========
— Missing Vgui material ignore_this_error
loading materials
loading material: cable/rope_icon
loading material: cable/cable2
loading material: cable/xbeam
loading material: cable/redlaser
loading material: cable/blue_elec
loading material: cable/physbeam
loading material: cable/hydra
loading material: arrowire/arrowire
loading material: arrowire/arrowire2
=== Loading Wire Model Packs ===
Loaded: bull_buttons.txt
Loaded: cheeze_buttons2.txt
Loaded: default.txt
Loaded: expression2.txt
Loaded: PHXWireModels.txt
Loaded: wire_model_pack_1.txt
Loaded: wire_model_pack_1plus.txt
Adding Cheeze’s Buttons Pack
Adding various Buttons from HL2 and Portal
Jaanus’ Thruster Pack
Beer’s Model pack
RunConsoleCommand blocked - sent before player spawned (sv_tags)
==== Advanced Duplicator v.1.72 shared module installed! ====
==== Advanced Duplicator v.1.741 client module installed! ====
Registering gamemode ‘NetStorm’ derived from ‘base’
Warning: vgui.Create failed to create the VGUI component (Central_Box)
Sending 9 ‘User Info’ ConVars to server (cl_spewuserinfoconvars to see)
Scanning for downloaded fonts…
Reloading Particles…
Didn’t find particle function oscillating_movement
Didn’t find particle function random_number
Didn’t find particle function oscillating_movement
Didn’t find particle function oscillating_movement
Didn’t find particle function random_number
Didn’t find particle function oscillating_movement
Didn’t find particle function oscillating_movement
AdvDupeShared: Server Compression: false

=== Wire revision: 0 ===
=== Local Wire revision:0 ===

Redownloading all lightmaps
Unknown command: wire_expression2_friend_status
] Spawn_Sun_Cannon
Can’t find factory for entity: sun_cannon
[@entities\sun_cannon\shared.lua:11] Tried to use a NULL entity!
[/LUA]

:frowning: damn… didnt work.

This is with the shared fixed.

[editline]30th June 2012[/editline]

Perhaps Im dumber than I thought, just in case it helps, heres my gamemode files.

init.lua
[LUA]
AddCSLuaFile(“cl_init.lua”)
AddCSLuaFile(“shared.lua”)
include( ‘shared.lua’ )

//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// INITIALIZING
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

TowerArr = {}
BridgeArr = {}

function GM:Initialize()
self.BaseClass:Initialize()
end

function FirstSpawn( ply )

ply:PrintMessage(HUD_PRINTCENTER,"Welcome to the server!")

end

hook.Add( “PlayerInitialSpawn”, “playerInitialSpawn”, FirstSpawn )

function GM:PlayerSpawn( ply )
ply:GodEnable()
ply:GetNoCollideWithTeammates( true )
ply:SetGravity( 0.75 )
ply:SetMaxHealth( 100, true )
ply:SetRunSpeed( 400 )
ply:SetWalkSpeed( 350 )
//ply:Give(“NetStorm_RTS_SWEP”)
//ply:SelectWeapon(“NetStorm_RTS_SWEP”)

--local cam = ents.Create("prop_physics")
--cam:SetNWString("owner", ply:Nick())
--cam:SetModel("models/props_c17/oildrum001.mdl")
--cam:SetColor(255,255,255,0)
--cam:SetPos(Vector(ply:GetPos().x, ply:GetPos().y, ply:GetPos().z + 100))
--cam:SetAngles(Angle(65,180,0))
--cam:Spawn()
--cam:Activate()
--cam:SetMoveType(MOVETYPE_VPHYSICS)
--cam:SetSolid(SOLID_NONE)
--ply:SetViewEntity(cam)
--constraint.Weld(cam, ply, 0, 0, 0, true)
--ply:SnapEyeAngles(Angle(0,180,0))

end

–function GM:OnEntityCreated( Obj )

 --if (Obj.Entity:GetVar("IBelongIn", 0) == "Towers") then
	 --TowerArr[#TowerArr+1] = Obj
 --end

–end
[/LUA]

cl_init.lua
[LUA]
include(‘shared.lua’)
–include(“cl_MouseTracking.lua”)
–include(“cl_panels.lua”)

/---------------------------------------------------------
Setup
---------------------------------------------------------
/

function GM:Initialize()
–gui.EnableScreenClicker(true)
end

function GM:PrePlayerDraw()
return true
end

function GM:HUDShouldDraw(name)
if name == “CHudHealth” or name == “CHudBattery” or name == “CHudSuitPower” then
return false
else
return true
end
end

function GM:SpawnMenuEnabled()
return false
end

function GM:SpawnMenuOpen()
return false
end

function GM:PlayerStartVoice(ply)
print(ply)
end
[/LUA]

shared.lua
[LUA]
GM.Name = “NetStorm (Whats below Alpha?)”
GM.Author = “Gnossienne”
GM.Email = “piratemilk@gmail.com
GM.Website = “http://www.google.com
[/LUA]

Thank you for helping me so far.

Well Fuck.

Well my friend… This is what we call “Debugging the fuck out of it untill the son of a bitch fucking works, or tells us what is going wrong”

Observe:
[lua]
ENT.Type = “anim”
ENT.Base = “base_gmodentity”
ENT.PrintName = “Sun Cannon”
ENT.Author = “Gnossienne”
ENT.Spawnable = true
ENT.AdminSpawnable = true

function SpawnSunCannon(ply, cmd, args)
print(“Starting Trace…”)
local trace = {}
trace.start = ply:EyePos()
trace.endpos = trace.start + ply:GetAimVector() * 100
trace.filter = ply
print(“Tracing Line…”)

local tr = util.TraceLine(trace)

print(tr.HitPos)
if !tr.HitPos then
	print("Trace did not return hit position")
end

ent = ents.Create("sun_cannon") 
print(ent)

ent:SetPos(tr.HitPos)
ent:Spawn()

end
concommand.Add( “Spawn_Sun_Cannon”, SpawnSunCannon)
[/lua]

Try that. :suicide:

Just paste what follows “Starting Trace…”

[LUA]
] Spawn_Sun_Cannon
Starting Trace…
Tracing Line…
738.6284 118.1290 -129.8088
Can’t find factory for entity: sun_cannon
[NULL Entity]
[@entities\sun_cannon\shared.lua:26] Tried to use a NULL entity!
[/LUA]

:suicide: :suicide: :suicide: :suicide: :suicide: :suicide: :suicide: :suicide:

Ok. Last little trick. Move that spawn_sun_cannon out of your entity and into your gamemode’s init.lua

If it still doesn’t work then… I haven’t got a damn clue.

[LUA]
] Spawn_Sun_Cannon
Unknown Command: ‘Spawn_Sun_Cannon’
[/LUA]
gg…

Whoops. :tinfoil: Sorry. Forgot you are on GMod12. In GMod13 commands still work when they are only added serverside… Don’t ask me why…

SHARED.LUA in the gamemode :v:

I should really stay off the forums when I’m drunk.

[LUA]
] Spawn_Sun_Cannon
Starting Trace…
Tracing Line…
742.7153 147.1043 -135.6471
Can’t find factory for entity: sun_cannon
[NULL Entity]
[@NetStorm\gamemode\shared.lua:25] Tried to use a NULL entity!
[/LUA]

still dead :<
I moved the whole function to the gamemode’s shared.

cl_init.lua
[lua]
include(“shared.lua”)

function ENT:Draw()
self.Entity:DrawModel()
end
[/lua]

init.lua
[lua]
AddCSLuaFile( “cl_init.lua” )
AddCSLuaFile( “shared.lua” )
include(“shared.lua”)

function ENT:SpawnFunction( ply, tr )
if ( !tr.Hit ) then return end
local SpawnPos = tr.HitPos + tr.HitNormal * 16
local ent = ents.Create( “sun_cannon” )
ent:SetPos( SpawnPos )
ent:Spawn()
ent:Activate()
return ent

end

function ENT:Initialize()
self:SetModel(“models/props/CS_militia/reloadingpress01.mdl”)
self:PhysicsInit(SOLID_VPHYSICS)
–self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
if phys and phys:IsValid() then
phys:Wake()
end
self:SetMoveType(MOVETYPE_NONE)
end

function ENT:OnTakeDamage(dmg)
return false
end

function ENT:OnRemove()
if (self.light:IsValid()) then
self.light:SetParent()
self.light:Fire(“TurnOff”,0,0);
self.light:Fire(“kill”,0,0.1)
end
end

function ENT:Explode(pos,magnitude,time)
local time_ = time or 0
local bang = ents.Create(“env_explosion”)
bang:SetPos(pos)
bang:SetKeyValue(“iMagnitude”,magnitude)
bang:Spawn()
bang:Fire(“explode”,"",time_)
bang:Fire(“kill”,"",time_+1.5)
end
[/lua]

shared.lua
[lua]
ENT.Type = “anim”
–ENT.Base = “base_gmodentity”
ENT.PrintName = “Sun Cannon”
ENT.Author = “Gnossienne”
ENT.Spawnable = true
ENT.AdminSpawnable = true

function SpawnSunCannon(ply, cmd, args)
local trace = {}
trace.start = ply:EyePos()
trace.endpos = trace.start + ply:GetAimVector() * 1000
trace.filter = ply
local tr = util.TraceLine(trace)
ent = ents.Create(“sun_cannon”)
ent:SetPos(tr.HitPos)
ent:Spawn()
end
concommand.Add( “Spawn_Sun_Cannon”, SpawnSunCannon)
[/lua]

THERE! FFS!

I went and installed GMod12 again for ya since GM13 doesnt run from Valve’s update. I tested and I am sure it works. There you go. Make sure the folder these files are in is called “sun_cannon”

Have Fun.

[editline]30th June 2012[/editline]

Ah. Dammit, It has the wrong model. My model for that was acting strange so I changed it. Oh well. You can change that back to the oil drum.