• Smart NPCs Spawn
    3 replies, posted
[CODE]function DraugrR() local draugr = ents.Create( "npc_draugr" ) draugr:SetModel( "models/skyrim/draugr.mdl" ) draugr:SetPos( Vector( -2050.967041, 582.353149, -1471.968750 ) ) draugr:Spawn() end timer.Create( "draugr", 10, 0, DraugrR )[/CODE] Please help! how to make that if more than three npcs,others not spawn more?
Use the function ents.FindByClass and compare the amount of them to the max amount. [lua] local maxEnts = 8 if ( #ents.FindByClass( "npc_draugr" ) < maxEnts ) then -- spawn entity end [/lua] Something like this if I understood you correctly.
Yes,yes. Thanks for this! But I have another problem. Need (automatically) to remove their corpses every 3-5 mins.
[QUOTE=dimon9649;45336459]Yes,yes. Thanks for this! But I have another problem. Need (automatically) to remove their corpses every 3-5 mins.[/QUOTE] use a timer then remove self
Sorry, you need to Log In to post a reply to this thread.