Hello
how can i understand that units have active order GUARD?
add in this condition check like
and units dont have GUARD order
if isInTable(Filters[group],bp) and ........ then
table.insert(SelectedUnits,unit)
Thanks/
Hello
how can i understand that units have active order GUARD?
add in this condition check like
and units dont have GUARD order
if isInTable(Filters[group],bp) and ........ then
table.insert(SelectedUnits,unit)
Thanks/
https://github.com/FAForever/fa/blob/deploy/fafdevelop/engine/Sim/Unit.lua#L377-L381
states are listed at the top of the file
unit.IsUnitState("GuardBusy") or unit.IsUnitState("Patrolling")
right?
allUnits = GetAllUnits()
allUnits = GetSelectedUnits()
for _,unit in allUnits do
local id = unit:GetEntityId()
local bp = unit:GetBlueprint().BlueprintId
if isInTable(Filters[group],bp) and not (unit.IsUnitState("GuardBusy") or unit.IsUnitState("Patrolling")) then
warning: Error running lua command: ...nce\mods\filterselection\modules\filterselection.lua(163): attempt to call field IsUnitState' (a nil value) stack traceback: ...nce\mods\filterselection\modules\filterselection.lua(163): in function
FilterSelect'
string "import('/mods/FilterSelection/modules/Filte...": in main chunk
On UI side you'd need this.
“Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
— Steve Jobs.
My UI Mods
Support me
@broker I've no experience with UI mods so this might not work, but for a SIM mod the following should work:
if not(unit:IsUnitState('Guarding') or unit:IsUnitState('Patrolling')) then
M27AI and M28AI developer; Devlogs and more general AI development guide:
https://forum.faforever.com/topic/2373/ai-development-guide-and-m27ai-v71-devlog
https://forum.faforever.com/topic/5331/m28ai-devlog-v112
@maudlin27 i tired this but i receive
what this attempt to call method `IsUnitState' (a nil value)
warning: Error running lua command: ...nce\mods\filterselection\modules\filterselection.lua(165): attempt to call method IsUnitState' (a nil value) stack traceback: ...nce\mods\filterselection\modules\filterselection.lua(165): in function
FilterSelect'
string "import('/mods/FilterSelection/modules/Filte...": in main chunk
maybe I'm calling the function incorrectly?
warning: Error running lua command: ...nce\mods\filterselection\modules\filterselection.lua(166): attempt to call method GetGuardedUnit' (a nil value) stack traceback: ...nce\mods\filterselection\modules\filterselection.lua(166): in function
FilterSelect'
string "import('/mods/FilterSelection/modules/Filte...": in main chunk
may be need some kind import?
work
GetGuardedEntity
but
I saw the use of these functions in the files. but they didn't work for me. maybe you know why?
IsUnitState
GetGuardedUnit
@broker I've never had any issues with unit:IsUnitState('xxx'), have you used logs to confirm that what you're using it on is a unit? for example, if you do LOG('unit='..(unit.UnitId or 'nil')) what shows up in the log - is it the expected unit ID/blueprint reference, or a nil value?
M27AI and M28AI developer; Devlogs and more general AI development guide:
https://forum.faforever.com/topic/2373/ai-development-guide-and-m27ai-v71-devlog
https://forum.faforever.com/topic/5331/m28ai-devlog-v112
@maudlin27 in discord they wrote that these are functions for the game and they are not available in UI mods.
told to use this
unit:GetGuardedEntity()