setting lords age

Users who are viewing this thread

This one bugged me for a while. The problem is lords' age and family information are stuff into the same string and the string will only be filled if the lord has at least one relative. The "try" block condition:
(gt, ":num_relations", 0),
May be you can change the condition to force the info into the string (s49) or seperate the information into 2 strings to make age string always display.

The codes are in module_scripts, script "game_get_troop_note" (look at how info are put into s49). In module_strings, search for "_age_reg1_family_" string id.

Edit: what I did was simply move the age information out of the block before the try for relation info start. s49 will always have the lord age reguardless of lord relative count.
 
Thanks for that Phoenix, I'll give it a try.

I've got one more question, does anybody have a list of the troop relation flags?
In LoTR Steward Denethor of Gondor is married to Prince Imrahil's sister, however, by the time my mod is set she has died. So I can't set them both to be related to her as she is dead, however I'd still like to be able to set them as brothers in-law if that is possible.
 
Just an idea. May be it works if you treat her as if she would be a lord that left 'calradia' ...well, Middleearth, of course.
I am not sure if such a lord still appears in the family tree though.
 
Ritter Dummbatz said:
Just an idea. May be it works if you treat her as if she would be a lord that left 'calradia' ...well, Middleearth, of course.
I am not sure if such a lord still appears in the family tree though.

On mods that implement permadeath, died heroes  still appear in family tree.
 
Ritter Dummbatz said:
Hehe, that's it. Just kill her!  :roll:
Sorry for sounding really ignorant, but what function would I call to do that?
I know I can do it at the end of aristocracy, but no what function to call.

Cheers,
 
Umm, I don't know. I was making fun with 'just kill her'.

May be you look out for the script where a vassal joins another kingdom. I am not sure again, but I think they leave Calradia when they've been vassals of all the existing factions and then they leave. If you can remember the string that's displayed when a lord actually leaves the realm you can probably backtrack the right place from there as well....

Sorry. Probably someone else knows more and saves your time.  :smile:
 
Monkeys_Uncle said:
Sorry for sounding really ignorant, but what function would I call to do that?
I know I can do it at the end of aristocracy, but no what function to call.

Cheers,

I did it by :
1. Defining new slot, slot_troop_death. Set it to 1 for died heroes. (You can use slot_troop_occupation and set it to a unique value for died heroes, I use new slot for make it more simple).
2. Changing his faction to  inactive faction or commoner faction (again I did it for make it simple, you can skip this but you must deal with faction report to prevent the died lords appear on it).
3. Modifying "game_get_troop_note" script :
Code:
      (try_begin),
        (neq, ":troop_no", "trp_player"),
        (neg|is_between, ":troop_faction", kingdoms_begin, kingdoms_end),
        (neg|is_between, ":troop_no", companions_begin, companions_end),
        (neg|is_between, ":troop_no", pretenders_begin, pretenders_end),

        (try_begin),
          (eq, ":note_index", 0),
          # Dunde's Permadeath BEGIN     
          (try_begin),
             (troop_slot_eq, ":troop_no", slot_troop_death, 1),
             (str_store_string, s0, "str_s54_is_dead"), 
          (else_try),
          # Dunde's Permadeath END   
             (str_store_string, s0, "str_s54_has_left_the_realm"),
             # Dunde's Permadeath BEGIN     
          (try_end), # Dunde's 
          # Dunde's Permadeath END   
          (set_trigger_result, 1),
        (else_try),
          (str_clear, s0),
          (this_or_next|eq, ":note_index", 1),
 
Remember to define "str_s54_is_dead" on module_strings.py

