I have this portion of a code that logs when a command is being execute.
Code: Select all
function widget:UnitCommand(unitID, unitDefID, unitTeam, cmdID, cmdOpts, cmdParams)
local txt
local x,y,z = Spring.GetUnitPosition(unitID)
if cmdID == 36525 then -- Special On/Off Command
txt = "Unit ID "..unitID.." of Team "..unitTeam.." was commanded to the special weapon"
write(txt)
end
end
The full code for special command can be found here:
http://pastebin.com/njYaALTM
The logger works for other command, for e.g. attack, turn, wait, guard. However, it does not log for this special command which I create. Anyone have any suggestion what may went wrong?
Thanks!