Hello all,
I have yet another rather simple question i'm assuming...
I'm working on an interesting loot box system, but I need to start by adding a SENT, which will be made into the box.
However, I seem to have run into a bit of a snag! The entity doesn't show up anywhere in the Q menu, at all. Apparently it should've created an 'other' category under Entities but it hasn't.
Currently stored in this directory with this file structure...
garrysmod -> lua -> entities -> defn_loot_system -> init.lua, cl_init.lua and shared.lua
cl_init.lua
include("dfnvshared.lua")
function ENT:Draw()
self:DrawModel()
end
init.lua
AddCSLuaFile("dfnvcl_init.lua")
AddCSLuaFile("dfnvshared.lua")
include("dfnvshared.lua")
function ENT:Initialize()
self:SetModel("models/props_junk/wood_crate002a.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
end
shared.lua
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName= "Large Loot Crate"
ENT.Spawnable = true
Why do your include and AddCSLuaFile have prefix in the filenames? Do you actually have those files in your filesystem?
it could be a problem with the way you arranged your files
lua
entities
name_of_entity_class --the name of this folder determines the entity's classname
init.lua
cl_init.lua
shared.lua
at the start of init.lua put this in
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
and in cl_init.lua put this in
include("shared.lua")
Ah! Thank you! Turns out i'm an idiot and I actually tried renaming the files, but forgot to change the names of the files in the include and addcsluafile lines!
Sorry, you need to Log In to post a reply to this thread.