General > Developers Corner
Spawn Entity at multiple locations?
iViscosity:
In the loop, there is an ents.Create.
MrPresident:
Entities need to be in the Entity folder.
lua/entities
iViscosity:
/garrysmod/addons/popcorn/lua/entities/popcorn_spawn/popcorn_spawn.lua like something like that? Or lua/entities/popcorn_spawn.lua?
MrPresident:
If you're going to do the 1 file system. ( The new way ) then do:
/garrysmod/addons/popcorn/lua/entities/entity_name.lua
entity_name would be your entity name that you are going to call with ents.Create
Inside that file you would need an AddCSLuaFile() at the top, and then section your code into server and client with if SERVER then and if CLIENT then.
Take a look at /garrysmod/lua/entities/sent_ball.lua as an example.
Your spawn function, would need to go into a separate file that is autoran.. so like..
/garrysmod/addons/popcorn/lua/autorun/server/popcorn_spawn.lua
Let me know if you need further assistance.
iViscosity:
Ohhh so the ents.Create calls a lua file, not the model? Now that I think about it... that makes complete sense. I'm stupid.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version