Attempting to have an entity spawn on server startup, i know there's tools for this to make entities persistent. But the issue with that is it becomes a world prop, and can no longer be interacted with. (Requires damage to be dealt) And I've tried the following lines in shared, config, cl_init, and init. Almost like it's calling ents.Create client side. Which it shouldn't? If i'm not mistaken. New to lua, so i'm learning as i go. But here's what i'm working with.
hook.Add("InitPostEntity", "EntityInit", function()
local ent = ents.Create("myentity")
ent:SetPos(Vector(-6882.643066, -7508.030273, 137.031250))
ent:SetAngles(Angle(0, 360, 0))
ent:Spawn()
ent:DropToFloor()
ent:SetMoveType(MOVETYPE_NONE)
end)
Here's what i get back
[ERROR] gamemodes/basewars/gamemode/shared.lua:58: attempt to call field 'Create' (a nil value)
1. fn - gamemodes/basewars/gamemode/shared.lua:58
2. unknown - lua/ulib/shared/hook.lua:109
If anyone knows a fix, it's be much appreciated!
If I may ask, what was the issue? I am trying my hand on LUA myself so I thought this would be an interesting thing to mull over, but I can´t figure it out.
ents.Create only exists serverside.
Sorry, you need to Log In to post a reply to this thread.