Page 1 of 1

Entity limit?

Posted: Thu Oct 05, 2017 1:19 pm
by Dasher
I was wondering whether there is a possible code that could limit the number of entities being on a map, e.g. I don't want more than one shield on my map, so can I set a maximum count in my LUA script? I'm having the problem that the game ignores the if statement if GetCommandPostTeam("cp3") == 1.
Here's my code:
Hidden/Spoiler:
ActivateShield = OnFinishCapture(function(post,holding)
if GetCommandPostTeam("cp3") == 1 then
ShieldSpawn = GetPathPoint("shield_spawn", 0)
CreateEntity("dur1_shield",ShieldSpawn,"shield")
end
end
)
However the entity gets created everytime a commandpost is captured by team 1, regardless which one it is and I only want the entity to be created if cp3 gets captured.