Trying to add a reward upon meeting a new civ.

lafittejean

Chieftain
Joined
Aug 6, 2010
Messages
23
I'm working on a new sponsor mod and I figured out that since the theme of the spaceship bonus is that they are weak early game focused bonuses I figured it would be appropriate to include in my mod a spacecraft module that gives you a one time resource bonus from meeting a new major civilization (in my case diplomatic capital). After some scouring I found the below bit of code from JFD's Iceland Civilization mod that is used as part of Iceland's unique ability, in this case granting great writer points when meeting a new civ.
Code:
function JFD_GreatWriterFromCivilizations(playerMetID, playerID)
	local player = Players[playerID]
	if (player:GetCivilizationType() == civilisationID and player:IsEverAlive()) then
        local playerMet = Players[playerMetID]
		local majorsMet = Teams[playerMet:GetTeam()]:GetHasMetCivCount(true)
		local speedMod = ((GameInfo.GameSpeeds[Game.GetGameSpeedType()].BuildPercent)/100)
		local reward
		if playerMet:IsMinorCiv() then reward = 5 else reward = 10 end
        if majorsMet == 1 then reward = reward * 2 end
		reward = reward * speedMod
		
		if player:IsHuman() then
           Events.GameplayAlertMessage(Locale.ConvertTextKey("You receive {1_Num} [ICON_GREAT_PEOPLE] [COLOR_POSITIVE_TEXT]Great Writer[ENDCOLOR] points from meeting {2_CivName}", reward, playerMet:GetName()))
        end
		
		local writersGuildCity = JFD_GetCityWithWonder(playerID, buildingWritersGuildID)
		writersGuildCity:ChangeSpecialistGreatPersonProgressTimes100(specialistWriterID, reward*100)
	end
end
	
if isIcelandCivActive then
	GameEvents.TeamMeet.Add(JFD_GreatWriterFromCivilizations)	
end
As I don't know much about Lua other than some basic stuff I'm at a loss as to how much of this I can successfully transfer to Civ BE:RT as I'm not sure if BE uses the same fuctions (the things in the parentheses like playerMetID) and where to find them. Any help would be appreciated!
 
Top Bottom