Set Minor Civ Personality (aka :SetPersonalityType())

artisticMink

Chieftain
Joined
Jul 18, 2013
Messages
10
Hello folks, i'm messed around with city states lately. Today, i've attempted to set their personalities manually.

So, the first thing i did was looking into the CityStateDiplo.lua
Spoiler :
PHP:
	-- Personality
	local strPersonalityText = "";
	local strPersonalityTT = "";
	local iPersonality = pPlayer:GetPersonality();
	if (iPersonality == MinorCivPersonalityTypes.MINOR_CIV_PERSONALITY_FRIENDLY) then
		strPersonalityText = Locale.ConvertTextKey("TXT_KEY_CITY_STATE_PERSONALITY_FRIENDLY");
		strPersonalityTT = Locale.ConvertTextKey("TXT_KEY_CITY_STATE_PERSONALITY_FRIENDLY_TT");
	elseif (iPersonality == MinorCivPersonalityTypes.MINOR_CIV_PERSONALITY_NEUTRAL) then
		strPersonalityText = Locale.ConvertTextKey("TXT_KEY_CITY_STATE_PERSONALITY_NEUTRAL");
		strPersonalityTT = Locale.ConvertTextKey("TXT_KEY_CITY_STATE_PERSONALITY_NEUTRAL_TT");
	elseif (iPersonality == MinorCivPersonalityTypes.MINOR_CIV_PERSONALITY_HOSTILE) then
		strPersonalityText = Locale.ConvertTextKey("TXT_KEY_CITY_STATE_PERSONALITY_HOSTILE");
		strPersonalityTT = Locale.ConvertTextKey("TXT_KEY_CITY_STATE_PERSONALITY_HOSTILE_TT");
	elseif (iPersonality == MinorCivPersonalityTypes.MINOR_CIV_PERSONALITY_IRRATIONAL) then
		strPersonalityText = Locale.ConvertTextKey("TXT_KEY_CITY_STATE_PERSONALITY_IRRATIONAL");
		strPersonalityTT = Locale.ConvertTextKey("TXT_KEY_CITY_STATE_PERSONALITY_IRRATIONAL_TT");
	end

So, since there are minor civ personality types, i searched further and expected to find a setter.

I found two getters: GetPersonality(); (from above) and GetPersonalityType();
And one setter: SetPersonalityType(integer);

Spoiler :
PHP:
--Sets player 22 to 3
Player[22]:SetPersonalityType(MinorCivPersonalityTypes.MINOR_CIV_PERSONALITY_IRRATIONAL)

--Returns 3
Player[22]:GetPersonalityType()

--Returns always 2
Player[22]:GetPersonality()

I can get and set the PersonalityType without Problems, however that doesnt change the Personality which seems to be another own property. (No changes regarding quests or in the ui since it asks for Personality instead of PersonalityType).

Sadly Gedemons GIT is down so i don't have any chance to look into the actual code to see what the heck is going on there.
I would greatly appriciate it if someone could help me out here.
 
The personality is chosen in the DLL, CvMinorCivAI::DoPickPersonality()
There is no way to set it from LUA. There might be mods that change the DLL to allow it, I don't know.
 
The pPlayer:GetPersonality() and SetPersonality are actually for major civs. The ID corresponds to LeaderID. (The "personality" meaning all those leader predispositions in Leader.xml.)

Unfortunately, I've been told that the C++ side is probably bugged for this. So, although you can use it to hold an integer, it probably doesn't change an AI civ's behavior in any way.
 
Back
Top Bottom