Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- InstantStatusFunction = function(unit, action)
- local aiBrain = unit:GetAIBrain()
- local flags = aiBrain:GetUnitsAroundPoint( categories.FLAG, unit.Position, 32, 'Ally' )
- if table.empty(flags) then
- return false
- else
- --Mithy: Check for existing locks
- local numflags, numlocked = table.getn(flags), 0
- for k, v in flags do
- if not v.CanBeCaptured or v.BeingLocked then
- numlocked = numlocked + 1
- end
- end
- if numlocked == numflags then
- return false
- end
- end
- if aiBrain:GetThreatAtPosition(flags[1].Position, 1, 'Hero', 'Enemy' ) <= 0 then
- return false
- end
- return AIAbility.DefaultStatusFunction(unit, action)
- end,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement