Removing Mountain Walk from CanMoveAllTerrain

trystero49

Prince
Joined
Apr 30, 2012
Messages
515
I attempted to make a lua script that would stop a unit with the ability to ice walk from walking on mountains. The problem that I have is that I have absolutely no idea of how to do that. I tried to do this in lua code.

Spoiler :
function Remove_Mountain_Walk_On_Ice_Walker(iPlayer,iUnit, iPlot)
if(iPlayer ~= -1) then
pPlayer = Players[iplayer];
if(iUnit ~= -1) then
pUnit = pPlayer:GetUnitByID(iUnit);
pType = pUnit:GetUnitType();
pCombatClass = GameInfo.Units[pType].CombatClass;
pPlot = iplot:GetPlotType();
if pCombatClass == "UNITCOMBAT_ICE_WALKER" and pPlot == "PLOT_MOUNTAIN" then
plot:SetTerrainType("TERRAIN_MOUNTAIN");
end
end
end
end

SerialEventUnitMoveToHexes(Remove_Mountain_Walk_On_Ice_Walker);


People who know lua and how the civ 5 events work may recognize this code as total garbage. It doesn't work. I don't even know if it does anything. Does anyone have any ideas on how to get a lua code to block mountain walk?
 
Back
Top Bottom