• How to properly use ents.Create()?
    4 replies, posted
Hi so as the title says I am not sure how to properly use ents.Create(), I have seen an example of it on the wiki of it being used where the parameter inside is ents.Create("gmod_button"), after seeing that I tried searching for a list of entities you can create using ents.Create() but I coudn't find anything and also coudn't find a tutorial on how to use it properly. So if anyone could explain this to me. Thanks!
Towards the bottom of most gmod library entries you'll find a tutorial on how to use a function: ents.Create additionally: Ents.Create In short - this function is called to physically create an entity in the world. So say you wanted to spawn a zombie you would use Ents.Create to achieve that.
That is helpful but I am still not sure on the sort of things you can put inside the brackets, is there a list anywhere which shows everything you can do with that?
open up a sandbox single player game, hit 'Q' and go to the "Entities" tab. Right click and "copy to clipboard" anything in there and it will give you what you the name to use of the entity you want to create
    function SpawnProp(pl, cmd, arg)         local tr = pl:GetEyeTraceNoCursor()         if !tr.HitWorld then return end         local ent = ents.Create( "prop_physics" ) ent:SetModel("models/props_c17/FurnitureWashingmachine001a.mdl")         ent:SetAngles(Angle(0, pl:EyeAngles().y+math.random(-360, 360), 0))         ent:SetPos(tr.HitPos + Vector( 0, 0, (ent:OBBMaxs().z-ent:OBBMins().z)*0.5 )         ent:Spawn()     end     concommand.Add("Castle_prop", SpawnProp)
Sorry, you need to Log In to post a reply to this thread.