DLL: Leader Flavors and Changing Leaders Mid-Game

Vicevirtuoso

The Modetta Man
Joined
May 14, 2013
Messages
775
Location
The Wreckage, Brother
The Civ I'm currently working on will have a leader who can change into another leader under specific circumstances. For now, both leaders have identical personalities, but I was curious...I am assuming that an AI's leader flavors are determined at the beginning of the game , applying the +/- 2 randomness factor and sticking to those determined values. Would a AI retain the same flavors even if their leader were to be changed in the middle of a game?
 
Odd you should ask this, as I was looking at the same thing the other week!

The leader associated with a civ affects six things - Leader Name, Leader Personality, Traits, Biases, Flavours and Strategies

Name, Personality, Traits and Flavours are all cached against the player object as the game starts.
Biases aren't cached in the player object, but pulled from the db cache as needed.
Strategies, although cached as turns progress, will update at the end of the turn that flavours are altered.

Leader Name can be changed via a Pregame method

Leader Personality is the same as Name and doesn't appear to be used (there's even a comment by a dev in the C++ code querying whether it can be removed)

Traits can be swapped by using a hidden tech - make it a prereq for the new leaders traits and obsolete the old leaders traits

Which just leaves flavours. There is no way to change these from Lua, setting a new leader name is not enough as that doesn't affect the cache.

HTH

W
 
Biases aren't cached in the player object, but pulled from the db cache as needed.
Strategies, although cached as turns progress, will update at the end of the turn that flavours are altered.

Interesting, so it does look like at least the Biases can be altered midgame.

Which just leaves flavours. There is no way to change these from Lua, setting a new leader name is not enough as that doesn't affect the cache.

I know a simple leader name change wouldn't be enough, but if the flavors are pulled from the DB like biases, would PreGame.SetLeaderType() work? This actually changes the entire Leader type, and works shockingly well when used in the middle of an existing game.
 
Flavours are cached in the (C++) player object, and loaded and +/-2 tweaked at game start, changing the leader doesn't change the flavours (at least from what I can see - for some reason the Lua Pregame class isn't part of the DLL source)

Biases can only be changed mid-game as part of changing the leader - you can't update the bias values in the db mid-game (as like almost all other db values they are cached at start up)
 
I see. So, it would entirely be possible to have a peaceful leader be changed to a warlike one mid-game, but they won't have the increased flavors for building military units and buildings to compensate.

Still, actually better than I thought could be done. Thanks for the info!
 
This might actually spur me to release v67 of my DLL which has the Lua method to do this fully.
 
This might actually spur me to release v67 of my DLL which has the Lua method to do this fully.


Ooh. Looking forward to it.

Somewhat related question - and I probably already know the answer, since it's part of the graphics engine - but is there a way to reload a leader's FallbackScene defined in their LeaderScene XML? Currently trying to figure out if that can be done without replacing LeaderHeadRoot.
 
I don't do graphics ;) Not played with this, so don't know the answer, but my best guess would be what you're expecting "no, as it's part of the graphics/ui dll"

BUT, the other major new functionality in v67 is the ability to flip the game into multi-player mode just before the AI initiates diplomacy/trading and then flip back to single player mode as the diplo screens close - which stops the leaderheads from displaying at all.
 
I am eagerly following developments for v67. A somewhat dynamic approach to leaders will spice things up a tad bit with mods as opposed to dealing with the same old leader with the same habits throughout the game......"hey look, there's Monty declaring war on me for the 20th time...didn't see that coming!"
 
Back
Top Bottom