Re-Titling Troops (a possible approach)

Users who are viewing this thread

Mordachai

Squire
Many folks have wanted to have dynamic titles for the player or various troops in the game.  MS doesn't allow you to outright rename a troop (a pity), but if you're ambitious enough, it might be doable (for all of the non-hard-coded places) to use the following:

Use a script instead of using:

str_store_troop_name
str_store_party_name
str_store_troop_name_link
str_store_party_name_link

Replace those with say just two scripts (and have them always use the link).  Then you simply have to replace all places that use the above, with a call to your script.  Then you script would have the smarts to do the title.

For example:

Code:
# script_get_troop_name
# arg1: string register to store the name in
# arg2: troop id
# output: string containing the correctly titled troop
# uses: s60
("get_troop_name", 
  [
    (store_script_param, ":sreg", 1),
    (store_script_param, ":troop", 2),
    
    (try_begin),
      (troop_is_hero, ":troop"),
      (store_troop_faction, ":faction", ":troop"),
      (str_store_troop_name_link, s60, ":troop"),
      (try_begin),
        # king overrides all other titles
        (faction_slot_eq, ":faction", slot_faction_leader, ":troop"), # this troop is the king of his/her faction
        (str_store_string, ":sreg", "@King {s60}"),
      (else_try),
        (faction_slot_eq, ":faction", slot_faction_marshall, ":troop"), # this fella is the marshal (but not king)
        (str_store_string, ":sreg", "@Marshal {s60}"),
      (else_try),
        # default to Lord (though you could make this more complex - like have Earl, Baron, Viscount, etc., depending on the number and type of estates they hold...
        (str_store_string, ":sreg", "@Lord {s60}"),
      (try_end),
    (else_try),
      # regular troops don't have a title, ever (nor a link)...
      (str_store_troop_name, ":sreg", ":troop"),
    (try_end),
  ]
),

