Login  Register
 



Post new topicReply to topic
 
Author Message
 PostPosted: 25 Jun, 2012 
 

Joined: 26 Feb, 2009
Posts: 2997
Offline
Hi,

How can i check if a unit is able to be targeted by a weapon?

like im looping a table full of units in a radius, i want to give a weapon
one of these units as a target, i need to check if the weapon can actually
target that unit by way of checking it weapon priorities table.

im just not sure how to use the priorities table the correct way,

Thx.

_________________
Domino.
______________


Top
 Profile  
 PostPosted: 25 Jun, 2012 
 

Joined: 05 Oct, 2007
Posts: 16453
Location: camping near the biggest power-up
Offline
Something like;

Code:
pri = weapon:GetPriorities()

for k, v in pairs(pri or {} ) do
    if EntityCategoryContains(suspectUnit, v) then
        weapon:ShootAt(suspectUnit)
        break
    end
end

_________________
Nephylim wrote:
But, an FA army in an FA environment just looks... right.
help wrote:
Does anyone know how to use air transports? I cant get them to pick up troops.


Top
 Profile  
 PostPosted: 25 Jun, 2012 
 

Joined: 26 Feb, 2009
Posts: 2997
Offline
Hi,

Ahh cool,

im messing with this code,

Code:
local UnitsInRange = self:GetUnitsAroundPosition('EnemyUnits', self:GetPosition(), Radius, false) or {}
            local TargetPriorities = WepBp.TargetPriorities
            if TargetPriorities then
               local priorityTable = {}
               for k, v in TargetPriorities do
                  table.insert(priorityTable, ParseEntityCategory(v))
               end
               
               for id, cat in priorityTable do
                  FilteredUnits = EntityCategoryFilterDown(cat, UnitsInRange)
                  
                  WARN('new targets size ' .. repr(table.getn(Filter)))

               end
            end

_________________
Domino.
______________


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic



Quick Tools

Search for:
Jump to:  

© 2002-2010 Gas Powered Games Corp. All Rights Reserved. Gas Powered Games is the exclusive trademark of Gas Powered Games Corp.
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
 
Home| Games | Company | News & Press | Support
  Terms of Use   |    Copyright Information   |    Privacy Policy