Player Kingdom Name Reference?

Users who are viewing this thread

if you want your kingdom to have troops like "MyKingdom Recruits", "MyKingdom Knights", etc you will need to:

- create new troops and set a troop tree for them
- set a new culture for your kingdom (so you are not a Nord, or whatever - native?)
- configure your culture troops
- force change the culture of towns, villages, ... when you conquer them so they switch to yours

that way you will be able to recruit your custom troops, with custom names, at your holdings (or from vassals).

@somebody already described how you can change the name dynamically.
 
Somebody said:
Use str_store_faction_name and then troop_set_name with a quickstring.

Somebody, could you expand on that anymore?
Like I don't really understand where to put any of that.
I am trying to get dynamically named troops here.

Cause like I see this in strings:
Code:
  ("default_kingdom_name", "{s0}'s Kingdom"),
And I know {s0} refers to the player name, so I'm trying to get like an {s113} or whatever that I can use in troops.
I have a feeling i'll have to add an import line at the top of troops as well though.
 
str_default_kingdom_name is used by storing the player's name into a string register s0, then applying that string as the faction name when the player founds a kingdom. Similarly, whenever the player founds a kingdom (and changes the name) that string template will eventually be instantiated with the faction's name. So make another bunch of strings containing the troop names you want (no need to fiddle around in module_troops) using another register (although you could overwrite s0), then use str_store_string (or just str_store_faction_name, they'll be equivalent in that context) to populate the string register.
Code:
 ("default_kingdom_recruit", "{s1} Gold Farmers"),
("default_kingdom_veterans", "{s1} Scrubs"),
Then call troop_set_name with the register that you just stored those names in, iterating over all your troops.
 
Hmm, but will that translate properly with the singular and plural troops? Or do they need separate entries?

If i'm understanding you right, I need to do something like:
Code:
  ("name_kingdom_text", "What will be the name of your kingdom?"),
  ("default_kingdom_name", "{s0}'s Kingdom"),
  #Malik Player Faction Troops
  ("default_kingdom_recruit", "{s1} Recruits"),
  ("default_kingdom_militia1", "{s1} Melee Militia"),
  ("default_kingdom_militia2", "{s1} Ranged Militia"),
  #Malik Player Faction Troops End

And then below, and put a call somewhere in each troop entry I assume, maybe?
Code:
  ["player_recruit","{s1} Recruit","{s1} Recruits",tf_guarantee_ranged|tf_guarantee_armor|tf_guarantee_boots,0,0,fac_player_supporters_faction,
   [itm_mace_1,itm_pitch_fork,itm_arrows,itm_bolts,itm_wrapping_boots,itm_linen_tunic,itm_straw_hat,itm_sword_medieval_a,
    itm_scythe,itm_tab_shield_round_a,itm_tab_shield_kite_a,itm_tab_shield_heater_a,itm_tab_shield_pavise_a,itm_hunting_bow,itm_hunting_crossbow],
   def_attrib|level(4),wp(60),knows_common,swadian_face_younger_1, swadian_face_middle_2],   

  ["player_meleemilitia","{s1} Melee Militia","{s1} Melee Militia",tf_guarantee_armor|tf_guarantee_shield|tf_guarantee_helmet|tf_guarantee_boots,0,0,fac_player_supporters_faction,
   [itm_ankle_boots,itm_padded_cloth,itm_padded_coif,itm_sword_medieval_c,itm_spear,itm_tab_shield_round_b,itm_tab_shield_kite_b,itm_tab_shield_heater_b,itm_tab_shield_pavise_b],
   def_attrib|level(7),wp_melee(80),knows_common|knows_shield_1|knows_ironflesh_1|knows_power_strike_1,swadian_face_younger_1, swadian_face_middle_2],  
 
  ["player_rangedmilitia","{s1} Ranged Militia","{s1} Ranged Militia",tf_guarantee_armor|tf_guarantee_ranged|tf_guarantee_helmet|tf_guarantee_boots,0,0,fac_player_supporters_faction,
   [itm_arrows,itm_bolts,itm_arrows,itm_bolts,itm_hunter_boots,itm_gambeson,itm_arming_cap,itm_sword_medieval_b_small,itm_short_bow,itm_light_crossbow],
   def_attrib|level(7),wp(75),knows_common|knows_ironflesh_1|knows_power_draw_1,swadian_face_younger_1, swadian_face_middle_2],

And I guess i have to do something in dialogs as well.



Cause I have this, and i basically see it functioning the way I would want it to in dialogs, but it does pull a whole list and not a specific faction, but I think I could figure that out:
099A4FD9A0FE25A6925D28ED02B65236623869DD

404ADE03447B1B71647A5383794DB16057A60032
So I think I have to do something similar to this, but then getting it to show up for troops is kinda halting me:
[anyone|repeat_for_factions|plyr,"ramun_faction",
  [  (store_repeat_object, ":faction_no"),
      (this_or_next|is_between, ":faction_no", kingdoms_begin, kingdoms_end),
      (this_or_next|is_between, ":faction_no", "fac_commoners", "fac_neutral"),
      (is_between, ":faction_no", "fac_manhunters", "fac_mountain_bandits"),
      #(assign, reg1, ":faction_no"),
      (try_begin),
        (is_between, ":faction_no", npc_kingdoms_begin, kingdoms_end),
        (faction_get_slot, ":str", ":faction_no", slot_faction_adjective),
        (str_store_string, s2, ":str"),
      (else_try),
        (str_store_faction_name, s2, ":faction_no"),
      (try_end),
  ], "Some {s2} please.", "ramun_select",
  [(store_repeat_object, reg2),(str_store_faction_name, s2, reg2),]
  ],
 
Strings are in the right place, however they aren't being used at all. The purpose of string register is to hold other strings, in this case when referencing your kingdom's name. The player's kingdom name only changes through the presentation and when supporting pretenders (however that name will be fixed as players shouldn't have access to the presentation).
Code:
      (ti_on_presentation_event_state_change,
       [(store_trigger_param_1, ":object"),
        (try_begin),
          (eq, ":object", "$g_presentation_obj_name_kingdom_1"),
          (str_store_string, s7, s0),
        (else_try),
          (eq, ":object", "$g_presentation_obj_name_kingdom_2"),
          (faction_set_name, "fac_player_supporters_faction", s7),
          (faction_set_color, "fac_player_supporters_faction", 0xFF0000),
          (assign, "$players_kingdom_name_set", 1),
          (presentation_set_duration, 0),
        (try_end),
        ]),
      ]),