To use it, you'd literally, replace:
(str_store_troop_name, s1, ":troop_no"),
with:
(call_script, "script_get_troop_name", s1, ":troop_no),

Which string register you use is arbitrary.  You can even use s60.

Then, write a similar script for party name, do a lot of replacements throughout the code, and you'll accomplish the same thing for parties.

Also, you could make the titles gender-aware, so that Ladies are returned as "Lady <whomever>" instead of Lord.  Same thing for Queen, and so on...

G/L

DISCLAIMER: I haven't compiled or run the above.  Its a concept - and may need to be massaged a bit to get it to work properly.  But I think you can grok the concept with this visual aide...
 
Except that they'll still show up with their regular names in the Party screen and on the Map.
 
True.

Which is why you'll go through module_troops.py and remove the titles from their names there.

So "Pendour" will be "Pendour" in a hard-coded location (say when mousing over his party, or seeing him in a garrison, etc.), but when you actually talk to him or see his name in the game log, etc., it will be "Marshal Pendour" or "Earle Pendour", etc.,

There's no way around the fact that there are hard-coded places that you can't mess with.  So for many folks, this is not a productive path.  But there are some I would suspect that would be satisfied with that minor inconsistency.

It does also mean that one's quest logs & general in-game data won't have the titled names.  But the links will still work. So when you look at the Nords under Factions, you'll still have "Rognar" linked, just  not "King Rognar".  Plus, if you actually properly kill Rognar or otherwise change the current king in your mod, it won't be awkward with having the king be referred to as "Lord ..." when in fact he's now the king.

So its a trade-off.
 
Hello, Mordachai.

I tried this method for renaming troops. I'm not good in scripting and I done namely what you've wrote:
I took Native files, paste your script at the bottom of module_scripts.py, replased all (str_store_troop_name, s1, ":troop_no") in module_scripts.py (1 hit) and module_dialogs.py (6 hits) by (call_script, "script_get_troop_name", s1, ":troop_no") and run build_module.bat.
All compiled well, but when I start new game I couldn't find any changes in lord names. I spoke with few lords in fields, towns and harrisons of castles, start few lord quests, fight with some lords, I looked for logs and quick messages... All was as in Native.  :cry:

P.S. What do you mean about "similar script for party name, a lot of replacements throughout the code"?
 
ArRaid,

This is an idea for how to approach the problem, not a canned solution.  The idea of replacing all (str_store_troop_name... has to be done for all occurrences of str_store_troop_name, not just those that happened to use s1!  There are literally hundreds of such places to go and fix (and you have to use the right string register in each and every one of them).

I would suggest that if the second part of my post doesn't make sense to you - that you avoid using this idea.  Its a rough idea, not a finished one, and it requires someone who understands the full approach to extend it to its logical conclusion.  And I don't know that it would really work well enough in practice, which is where Fisheye's comment comes from.  So its a gamble.
 
I was hoping....  but alas, this still would not work for what I want to do...  I need to change the string name intirely....

Still hoping for a change with the Module System...
 
i think that it would be awesome that if you are level 1-10 no added stuff...then once you are level 21-30 you get to choose an "adjective" to add to your name (or maybe be chosen randomly from a list) like at first you are John :grin: and later you become John the baptist :grin: just an example!
what do you think?
and maybe all those random names depend on your skills... like if you have a lot of intelligence skills (like surgery and other stuff you might get a name like john the healer, and the name gives you a bonus to all intelligence skills (something like a book)
so something like this:
intelligence:
"The Healer" +1 to surgery skills
"The Savior" +1 other healing skills
Agility:
"The Swift" +1 to athletics
"The Fast" +1 to riding
Strength:
"The Warrior" +1 to ironflesh
"The Blade" +1 to power of hits
Charisma:
"The Cunning" +1 to persuasion
"The Tactitian" +1 to tactics or leadership

and then unique ones:
The Blademaster +3 damage with melee and +50 to all two handed and one handed weps
The Destroyer +5 to melee wep damage
The Great +3 to leadership
The Immortal +5 to ironflesh
The Blessed  +3 to all (hardest to achieve after chuck :grin: )
The Merciful +20 honour (you can get this if you have over 20 honour)
The Dreadful -morale to enemies
The Crazy + people dont like being in your presence :grin: enemies flee
The Chuck +Chuck round house kick...  uhmm, is there anything to explain?




 
I still think that this should be properly added to the Module System...  I can see why they might have left in out in the begining.  Might cause issues with renaming troop types, but it's a nice feature for NPCs.
 
Why would it mess up regular troops?

troops (npcs and regulars), are referenced by ID number, not name.

Maybe they didn't want to have the save game have to store the name of every single troop type (npc + regular) in the game?  ... although, they must be doing so for all parties, so why not troops? ...

its a mystery
 
Mordachai said:
Why would it mess up regular troops?

troops (npcs and regulars), are referenced by ID number, not name.

Maybe they didn't want to have the save game have to store the name of every single troop type (npc + regular) in the game?  ... although, they must be doing so for all parties, so why not troops? ...

its a mystery

Parties are less in number than troops, and you would run into issues with merging troops.  If I renamed my mercs from watchmen to dudes, then I had more watchmen join, would they be in the same stack?  By ID they should.  But then what name to they keep?

Again, I see this only being really useful for NPC (unique) troops.
 
If troop ID 121 (I'm grabbing that out of a hat, but for our discussion, lets assume that 121 = mercenary in the troop.py file).... so, if I rename troop 121 to "Sasquatches", then in every stack in every town, in every party, in every boat, everywhere in the world simultaneously their name is now "Sasquatches".  When two parties merged, if either of them contained a stack of troop ID 121's, then the merged party would continue to have (more) 121's, and when looking at the name, it would be "Sasquatches".

The game stores party names on a per party basis - parties can be hard coded (such as p_main_party, ID = 0, never changes, same thing for villages, etc.), or they can be dynamically created (every kingdom party in the game, caravan parties, bandit parties, etc.).  So the devs at TaleWorlds basically had to have a string to store party names in dynamically.  There's no fixed identity for them.

But when it comes to troops, there is nothing dynamic about them.  They are ID #121 for the entire game, no matter what.  And any two stacks of 121 are still two stacks of 121, no separate names.

IFF tale worlds were to add the ability to change troop names, it would be at the global level - NOT at an individual stack level.  Hence, no conflict.  Ever. :wink:
 
Back
Top Bottom