NukeExplosion?

Just knowing that it is very hard to tell what could be crashing. You would need to post your code for us to look at if we want to find out where the crash is occuring.
 
originally, the code was:

Spoiler :
function AstroidStrike(pPlayer)
local targetCity = GetRandomPlayerCityNotCap(pPlayer);(function in different file use it in other function and works)
local iX = targetCity:GetX();
local iY = targetCity:GetY();
local plot = Map.GetPlot(iX, iY);
plot:NukeExplosion(1)


Couldn't get it to work, and wanted the strike to take out the city and area around it, so just did:

Spoiler :
function AstroidStrike(pPlayer)
local targetCity = GetRandomPlayerCityNotCap(pPlayer);
local iX = targetCity:GetX();
local iY = targetCity:GetY();

local n = targetCity:GetNumCityPlots() - 1
for i = 1, n, 1 do
local plot = targetCity:GetCityIndexPlot( i );
if (plot:GetImprovementType() ~= NO_IMPROVEMENT) then
plot:SetImprovementType(-1);
plot:SetResourceType(-1);
plot:SetFeatureType(FeatureTypes.FEATURE_FALLOUT, -1);
end
end
local plot = Map.GetPlot(iX, iY);
playerId = pPlayer:GetID();
plot:SetFeatureType(FeatureTypes.FEATURE_FALLOUT, -1);
targetCity:Kill()
Events.SerialEventCityDestroyed(ToHexFromGrid(Vector2(iX, iY)), playerID, targetCity:GetID(), -1)
Events.SerialEventGameDataDirty();


and that does what I intended, but wasn't sure why the nukeexplosion command wasn't working.(there are notifications, and eofs at end of functions but didn't copy that bit)
 
Top Bottom