-- Merchant Submarine ?
Posted: Mon Dec 10, 2018 7:40 pm
Robotron or anybody that has knowledge about this event:
OK, here's what I am understanding: I believe that this type of submarine can supply land units of all types. The script does not expressly say that, however "Merchant Submarine" sounds eerily close to "Merchant Fleet". Can anybody tell myself and others if there is any advantage to having the Merchant Submarine Event other than it's increased defense rating. In all my MP and SP games I have never seen this event. I do see USA mentioned in this event it maybe a USA event only, or could it apply to other factions?
-- Merchant Submarine
function MerchantSubmarine(unit, hex)
if GetEvent("MerchantSubmarine") == 0 then
if unit.faction.alliance.id == 2 and unit.prototype.name == "submarine" then
local usa = game:GetFactionById(10)
if usa.alliance.id ~= 1 then
local hexes = game.map:GetHexesInRange(hex, 1)
for _, adjacent in pairs(hexes) do
if adjacent.construction ~= nil and adjacent.construction.type == Construction.TYPE_PORT and adjacent.construction.city.hex.originalFaction.id == 10 and HasUnitTech(unit, "submarine_cruiser") then
SetEvent("MerchantSubmarine", game.turn, adjacent, unit.faction.alliance)
unit.faction:ConsumeProductionPoints(-30)
if usa.alliance.id == 0 then
ChangeFactionAlignment(usa, unit.faction.alliance, 2)
end
if unit.faction.alliance.id == playerAlliance.id then
ui.resourcesPanel:Refresh()
end
end
end
end
end
end
end
OK, here's what I am understanding: I believe that this type of submarine can supply land units of all types. The script does not expressly say that, however "Merchant Submarine" sounds eerily close to "Merchant Fleet". Can anybody tell myself and others if there is any advantage to having the Merchant Submarine Event other than it's increased defense rating. In all my MP and SP games I have never seen this event. I do see USA mentioned in this event it maybe a USA event only, or could it apply to other factions?
-- Merchant Submarine
function MerchantSubmarine(unit, hex)
if GetEvent("MerchantSubmarine") == 0 then
if unit.faction.alliance.id == 2 and unit.prototype.name == "submarine" then
local usa = game:GetFactionById(10)
if usa.alliance.id ~= 1 then
local hexes = game.map:GetHexesInRange(hex, 1)
for _, adjacent in pairs(hexes) do
if adjacent.construction ~= nil and adjacent.construction.type == Construction.TYPE_PORT and adjacent.construction.city.hex.originalFaction.id == 10 and HasUnitTech(unit, "submarine_cruiser") then
SetEvent("MerchantSubmarine", game.turn, adjacent, unit.faction.alliance)
unit.faction:ConsumeProductionPoints(-30)
if usa.alliance.id == 0 then
ChangeFactionAlignment(usa, unit.faction.alliance, 2)
end
if unit.faction.alliance.id == playerAlliance.id then
ui.resourcesPanel:Refresh()
end
end
end
end
end
end
end