Thalassicus
Bytes and Nibblers
How can I detect when a plot is discovered by a player?
How can I detect when a plot is discovered by a player?
function OnHexFogEvent( hexPos, fowType, bWholeMap )
local BlackFog = 0; -- invisible
local GreyFog = 1; -- once seen
local WhiteFog = 2; -- eyes on
if (fowType == WhiteFog) then
local gridPosX, gridPosY = ToGridFromHex( hexPos.x, hexPos.y );
local pPlot = Map.GetPlot( gridPosX, gridPosY );
if (pPlot ~= nil) then
if (pPlot:GetFeatureType() == FeatureTypes.FEATURE_FOREST) then
pForestRevealedPlot = pPlot;
elseif (pPlot:GetFeatureType() == FeatureTypes.FEATURE_MARSH) then
pMarshRevealedPlot = pPlot;
elseif (pPlot:GetFeatureType() == FeatureTypes.FEATURE_JUNGLE) then
pJungleRevealedPlot = pPlot;
end
if (pPlot:IsHills()) then
pHillRevealedPlot = pPlot;
elseif (pPlot:IsMountain()) then
pMountainRevealedPlot = pPlot;
end
if (pPlot:IsRiver()) then
pRiverRevealedPlot = pPlot;
end
end
end
end
Events.HexFOWStateChanged.Add( OnHexFogEvent );
<!-- Event sent when a plot is revealed (v58) -->
<!-- GameEvents.TileRevealed.Add(function(iPlotX, iPlotY, iTeam, iFromTeam, bFirst) end) -->
<Row Class="3" Name="EVENTS_TILE_REVEALED" Value="0"/>
<!-- Event sent when the team discovers a new Natural Wonder (v19) -->
<!-- GameEvents.NaturalWonderDiscovered.Add(function(iTeam, iFeature, iX, iY, bFirst) end) -->
<Row Class="3" Name="EVENTS_NW_DISCOVERY" Value="0"/>