I would like to add a custom UnitOperation or UnitCommand to avoid using the
ExposedMembers.GameEvents to pass events between gameplay and ui.
I added the operations to the database, and the hashes are created etc.
I
When I then try to Request the command, CanStartOperation returns false
Doesn't matter if the unit has movement points left or not. Anyone who might have a clue on this?
ExposedMembers.GameEvents to pass events between gameplay and ui.
I added the operations to the database, and the hashes are created etc.
I
<GameInfo>
<Types>
<Row Type="UNITOPERATION_MY_OP" Kind="KIND_UNITOPERATION"/>
</Types>
<UnitOperations>
<Row OperationType="UNITOPERATION_MY_OP" VisibleInUI="true" HoldCycling="true" CategoryInUI="SPECIFIC" Icon="ICON_MY_OP" Description="LOC_UNITOPERATION_MY_OP" />
</UnitOperations>
</GameInfo>
When I then try to Request the command, CanStartOperation returns false
local unit = Players[player]:GetUnits():FindID(unitId);
local ops = GameInfo.UnitOperations["UNITOPERATION_MY_OP"]
local actionHash = ops.Hash;
local canStart = UnitManager.CanStartOperation( unit, ops.OperationType, nil, m_Trader );
print("CanStart: " .. tostring(canStart));
Doesn't matter if the unit has movement points left or not. Anyone who might have a clue on this?