Troller0001
I've anxiously awaited your arrival!
Since I'm asking many questions, mainly regarding Lua, I've decided to start a seperate thread specifically dedicated to answering my 'stupid questions that may actually be not that stupid'. Before you start ripping your hair out on these (stupid) questions, I would first like to thank you for taking your time reading this, as well helping the community by answering some of these questions!
So well, here's the first question, regarding the Player.AddNotification(...).
So I used this piece of text from the Modwiki:
As well as this (also from the Modwiki)
Now, I used this Lua code with PlayerDoTurn (from another file) (I also set it to InGameUIAddin):
The thing is, everything works perfectly, apart from the notification. The Hagia Sophia Icon always shows up, as well as the overlay 'unknown civ' icon... The text however, does appear correct...
Is there something really obvious I'm missing?
Completely other question, would it be possible to add a custom sound to a notification as well, or would that require digging in the C++ code?
-Troller0001
So well, here's the first question, regarding the Player.AddNotification(...).
So I used this piece of text from the Modwiki:
Spoiler :
NOTIFICATION_WONDER_COMPLETED
Icon: Wonder icon with optional overlaid small civ icon
Sound: No Description Available
Left-Click: Zoom to plot
Extra Parameter 1: Building ID for wonder
Extra Parameter 2: Player ID; if this is -1, the overlaid civ icon does not appear
NOTIFICATION_WONDER_BEATEN
Icon: Wonder icon with optional overlaid small civ icon
Sound: No Description Available
Left-Click: Zoom to plot
Extra Parameter 1: Building ID for wonder
Extra Parameter 2: Player ID; if this is -1, the overlaid civ icon does not appear
Spoiler :
Player:AddNotification(NotificationType notificationType, string description, string title, int x = -1, int y = -1, PlayerID extra1 = -1, int extra2 = -1)
Now, I used this Lua code with PlayerDoTurn (from another file) (I also set it to InGameUIAddin):
Spoiler :
Code:
-- MonGrandPrix
-- Author: Troller0001
-- DateCreated: 4/10/2016 12:23:16 PM
--------------------------------------------------------------
--function that checks if WLTKD is active, and then activates the grand prix if it is
local iGrandPrix = GameInfoTypes.BUILDING_MON_GRAND_PRIX
local iMon_ID = GameInfoTypes.CIVILIZATION_MOROCCO --will be monaco once the civ is added in the game
function MonGrandPrix(iPlayer)
local pPlayer = Players[iPlayer]
if(pPlayer:GetCivilizationType() == iMon_ID)then
for pCity in pPlayer:Cities() do
if(pCity:GetWeLoveTheKingDayCounter() > 0) then
if(not pCity:IsHasBuilding(iGrandPrix))then--if the grand prix isn't already active, add a notification
if pPlayer:IsHuman() then
local description = ("Since 'We Love the King Day' is active, the citizens of "..pCity:GetName().." have organized a Grand Prix in their city, increasing Great People Generation by 15%")
local descriptionShort = ("A Grand Prix has been organized")
Players[Game.GetActivePlayer()]:AddNotification(NotificationTypes["NOTIFICATION_WONDER_BEATEN"], description, descriptionShort, pCity:GetX(), pCity:GetY(),iGrandPrix,GameInfoTypes.CIVILIZATION_MOROCCO)
end
end
pCity:SetNumRealBuilding(iGrandPrix, 1)
else
pCity:SetNumRealBuilding(iGrandPrix, 0)
end
end
end
end
Is there something really obvious I'm missing?
Completely other question, would it be possible to add a custom sound to a notification as well, or would that require digging in the C++ code?
-Troller0001