4. Modifying a simple trigger that respawn kingdom heroes party :
Code:
  # Respawn hero party after kingdom hero is released from captivity.
  (48,
   [
       (try_for_range, ":troop_no", active_npcs_begin, active_npcs_end),
         # Dunde's Permadeath BEGIN      
         (troop_slot_eq, ":troop_no", slot_troop_death, 0),
         # Dunde's Permadeath END     
         (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),         
         (neg|troop_slot_ge, ":troop_no", slot_troop_prisoner_of_party, 0),
         (neg|troop_slot_ge, ":troop_no", slot_troop_leaded_party, 1),

         (store_troop_faction, ":cur_faction", ":troop_no"),
 
The relationship is determined by tracing back to the parents (for brothers, sisters, cousins, in-law,...). The script is "troop_get_family_relation_to_troop". It is called the first time in game_start to set the initial family tree. If you set the relationship between Steward Denethor of Gondor and the princess (make them spouse of each other by setting the spouse slot) before the script is called for the first time, then the family tree will be set when game start. After that, just make her dead as suggested.
 
Thanks dunde,
I've tried adding your code to my mod and it compiles correctly until it throws the message :ERROR usage of unassigned local variable :troop_kingdom"

I assume I have to declare that as a variable,but don't know how, could you please throw some light on this?

Cheers,

EDIT: I must have done something else wrong as all the lords now register as having left the realm on the list of lords!
All the ladies register as missing too, however they are all where they should be so it must be a problem with the strings.
 
I don't use ":troop_kingdom" variable in the code, even I don't declare any new local variable for the scripts that being modified. May be you put the core at the wrong part of "game_get_troop_note" script. Try to search
Code:
(try_begin),
        (neq, ":troop_no", "trp_player"),
        (neg|is_between, ":troop_faction", kingdoms_begin, kingdoms_end),
        (neg|is_between, ":troop_no", companions_begin, companions_end),
        (neg|is_between, ":troop_no", pretenders_begin, pretenders_end),
inside "game_get_troop_note" script and do modify there.
Your error message 's seems like all troops display "str_s54_has_left_the_realm" as their troop note.
 
Sorry! meant :troop_faction.
Don't mean to be a pain, but I've clearly messed up the game_get_troop_note script, could you possibly post up all of your script (if there aren't any more changes) so I could copy that?

Cheers,
 
Ok, but I haven't tested yet for pretenders.

Code:
  #script_game_get_troop_note
  # This script is called from the game engine when the notes of a troop is needed.
  # INPUT: arg1 = troop_no, arg2 = note_index
  # OUTPUT: s0 = note
  ("game_get_troop_note",
    [
      (store_script_param_1, ":troop_no"),
      (store_script_param_2, ":note_index"),
      (set_trigger_result, 0),

      (str_store_troop_name, s54, ":troop_no"),
      (try_begin),
        (eq, ":troop_no", "trp_player"),
        (this_or_next|eq, "$player_has_homage", 1),
        (eq, "$players_kingdom", "fac_player_supporters_faction"),
        (assign, ":troop_faction", "$players_kingdom"),
      (else_try),
        (store_troop_faction, ":troop_faction", ":troop_no"),
      (try_end),
      (str_clear, s49),

	  #Family notes
      (try_begin),
        (this_or_next|is_between, ":troop_no", lords_begin, kingdom_ladies_end),
        (eq, ":troop_no", "trp_player"),
        (neg|is_between, ":troop_no", pretenders_begin, pretenders_end),
        (assign, ":num_relations", 0),

        (try_begin),
          (call_script, "script_troop_get_family_relation_to_troop", "trp_player", ":troop_no"),
          (gt, reg0, 0),
          (val_add, ":num_relations", 1),
        (try_end),
        (try_for_range, ":aristocrat", lords_begin, kingdom_ladies_end),
          (call_script, "script_troop_get_family_relation_to_troop", ":aristocrat", ":troop_no"),
          (gt, reg0, 0),
          (val_add, ":num_relations", 1),
        (try_end),
        (try_begin),
          (gt, ":num_relations", 0),
          (try_begin),
            (eq, ":troop_no", "trp_player"),
            (str_store_string, s49, "str__family_"),
          (else_try),
            (troop_get_slot, reg1, ":troop_no", slot_troop_age),
            (str_store_string, s49, "str__age_reg1_family_"),
          (try_end),
          (try_begin),
            (call_script, "script_troop_get_family_relation_to_troop", "trp_player", ":troop_no"),
            (gt, reg0, 0),
            (str_store_troop_name_link, s12, "trp_player"),
            (val_sub, ":num_relations", 1),
            (try_begin),
              (eq, ":num_relations", 0),
              (str_store_string, s49, "str_s49_s12_s11_end"),
            (else_try),
              (str_store_string, s49, "str_s49_s12_s11"),
            (try_end),
          (try_end),
          (try_for_range, ":aristocrat", lords_begin, kingdom_ladies_end),
            (call_script, "script_troop_get_family_relation_to_troop", ":aristocrat", ":troop_no"),
            (gt, reg0, 0),
            (try_begin),
              (neg|is_between, ":aristocrat", kingdom_ladies_begin, kingdom_ladies_end),
              (eq, "$cheat_mode", 1),
              (str_store_troop_name_link, s12, ":aristocrat"),
              (call_script, "script_troop_get_relation_with_troop", ":aristocrat", ":troop_no"),
              (str_store_string, s49, "str_s49_s12_s11_rel_reg0"),
            (else_try),
              (str_store_troop_name_link, s12, ":aristocrat"),
              (val_sub, ":num_relations", 1),
              (try_begin),
                (eq, ":num_relations", 0),
                (str_store_string, s49, "str_s49_s12_s11_end"),
              (else_try),
                (str_store_string, s49, "str_s49_s12_s11"),
              (try_end),
            (try_end),
          (try_end),
        (try_end),
      (try_end),

      (try_begin),
        (neq, ":troop_no", "trp_player"),
        (neg|is_between, ":troop_faction", kingdoms_begin, kingdoms_end),
        (neg|is_between, ":troop_no", companions_begin, companions_end),
        (neg|is_between, ":troop_no", pretenders_begin, pretenders_end),

        (try_begin),
          (eq, ":note_index", 0),
          # Dunde's Permadeath BEGIN     
          (try_begin),
             (troop_slot_eq, ":troop_no", slot_troop_death, 1),
             (str_store_string, s0, "str_s54_is_dead"),
          (else_try),
          # Dunde's Permadeath END   
             (str_store_string, s0, "str_s54_has_left_the_realm"),
             # Dunde's Permadeath BEGIN     
          (try_end), 
          # Dunde's Permadeath END   
          (set_trigger_result, 1),
        (else_try),
          (str_clear, s0),
          (this_or_next|eq, ":note_index", 1),
          (eq, ":note_index", 2),
          (set_trigger_result, 1),
        (try_end),

      (else_try),
        (is_between, ":troop_no", companions_begin, companions_end),
        # Dunde's Permadeath BEGIN 
        (try_begin),
           (troop_slot_eq, ":troop_no", slot_troop_death, 1),
           (try_begin),
              (eq, ":note_index", 0),
              (str_store_string, s0, "str_s54_is_dead"),              
           (else_try),
              (str_clear, s0),
           (try_end),            
           (set_trigger_result, 1),
        (try_end),
        (troop_slot_eq, ":troop_no", slot_troop_death, 0),
        # Dunde's Permadeath END 
        (neg|troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
        (eq, ":note_index", 0),
        (set_trigger_result, 1),
        (str_clear, s0),
        (assign, ":companion", ":troop_no"),
        (str_store_troop_name, s4, ":companion"),
        (try_begin),
			(troop_get_slot, ":days_left", ":companion", slot_troop_days_on_mission),

			(this_or_next|main_party_has_troop, ":companion"),
			(this_or_next|troop_slot_ge, ":companion", slot_troop_current_mission, 1),
				(eq, "$g_player_minister", ":companion"),

			(try_begin),
				(troop_slot_eq, ":companion", slot_troop_current_mission, npc_mission_kingsupport),
				(str_store_string, s8, "str_gathering_support"),
				(try_begin),
					(eq, ":days_left", 1),
					(str_store_string, s5, "str_expected_back_imminently"),
				(else_try),
					(assign, reg3, ":days_left"),
					(str_store_string, s5, "str_expected_back_in_approximately_reg3_days"),
				(try_end),
			(else_try),
				(troop_slot_eq, ":companion", slot_troop_current_mission, npc_mission_gather_intel),
				(troop_get_slot, ":town_with_contacts", ":companion", slot_troop_town_with_contacts),
				(str_store_party_name, s11, ":town_with_contacts"),

				(str_store_string, s8, "str_gathering_intelligence"),
				(try_begin),
					(eq, ":days_left", 1),
					(str_store_string, s5, "str_expected_back_imminently"),
				(else_try),
					(assign, reg3, ":days_left"),
					(str_store_string, s5, "str_expected_back_in_approximately_reg3_days"),
				(try_end),
			(else_try),

				(troop_slot_ge, ":companion", slot_troop_current_mission, npc_mission_peace_request),
				(neg|troop_slot_ge, ":companion", slot_troop_current_mission, 8),

				(troop_get_slot, ":faction", ":companion", slot_troop_mission_object),
				(str_store_faction_name, s9, ":faction"),
				(str_store_string, s8, "str_diplomatic_embassy_to_s9"),
				(try_begin),
					(eq, ":days_left", 1),
					(str_store_string, s5, "str_expected_back_imminently"),
				(else_try),
					(assign, reg3, ":days_left"),
					(str_store_string, s5, "str_expected_back_in_approximately_reg3_days"),
				(try_end),
			(else_try),
				(eq, ":companion", "$g_player_minister"),
				(str_store_string, s8, "str_serving_as_minister"),
				(str_store_party_name, s9, "$g_player_court"),
				(is_between, "$g_player_court", centers_begin, centers_end),
				(str_store_string, s5, "str_in_your_court_at_s9"),
			(else_try),
				(eq, ":companion", "$g_player_minister"),
				(str_store_string, s8, "str_serving_as_minister"),
				(str_store_string, s5, "str_awaiting_the_capture_of_a_fortress_which_can_serve_as_your_court"),
			(else_try),
				(main_party_has_troop, ":companion"),
				(str_store_string, s8, "str_under_arms"),
				(str_store_string, s5, "str_in_your_party"),
			(try_end),

			(str_store_string, s0, "str_s4_s8_s5"),

		(else_try),
			(str_store_string, s0, "str_whereabouts_unknown"),
		(try_end),

	  (else_try),
        (is_between, ":troop_no", pretenders_begin, pretenders_end),
        # Dunde's Permadeath BEGIN 
        (try_begin),
           (troop_slot_eq, ":troop_no", slot_troop_death, 1),
           (try_begin),
              (eq, ":note_index", 0),
              (str_store_string, s0, "str_s54_is_dead"),              
           (else_try),
              (str_clear, s0),
           (try_end),            
           (set_trigger_result, 1),
        (try_end),
        (troop_slot_eq, ":troop_no", slot_troop_death, 0),
        # Dunde's Permadeath END 
        (neg|troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
        (neq, ":troop_no", "$supported_pretender"),

        (troop_get_slot, ":orig_faction", ":troop_no", slot_troop_original_faction),
        (try_begin),
          (faction_slot_eq, ":orig_faction", slot_faction_state, sfs_active),
          (faction_slot_eq, ":orig_faction", slot_faction_has_rebellion_chance, 1),
          (try_begin),
            (eq, ":note_index", 0),
            (str_store_faction_name_link, s56, ":orig_faction"),
            (str_store_string, s0, "@{s54} is a claimant to the throne of {s56}.", 0),
            (set_trigger_result, 1),
          (try_end),
        (else_try),
          (try_begin),
            (str_clear, s0),
            (this_or_next|eq, ":note_index", 0),
            (this_or_next|eq, ":note_index", 1),
            (eq, ":note_index", 2),
            (set_trigger_result, 1),
          (try_end),
        (try_end),

      (else_try),
        (try_begin),
          (eq, ":note_index", 0),
          (faction_get_slot, ":faction_leader", ":troop_faction", slot_faction_leader),
          (str_store_troop_name_link, s55, ":faction_leader"),
          (str_store_faction_name_link, s56, ":troop_faction"),
          (assign, ":troop_is_player_faction", 0),
          (assign, ":troop_is_faction_leader", 0),
          (try_begin),
            (eq, ":troop_faction", "fac_player_faction"),
            (assign, ":troop_is_player_faction", 1),
          (else_try),
            (eq, ":faction_leader", ":troop_no"),
            (assign, ":troop_is_faction_leader", 1),
          (try_end),
          (assign, ":num_centers", 0),
          (str_store_string, s58, "@nowhere"),
          (try_for_range_backwards, ":cur_center", centers_begin, centers_end),
            (party_slot_eq, ":cur_center", slot_town_lord, ":troop_no"),
            (try_begin),
              (eq, ":num_centers", 0),
              (str_store_party_name_link, s58, ":cur_center"),
            (else_try),
              (eq, ":num_centers", 1),
              (str_store_party_name_link, s57, ":cur_center"),
              (str_store_string, s58, "@{s57} and {s58}"),
            (else_try),
              (str_store_party_name_link, s57, ":cur_center"),
              (str_store_string, s58, "@{!}{s57}, {s58}"),
            (try_end),
            (val_add, ":num_centers", 1),
          (try_end),
          (troop_get_type, reg3, ":troop_no"),
          (troop_get_slot, reg5, ":troop_no", slot_troop_renown),
          (troop_get_slot, reg15, ":troop_no", slot_troop_controversy),

          (str_clear, s59),
          (try_begin),
            (call_script, "script_troop_get_player_relation", ":troop_no"),
            (assign, ":relation", reg0),
            (store_add, ":normalized_relation", ":relation", 100),
            (val_add, ":normalized_relation", 5),
            (store_div, ":str_offset", ":normalized_relation", 10),
            (val_clamp, ":str_offset", 0, 20),
            (store_add, ":str_id", "str_relation_mnus_100_ns",  ":str_offset"),
            (neq, ":str_id", "str_relation_plus_0_ns"),
            (str_store_string, s60, "@{reg3?She:He}"),
            (str_store_string, s59, ":str_id"),
            (str_store_string, s59, "@{!}^{s59}"),
          (try_end),
          #lord recruitment changes begin
          #This sends a bunch of political information to s47.

          #refresh registers
          (assign, reg9, ":num_centers"),
          (troop_get_type, reg3, ":troop_no"),
          (troop_get_slot, reg5, ":troop_no", slot_troop_renown),
          (assign, reg4, ":troop_is_faction_leader"),
          (assign, reg6, ":troop_is_player_faction"),

          (troop_get_slot, reg17, ":troop_no", slot_troop_wealth), #DEBUGS
          (str_store_string, s0, "str_lord_info_string", 0),
          #lord recruitment changes end
          (add_troop_note_tableau_mesh, ":troop_no", "tableau_troop_note_mesh"),
          (set_trigger_result, 1),
        (try_end),
      (try_end),
     ]),
 
Back
Top Bottom