I need a little bit of help here from you guys.
CODE:
-- Check current command and current location --
local curCmd = table.getn(cQueue)
if (curCmd > 0 and cQueue[curCmd].id == CMD_ATTACK) then
local ux, uy, ut = Spring.GetUnitPosition(ud)
local tX, tY, tZ = Spring.GetUnitPosition(cQueue[curCmd].target)
end
In the above I am trying to get the position of a unit who's next command is to attack something. I also need the location of it's target so that I can estimate distance. Because I really don't know what the members of CMD_ATTACK are I don't know if it is a unit ID, a map location, has a simple member such as .DistToTarget or etc. How can I get the position of the target unit? Additionally, where can I look for answers like this in the future so I don't have to bother all you smart people with newb questions?
Pls help re CMD_ATTACK and distance to target
Moderator: Moderators
I guess that you have to check source:
https://taspring.clan-sy.com/svn/spring ... ileCAI.cpp
As you can see, you have to check params property of queue. If it has 1 value, it's unit ID. If it has more, it's coordinates for "attack ground".
https://taspring.clan-sy.com/svn/spring ... ileCAI.cpp
As you can see, you have to check params property of queue. If it has 1 value, it's unit ID. If it has more, it's coordinates for "attack ground".