Hey everyone,
My issue is that i made an attempt to create an entity that draws a sphere. However, my entity does not show up in my entities list.
Heres my folder path
addons/geass_zone
threw all the stuff in geass_zone
[B]init.lua[/B]
[LUA]
AddCSLuaFile("cl_init.lua")
AddCSLuaFIle("shared.lua")
include('shared.lua')
function ENT:SpawnFunction( ply, tr, geass_zone )
local classname = "geass_zone" -- This should be the name of the folder containing this file.
local ShouldSetOwner = true
if ( !tr.Hit ) then return end
local SpawnPos = self.Owner:GetPos()
local ent = ents.Create( classname )
ent:SetPos( SpawnPos )
ent:Spawn()
ent:Activate()
return ent
end
function ENT:Initialize()
self:SetModel("geass_zone")
local own = self.Owner:GetPos()
local entities = ents.FindInSphere(own,80)
for index, ent in pairs(entities) do
if ent:IsPlayer() and ent:Alive() and ent != self.Owner then
ent:Kill()
end
end
function ENT:Think()
self.SpawnTime = CurTime()
if CurTime() - self.SpawnTime() >= 5 then -- Or whatever time you want it to stay alive
self:Remove()
end
end
[/LUA]
[B]cl_init[/B]
[LUA]
include('shared.lua')
function ENT:Draw()
self:DrawEntityOutline( 1.0 ) -- Draw an outline of 1 world unit.
self:DrawModel("geass_zone")
render.DrawSphere(self.GetPos(), 80, 0,0, Color(255,0,0,255))
end
[/LUA]
[B]shared[/B]
[LUA]
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName= "geass_zone"
ENT.Author= "Keosan+Facepunch"
ENT.Contact= "Facepunch"
ENT.Category = "Geass"
ENT.Purpose= "Containing your deadly power"
ENT.Instructions= "Use the power of your geass channeled through this gun which will call all inside it."
ENT.Spawnable = true
ENT.AdminSpawnable = true
ENT.SpawnTime = 0
[/LUA]
I have looked at the entity tutorials online and have not been able to figure it out. All help is appreciated!
[I]All of this was put onto a server ran off of nfoservers.com[/I]
Did you upload it to the server via FTP?
[QUOTE=Keosan;48406366]
Heres my folder path
addons/geass_zone
threw all the stuff in geass_zone[/QUOTE]
Folder structure for an entity addon should be addons/addonname/lua/entities/entity_name/[cl_init.lua, shared.lua, init.lua]
You also need an info.txt in the root folder of your addon (addons/addonname)
[CODE]
"AddonInfo"
{
"name" "Entity Name"
"author_name" "Author Name"
"info" "
{
"description": "Description",
"type": "Type",
"tags":
[]
}"
}
[/CODE]
[QUOTE=LUModder;48409815]Did you upload it to the server via FTP?[/QUOTE]
Yes i did! I keep thinking it might be the folder structure but i looked up and it seems that my path is correct. I've been trying to get help with this but it seems no one seems to have this issue.
[I]GIF of folder structure within my FTP client[/I]
[url]https://gyazo.com/68ac11456b588c42396f8522ebf1a40e[/url]
Ahhh! Let me try it out and see if it works.
[QUOTE=DeathWard;48409905]Folder structure for an entity addon should be addons/addonname/lua/entities/entity_name/[cl_init.lua, shared.lua, init.lua]
You also need an info.txt in the root folder of your addon (addons/addonname)
[CODE]
"AddonInfo"
{
"name" "Entity Name"
"author_name" "Author Name"
"info" "
{
"description": "Description",
"type": "Type",
"tags":
[]
}"
}
[/CODE][/QUOTE]
That was deprecated a long time ago.
[QUOTE=DeathWard;48409905]Folder structure for an entity addon should be addons/addonname/lua/entities/entity_name/[cl_init.lua, shared.lua, init.lua]
You also need an info.txt in the root folder of your addon (addons/addonname)
[CODE]
"AddonInfo"
{
"name" "Entity Name"
"author_name" "Author Name"
"info" "
{
"description": "Description",
"type": "Type",
"tags":
[]
}"
}
[/CODE][/QUOTE]
Doesn't seem to work! I cannot see entity within the Q-> Entities and i cannot create it via "ent_create geass_zone" in console. I don't get errors within the game either.
[video=youtube;sIFTG2txJaE]https://www.youtube.com/watch?v=sIFTG2txJaE&feature=youtu.be[/video]
[QUOTE=LUModder;48409946]That was deprecated a long time ago.[/QUOTE]
Oh wait, it's the addons.txt now, huh?
[QUOTE=Keosan;48409920]Yes i did! I keep thinking it might be the folder structure but i looked up and it seems that my path is correct. I've been trying to get help with this but it seems no one seems to have this issue.
[I]GIF of folder structure within my FTP client[/I]
[url]https://gyazo.com/68ac11456b588c42396f8522ebf1a40e[/url]
Ahhh! Let me try it out and see if it works.[/QUOTE]
The files need to be in lua/entities/geass_zone for them to work as an entity or else they're doing nothing and not being registered by the game.
Okay, i've had it like this as well.[addons/geass/lua/entities/geass_zone[init.lua,cl_init.lua,shared.lua]
[url]https://gyazo.com/baf497b29394571121be93f3406813cf[/url]
and i tried it this way for the hell of it
[addons/test swep/lua/entities/geass_zone[init.lua,cl_init.lua,shared.lua]
[url]https://gyazo.com/2359ab70458f000ab5413752bfb62870[/url]
[video=youtube;qtserLXqQhM]https://www.youtube.com/watch?v=qtserLXqQhM&feature=youtu.be[/video]
Still an issue and i need help/assistance.
Sorry, you need to Log In to post a reply to this thread.