fix for, upgrade siege unit int Rocket Artillery

lucie_kr

Chieftain
Joined
Oct 25, 2010
Messages
1
When upgrade a siege unit into a Rocket Artillery, it keeps the promotion that requires it to setup before a ranged attack.

adde to commented codes in the sid meier's civilization v\Assets\UI\InGame\WorldView\UnitPanel.lua

--------------------------------------------------------------------------------
-- UnitAction<idx> was clicked.
--------------------------------------------------------------------------------
function OnUnitActionClicked( action )
if bOkayToProcess then
if (GameInfoActions[action].SubType == ActionSubTypes.ACTIONSUBTYPE_PROMOTION) then
Events.AudioPlay2DSound("AS2D_INTERFACE_UNIT_PROMOTION");
end

-- aded by lucie
if( GameInfoActions[action].Type == "COMMAND_UPDAGE" ) then
local unit = UI.GetHeadSelectedUnit();
local promotion = GameInfo["UnitPromotions"]["PROMOTION_MUST_SET_UP"]["ID"];

if( GameInfo.Units.UNIT_ROCKET_ARTILLERY.ID == unit:GetUpdagedUnitType() ) then
unit:SetHasPromotion( promotion, false );
end
end
-- bye~

Game.HandleAction( action );
end
end
 
I seem to recall another, simpler fix for this issue having been posted earlier. It was XML rather than LUA, IIRC.
 
Nice work, but there is indeed another way in XML:

<UnitPromotions>
<Update>
<Where Type="PROMOTION_MUST_SET_UP"/>
<Set LostWithUpgrade="true" />
</Update>
</UnitPromotions>
 
Back
Top Bottom