[ create a new paste ] login | about

Link: http://codepad.org/S7zMZHMK    [ raw code | fork ]

Lua, pasted on Sep 15:
function onMineCreatedMountain(playerID, x, y, improvementID)
		local pPlayer = Players[playerID];
		local pPlot = Map.GetPlot(x, y);
		
		local iResourceST = GameInfoTypes["RESOURCE_STONE"]

		--local improvementID = GameInfoTypes["IMPROVEMENT_MINE"] 
		local pTeam = Teams[pPlayer:GetTeam()]

        if not pPlot:IsWithinDistanceOfTerrain(GameInfoTypes.TERRAIN_MOUNTAIN, 1) then return end
		if(improvementID == GameInfoTypes.IMPROVEMENT_MINE) then 
		if pPlot:GetResourceType(-1) == -1 then

			   
									
				local iResourceSupply = GetRandom(1, 100);				
											

					if iResourceSupply <= 85 then return	end                                   
					-- ------
					
					if iResourceSupply > 85 and iResourceSupply <= 95 then                 
				       pPlot:SetResourceType(iResourceST, 1);	
						
						if pPlayer:IsHuman() then
							Events.GameplayAlertMessage(Locale.ConvertTextKey("TXT_KEY_MISC_FOUND_IRON" ))
						end
						end
					-- ------
					
					if iResourceSupply > 95  then 	              
				pPlot:SetResourceType(iResourceST, 2);	
					
						if pPlayer:IsHuman() then
							Events.GameplayAlertMessage(Locale.ConvertTextKey("TXT_KEY_MISC_FOUND_IRON" ))
						end
						end
						-- ------
						
					
					else
					
				return;
			end
	end
end


Output:
No errors or program output.


Create a new paste based on this one


Comments: