Order Guard for constructor

Order Guard for constructor

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
Broker
Posts: 156
Joined: 02 Jul 2012, 13:16

Order Guard for constructor

Post by Broker »

Hi all.

How I can understand the difference in the situations?

first - i give order fight to constructor near factory and unit start help build units factory with out may help.

second: i give order guard factory to constructor and unit start help build units factory directly.

how i can understand with order constructor received.

I want to split constructors. some assist with fight order and another assist with guard order.

may be this:
first

[code]
local cQueue = Spring.GetCommandQueue(unitID)
if (cQueue[1].id==CMD.FIGHT or cQueue[1].id==CMD.REPAIR or cQueue[1].id==CMD.RECLAIM) then

[/code]

second :

[code]
local cQueue = Spring.GetCommandQueue(unitID)

if (cQueue[1].id==CMD.FIGHT or cQueue[1].id==CMD.REPAIR or cQueue[1].id==CMD.RECLAIM) and cQueue[2].id==CMD_GUARD then return true
[/code]
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Order Guard for constructor

Post by Google_Frog »

Echo the command queue in various situations to build up your knowledge. CMDTYPE.INTERAL (or something like that) may be useful.
Post Reply

Return to “Lua Scripts”