• Removing all instances of an entity before making a new one?
    2 replies, posted
I'm making a Bioshock plasmid pack and I'm currently on the target dummy plasmid. In order for it to be replicated semi-successfully I need to allow only one target dummy entity on the map at a time. Can someone help me? Thanks! :)
[lua] for k,v in pairs( ents.GetAll() ) do if ( v:GetClass() == "DummyTargetOrWhateverTheClassIs" ) then v:Remove() end end [/lua] [b]Or[/b], when you create the entity do something like [lua]ent = DummyTarget[/lua] and then whenever you spawn a dummytarget entity you do a check.. [lua] if ( DummyTarget ) then DummyTarget:Remove() end [/lua]
sweet, thanks :]
Sorry, you need to Log In to post a reply to this thread.