Vicevirtuoso
The Modetta Man
Special thanks to bc1 of EUI fame for helping fix two glaring usability issues with this utility!
This is a utility I wrote for two of my mods which allows for a leader scene to be changed dynamically depending on the disposition of the AI. With this, you can:
This mod replaces LeaderHeadRoot.xml, but not LeaderHeadRoot.lua. As of v4, this mod does not require any file replacement!
How to use
Leaders without definitions for the VV_LeaderSceneOverride fields (or custom functions) will display normally.
Example of the mod in use, using my Hyperdimension Neptunia: Lowee mod:
Normal:
Friendly:
Hostile (text censored due to vulgarity):
This is a utility I wrote for two of my mods which allows for a leader scene to be changed dynamically depending on the disposition of the AI. With this, you can:
- Display a different image for a leader when they are Friendly, Afraid, Guarded, Hostile, At War, Denouncing the player, or Defeated
- Have the leader scenes for a leader update without requiring a reload if you use Lua to change the leader of a Civilization mid-game. For example, if you had an America civilization which changed leaders from Washington to Lincoln after certain requirements were met, you could make Lincoln appear instead of Washington without requiring a reload.
- NEW in v2: Define custom functions which allow you to fetch any texture you want to display as the leaderscene
How to use
- Add VV_LeaderSceneChanger.sql as an OnModActivated action in the Actions tab in the properties of your mod. This file must be loaded before the one defining your leader in the Leaders table!
- When defining your Leader, set any or all of the following fields in the Leader table to be the exact name of the .dds texture file you want to use, including the file extension:
- VV_LeaderSceneOverride
- VV_LeaderSceneOverrideFriendly
- VV_LeaderSceneOverrideGuarded NEW in v2
- VV_LeaderSceneOverrideAfraid NEW in v2
- VV_LeaderSceneOverrideHostile
- VV_LeaderSceneOverrideWar NEW in v3
- VV_LeaderSceneOverrideDenouncing NEW in v3
- VV_LeaderSceneOverrideDefeat NEW in v3
- Add VV_LeaderHeadImageOverride.xml as a DiplomacyUIAddin under the Content tab of your mod
You may either use HookupExample.lua as an InGameUIAddin directly, or you can simply copy and paste the code into your own Lua script.No longer necessary as of v4!- NEW in v2 (Optional): If you have more Lua experience, you may define custom functions to determine which texture is displayed for the leader image. Once a function is defined, add it to the utility's table of functions using LuaEvents.AddFunctionToLeaderSceneTable(function name) (note: you should probably add this line within a function called from Events.LoadScreenClose, in case your script loads after Dynamic 2D Leaderscenes does). These will run prior to the default functions which display the leaderscene based on the AI's disposition towards you. Functions will run in the order they are added to the table. If a value is returned, the dispositions will not be checked. The function will be passed all the arguments that Events.AILeaderMessage would pass to a function. Example:
Spoiler :Code:--Special Leaderscene logic just for Uni: --If she is Friendly towards the player, but is only at 66% or less of the player's score, she gets a little flustered. function UniSpecialLeaderscene( iPlayer, iDiploUIState, szLeaderMessage, iAnimationAction, iData1 ) local pPlayer = Players[iPlayer] if pPlayer:GetCivilizationType() == iUniCiv then local pActivePlayer = Players[Game:GetActivePlayer()] local iApproach = pActivePlayer:GetApproachTowardsUsGuess(iPlayer); local bWar = Teams[pActivePlayer:GetTeam()]:IsAtWar(pPlayer:GetTeam()) if not bWar and iApproach == MajorCivApproachTypes.MAJOR_CIV_APPROACH_FRIENDLY then local iPercent = GetUniScoreDifference(iPlayer, pActivePlayer:GetScore()) if iPercent <= UNI_FLUSTERED_THRESHOLD then return "VVUniLeaderSceneDynamicFriendlyLowScore.dds" end end end return nil end Events.LoadScreenClose.Add(function () LuaEvents.AddFunctionToLeaderSceneTable(UniSpecialLeaderscene end)
Leaders without definitions for the VV_LeaderSceneOverride fields (or custom functions) will display normally.
Example of the mod in use, using my Hyperdimension Neptunia: Lowee mod:
Normal:
Spoiler :

Friendly:
Spoiler :

Hostile (text censored due to vulgarity):
Spoiler :
