Entity.Base error?

So I’m in the debugging stage of my addon now and I’ve come to another roadblock. The addon I have contains 11 different entities but only one of them will spawn without crashing the game. Upon launch the console is clear of errors. Each entity has its own base reference. So far I’ve ruled this as not being .mdl or .phy related as I’ve substitued in the working files and renamed them and it still crashes. I’m thinking it may be Entity.Base (share.lua) related as I can run the init from all the rest of the entities through my working base, but cant run the working init through the broken bases. I’ll post the crash log below, please let me know if you need anything else. Thanks again.

Crash log: https://www.mediafire.com/?ijkbtxp7eu9mz3m

Not sure what you’re doing with Entity.Base but make sure you’re using

DEFINE_BASECLASS for your inheritance.

Also show code if you’re still running into issues.

Thank you for the reply :slight_smile: Ok what I’ve been trying to do is have a subfolder that communicates to a base_folder for its information and I’ve used this formula for each entity. I’ll post the code from one of my broken entities below.
The first code is from my referencing folder which communicates to the correct base folder:
lua/entities/jupiter/init.lua

[lua]< AddCSLuaFile( “shared.lua” )
include( “shared.lua” )

ENT.planetaryModel = “models/jupiter/jupiter.mdl”
ENT.planetarySound = “” >[/lua]

lua/entities/jupiter/shared.lua
[lua]< ENT.Type = “anim”
ENT.Base = “planet_jupiter”

ENT.Category = “Solar System Mod”
ENT.PrintName = “Jupiter”
ENT.Author = “Pjazerlazer”
ENT.Purpose = “Spawn spacebodies”
ENT.Instructions = “Spawn Jupiter”

ENT.Spawnable = true
ENT.AdminSpawnable = true >[/lua]

The next is from the base_folder:
lua/entities/planet_jupiter/cl_init.lua
[lua]<
include(‘shared.lua’)

function ENT:Draw()
self:DrawModel()
end>[/lua]
lua/entities/planet_jubiter/init.lua
[lua]< --[[ Solar System Mod

Author: Pjazerlazer
Profile: http://steamcommunity.com/profiles/76561197997092622/

]]–
AddCSLuaFile(“cl_init.lua”)
AddCSLuaFile(“shared.lua”)
include( “shared.lua” )

function ENT:SpawnFunction( ply, tr, class )
if ( !tr.Hit ) then return end
local pos = tr.HitPos + tr.HitNormal * 4
local ent = ents.Create( class )
ent:SetPos( pos + Vector (0,10,35))
ent:Spawn()
ent:Activate()
return ent
end

function ENT:Initialize()
self:SetModel( self.planetaryModel )
self:SetModelScale( self:GetModelScale() * 15, 0 );
self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )

local phys = self.Entity:GetPhysicsObject()
if phys:IsValid() then
	phys:Wake()
end

end

function ENT:Use( ply )

if ( ply:IsPlayer() ) then
	
    print( "STATS" )
	print( "Diameter: 142,800 km(88,736 miles)" ) 	
	print( "Rotation Period about Axis: 9.8 hours)" )
    print( "Mass: 1,898 x10^24 kilograms (318 x Earth's)" ) 	
	print( "Revolution Period about the Sun: 12 years)" )
    print( "Density: 1,326 kg/m^3)" )	
	print( "Tilt of Axis: 3.1o)" )
    print( "Minimum Distance from Sun: 741 million km (460 million miles))" )	
	print( "Surface Gravity: 23.12 m/s^2 (2.64 x Earth's)" )
    print( "Maximum Distance from Sun: 817 million km 508 million miles))" )	
	print( "Distance across the Great Red Spot: 40,000 km(24,860 miles)" )
    print( "Orbital Semimajor Axis: 5.20 AU (Earth=1 AU))" )	
	print( "Temperature at Cloud Tops: -150o C (-101o F))" )
    print( "Minimum Distance from Earth: 588 million km(365 million miles)" )	
	print( "Average Cloud Top Temperature (K): 123K)" )
    print( "Rings: 1, very thin)" ) 	
	print( "Satellites: 63 known" )
	
end

end >[/lua]

lua/entities/planet_jupiter/shared.lua
[lua]<ENT.Type = “anim”
ENT.Base = “base_gmodentity”

ENT.PrintName = “planet_jupiter”
ENT.Category = “Solar System Mod”
ENT.Author = “Pjazerlazer”
ENT.Contact = “http://steamcommunity.com/profiles/76561197997092622/
ENT.Purpose = “Spawn space bodies”
ENT.Information = “More planets and moons coming soon”

ENT.Spawnable = false
ENT.AdminSpawnable = false >[/lua]

I’ve been trying to play around with the baseclass function for the past few hours. I was reading this post by Gary <https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/includes/modules/baseclass.lua> and am a little confused. I see he sets the base_class. Would this be similar to the entity.base and if so, would I do set.baseclass here (in the shared.lua of the “jupiter” folder) and call it in the planet_jupiter folder’s init.lua file?
Thanks again for the help :slight_smile:

Another thing I’d like to point out is that if I change the directory of the broken entities to the .mdl of the one working entity, they work. I’m not sure what’s going on…

Haha!!! ok I got it :dance: It seems the crashing IS being caused by my models. When I go to scale them up upon initializing them the crash tends to be taking place with all the very detailed entities that I have indices problems with during compiling. When I set the deltatime to any number greater than zero the entity will spawn without crashing, but will not scale any at all. Not bad for 12 hours of troubleshooting :stuck_out_tongue: Does anybody out there have experience on this issue?

Ok so I eventually just went back to Blender and re-rendered my models without subdividing, except the one that worked. Although they lack more of the 3D quality, the bump maps I have for them really does the trick so I can get the spawns I want without any issues. Definitely worth looking into though…

Happy Modding guys :wink: