Making AI lords update their banner when they join another faction

Users who are viewing this thread

John25-

Sergeant at Arms
Hi there, I know how to make lords use their faction's banner - but I am looking for a way to make them update their banner if they join another faction. Is that possible?
 
Solution
Ok so I have added these few lines to "change_troop_faction" (module_scripts.py):

Code:
        #Change banner
(try_for_range, ":cur_faction", npc_kingdoms_begin, npc_kingdoms_end),
        (faction_get_slot, ":cur_faction_banner", ":cur_faction", slot_faction_banner),
        (val_sub, ":cur_faction_banner", banner_meshes_begin),
        (val_add, ":cur_faction_banner", banner_scene_props_begin),
        (troop_set_slot, ":troop_no", slot_troop_banner_scene_prop, ":cur_faction_banner"),
      (try_end),
After a few moments in-game the lord's banner is updated in the presentation notes, the banner of the settlements he owns are changed as well, but his own party flag remains the same on the map..
E.g.:
...
It is possible, yes, not sure though if there is already an OSP-Script around from which you can take inspiration for that. At game_start you have this section here
Code:
# Troops:

# Assign banners and renown.
Starting with
Code:
(try_for_range, ":kingdom_hero", active_npcs_begin, active_npcs_end),
the banners are getting assigned to the lords via the operation (troop_set_slot, ":kingdom_hero", slot_troop_banner_scene_prop, ":banner_id"),
This is basically the operation which you need to reuse for the same slots to reassign the lords a new banner of the respective faction. Be aware however that in theory a faction could have more lords than it has factions available, in Native there is one big texture sheet with 18 (?) banners per faction iirc. You would need to find a workaround here or have enough placeholder banners for each faction at hand.
 
Upvote 0
Right so if I understand well you are talking about the situation in which the lords use their own banner, in order to make them use their faction's (→ liege's) banner? But in the case they already use the same banner as their faction's leader, is there a way to make that script run again when they renounce to their current faction and join another - including the player's newly created kingdom? i.e. they have let's say the Swadian 'national' banner, and so they adopt the Vaegir - etc. 'national' banner if they get indicted or renounce to the Kingdom of Swadia and then join another faction, or even the player's kingdom 'national' banner (?)
 
Upvote 0
Then you have the script which determines the chance of defecting per lord. There you add lines in which you also check for the new faction to which the lord defects and assign to him the banner of the respective faction as new banner. The easiest solution which comes into my mind.
 
Upvote 0
Ok so I have added these few lines to "change_troop_faction" (module_scripts.py):

Code:
        #Change banner
(try_for_range, ":cur_faction", npc_kingdoms_begin, npc_kingdoms_end),
        (faction_get_slot, ":cur_faction_banner", ":cur_faction", slot_faction_banner),
        (val_sub, ":cur_faction_banner", banner_meshes_begin),
        (val_add, ":cur_faction_banner", banner_scene_props_begin),
        (troop_set_slot, ":troop_no", slot_troop_banner_scene_prop, ":cur_faction_banner"),
      (try_end),
After a few moments in-game the lord's banner is updated in the presentation notes, the banner of the settlements he owns are changed as well, but his own party flag remains the same on the map..
E.g.:
uqHpGpM.png

1bwBHuo.png

Z3cmECo.png
UqcXiQ4.png

rL8CJMK.png

Ufo1oXs.png

Any ideas on what could be missing in order to update the party's flag as well?

Edit 1- The flag actually does get updated - after the lord has been defeated in battle. The 'new' party spawns with the right banner. Problem solved :smile:

Edit 2- And it happens only once, so if the player has convinced a lord of joining their faction, and then changes their banner, the lord's banner will remain the one of when he joined the faction
 
Last edited:
Upvote 0
Solution
Have you maybe tried firing up your module and launching a brand-new game? Perhaps banners are generated upon an initialized game, so they are not subject to change unless a new game is started.
 
Upvote 0
There must be some other script then which handles the banners on the world map. Maybe check for a keyword "banner" and look for scripts that govern the initialization/ assignment/ application of banners to lords.
 
Upvote 0
Ok so I have added these few lines to "change_troop_faction" (module_scripts.py):

Code:
        #Change banner
(try_for_range, ":cur_faction", npc_kingdoms_begin, npc_kingdoms_end),
        (faction_get_slot, ":cur_faction_banner", ":cur_faction", slot_faction_banner),
        (val_sub, ":cur_faction_banner", banner_meshes_begin),
        (val_add, ":cur_faction_banner", banner_scene_props_begin),
        (troop_set_slot, ":troop_no", slot_troop_banner_scene_prop, ":cur_faction_banner"),
      (try_end),
After a few moments in-game the lord's banner is updated in the presentation notes, the banner of the settlements he owns are changed as well, but his own party flag remains the same on the map..
E.g.:
uqHpGpM.png

1bwBHuo.png

Z3cmECo.png
UqcXiQ4.png

rL8CJMK.png

Ufo1oXs.png

Any ideas on what could be missing in order to update the party's flag as well?

Edit 1- The flag actually does get updated - after the lord has been defeated in battle. The 'new' party spawns with the right banner. Problem solved :smile:

Edit 2- And it happens only once, so if the player has convinced a lord of joining their faction, and then changes their banner, the lord's banner will remain the one of when he joined the faction
I tried your code and it didn't work for me. Trying to do the same thing as you, no matter what I do the lords won't update their banner for both castles/towns inside banners and outside flags and parties banner as well
 
Upvote 0
Back
Top Bottom