When that change is implemented and before the presentation ends, you can store the name in a string register and apply it to your custom troop templates. Add the plurals and change your strings to s7 as well to make them match up. You can either have the plural forms all grouped together in the same order at the end or immediately following the singular form.
Code:
(assign, ":name_str", "str_default_kingdom_recruit"),
(try_for_range, ":troop_no", "trp_player_recruit", "trp_player_recruit_end"),
  (str_store_string, s1, ":name_str"),
  (troop_set_name, ":troop_no", s1),
  (val_add, ":name_str", 1),
  (str_store_string, s1, ":name_str"),
  (troop_set_plural_name, ":troop_no", s1),
  (val_add, ":name_str", 1),
(try_end),
However, there does not exist an adjective to describe the player's faction culture as they may rename it however they want. Do something like this as a compromise.
Code:
      (try_begin),
         (is_between, ":faction_no", npc_kingdoms_begin, kingdoms_end),
         (faction_get_slot, ":str", ":faction_no", slot_faction_adjective),
         (str_store_string, s2, ":str"),
      (else_try),
         (eq, ":faction_no", "fac_player_supporters_faction"),
         (str_store_string, s2, "@of ours"),
      (else_try),
         (str_store_faction_name, s2, ":faction_no"),
      (try_end),
 
Back
Top Bottom