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:
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...
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...