LUA peace with barbs

(or perhaps it only triggers if you lose your last city, and if you never have a city you never lose it ... if that makes sense)

I think it works exactly like that.
 
OK, so let's say I want to add my own "Barb Faction" (let's call them Pirates) which is really just a minor civ never given a start plot (which means they never get an initial settler, I've found). I write my own Lua to spawn units. I use Lua to set who is and isn't at war with them over the course of the game. And I edit UI files so they don't show up for human player.

There's two loose ends I can't figure out. If a player is at peace with Pirates, how do I prevent:
  1. Pirates from giving quests
  2. AI players from bribing Pirates trying to become friends or allies
Not sure if that is a fatal flaw for my minor-civs-as-barb-factions idea.
 
Not easily are the answers :(

The first one you could fix by adding an event to the DLL CanHaveQuest or some-such, the second is more tricky as there are a number of places the AI can give a gift.

There's also the issue of spies, elections and coups (unless you have espionage switched off)
 
I am pretty certain you can use lua to keep their attitude such that they will not be giving things away.
Really? So if I keep relationship at -59 and at peace, then:
  1. Full civ AI will never give gift (of any kind) to CS.
  2. CS will never give quest to full civ.
Is that what you are saying? Is it true?
 
I'm not certain... you can certainly adjust attitude as per code I use:

Code:
function SetWessexWihtFriendship()

if Game.GetGameTurn() >= 0 then

local pWiht
local pWessex
local Wessex

for iPlayer=0, GameDefines.MAX_MAJOR_CIVS-1 do 

local pWessex = Players[iPlayer]
	
  if (pWessex:IsAlive()) then
		if (GameInfo.Civilizations.CIVILIZATION_ENGLAND.ID == pWessex:GetCivilizationType()) then
     
	   	Wessex = iPlayer
		

for iWiht = GameDefines.MAX_MAJOR_CIVS, GameDefines.MAX_CIV_PLAYERS-2, 1 do

local pWiht = Players[iWiht]

   if (pWiht:IsAlive()) then
		if (GameInfo.MinorCivilizations.MINOR_CIV_WIHT.ID == pWiht:GetMinorCivType()) then
										
      pWiht:ChangeMinorCivFriendshipWithMajor(Wessex, .67)

		end
    end
  end
end
end
end
end
end

Events.ActivePlayerTurnEnd.Add(SetWessexWihtFriendship)

You would need to determine attitude and whether the civ was aggressive or not (to see how many points per turn it changes its attitude). I'm not certain if a lua function does this or not.

I do not know the ramifications of keeping it at -59 either... I rarely play the game actually, but if -59 in a normal game leads to those results you mentioned, I do not see why it wouldn't work.

You would have to anticipate all the things that adjust attitude and have lua shift in the minor's attitude change accordingly.
 
Something like:

pCityState:ChangeMinorCivFriendshipWithMajor(pPlayer, X+Y+Z-59)

Where X,Y and Z would be things that influence a minor's attitude positively or negatively. Hopefully lua functions exist to determine all those or they are factors that do not change. X, Y and Z would have to change dynamically using lua methods that determine the current attitude... perhaps there's one function that does this, or a variety. A glance through the lua reference (which I've not time to do at the moment) would tell the tale.
 
Back
Top Bottom