Adding Missionaries to Escort Formations

dbergan

Warlord
Joined
Feb 27, 2006
Messages
152
Location
Sioux Falls, SD
Does anyone know how I could go about allowing Missionaries to join an escort formation with, say, a Galley? I haven't been able to find anything in the database that controls how "yes settlers can create an escort formation with boats" but "no a missionary cannot". Both units have the FormationClassType "FORMATION_CLASS_CIVILIAN" yet they aren't treated the same when it comes to Escort Formations. What gives?

As far as I can tell, the relevant lua code is near line 387 of Base\Assets\UI\Panels\UnitPanel.lua:

Code:
            if (actionHash == UnitCommandTypes.ENTER_FORMATION) then
                --Check if there are any units in the same tile that this unit can create a formation with
                --Call CanStartCommand asking for results
                local bCanStart, tResults = UnitManager.CanStartCommand( pUnit, actionHash, nil, true);
                if (bCanStart and tResults) then
                    if (tResults[UnitCommandResults.UNITS] ~= nil and #tResults[UnitCommandResults.UNITS] ~= 0) then
                        local tUnits = tResults[UnitCommandResults.UNITS];
                        for i, unit in ipairs(tUnits) do
                            local pUnitInstance = Players[unit.player]:GetUnits():FindID(unit.id);
                            if (pUnitInstance ~= nil) then
                                local toolTipString :string        = Locale.Lookup(commandRow.Description, GameInfo.Units[pUnitInstance:GetUnitType()].Name);
                                local callback        :ifunction    = function() OnUnitActionClicked_EnterFormation(pUnitInstance) end                               
                                AddActionToTable( actionsTable, commandRow, isDisabled, toolTipString, actionHash, callback );
                            end
                        end
                    end
                end
            elseif (actionHash == UnitCommandTypes.PROMOTE) then

Can anyone help me understand what's going on?

Kind regards,
DB
 
Code:
UnitManager.CanStartCommand( pUnit, actionHash, nil, true);
is a querry from the UI file to the gamecore (ie, the code in the game's controlling DLL executable) asking whether the unit can perform the action. The gamecore is likely returning false for the 1st argument variable bCanStart and a nil for the second argument variable tResults for UnitCommandTypes.ENTER_FORMATION for Missionary units. Religious Units are their own sandboxed "layer" of units and are not treated in quite the same way as other units.
 
Hi Lee!

Thanks for the help! I presume UnitManager.CanStartCommand is influenced by the database. e.g. In Soli Deo Gloria, I gave Great Prophets a build charge through SQL and then the build and harvest unit operation icons showed up for the prophets.

Is there, then, something similar in the database that controls Escort Formations?

Kind regards,
DB
 
Top Bottom