(try_for_range, ":hero_id", additional_heroes_begin, additional_heroes_end),
(troop_set_slot, ":hero_id", slot_troop_honorific, "str_npc2_honorific"),
(try_end),
dstemmer said:I haven't yet looked at the code, but this looks really neat. Currently, how does it name troops that have been upgraded? I'd like to be able to choose the troop's name from a random pool of names.
dunde said:Naglfaar, I found a way to solve NO STRING Error. Add this lines on "game_start" :
so, the new heroes will call the player, just like marmid, (sir or madame).Code:(try_for_range, ":hero_id", additional_heroes_begin, additional_heroes_end), (troop_set_slot, ":hero_id", slot_troop_honorific, "str_npc2_honorific"), (try_end),
About the uggly face, we can change so we talk directly to the hero instead of the troop.
On module_dialogs.py, change :
(eq, "$g_talk_troop", reg20),
to :
(eq, "$g_talk_troop", reg21),
and on module_game_menus.py, change :
(start_map_conversation, ":troop_id"),
to :
(start_map_conversation, ":hero_id"),
(is_between,"$g_talk_troop", companions_begin, companions_end),
(is_between,"$g_talk_troop", companions_begin, companions_end),
[anyone,
"event_triggered",
[
(store_conversation_troop,"$g_talk_troop"),
# Fix to remove NO STRING Error begin ####################
(is_between,"$g_talk_troop", companions_begin, companions_end), #(is_between,"$g_talk_troop", additional_heroes_begin, additional_heroes_end),
# Fix to remove NO STRING Error End ####################
(eq, "$g_talk_troop", reg21),
(eq, "$g_upgrade_talk", 1),
(troop_get_type, reg65, "trp_player"),
(str_store_string,s65,"@{reg65?my Lady:my Lord}"),
(str_store_troop_name,s21,reg21),
[anyone|plyr,"member_question_2", [], "Tell me your story again.", "member_background_recap",[]],
[anyone|plyr,"member_question_2", [(is_between, "$g_talk_troop", companions_begin, companions_end),], "Tell me your story again.", "member_background_recap",[]],
[anyone,
"event_triggered",
[
(store_conversation_troop,"$g_talk_troop"),
(is_between,"$g_talk_troop", additional_heroes_begin, additional_heroes_end),
(eq, "$g_talk_troop", reg21),
(eq, "$g_upgrade_talk", 1),
(troop_get_type, reg65, "trp_player"),
(str_store_string,s65,"@{reg65?my Lady:my Lord}"),
(str_store_troop_name,s21,reg21),
],
"Yes, {s65}?",
"upgrade_talk",
[]
],
[anyone|plyr,
"upgrade_talk",
[],
"I have seen you fight well in battles, soldier.",
"upgrade_talk_1",
[]
],
[anyone,
"upgrade_talk_1",
[
],
"I only do my duty to {s65}, sire.",
"upgrade_talk_2",
[]
],
[anyone|plyr,
"upgrade_talk_2",
[],
"And well, too. The only time I've heard someone with such skills in battle, it has been in sagas. You are a hero!",
"upgrade_talk_3a",
[]
],
[anyone|plyr,
"upgrade_talk_2",
[],
"I just wanted you to know that I take notice in such skills in battle. Now fall back in line!",
"upgrade_talk_3b",
[]
],
[anyone,
"upgrade_talk_3a",
[
],
"You honour me with your words. I will do my utter best to honour them.",
"upgrade_talk_4a",
[]
],
[anyone|plyr,
"upgrade_talk_4a",
[],
"From now on you shall be remembered as a {s21}",
"upgrade_talk_5",
[]
],
[anyone,
"upgrade_talk_5",
[
(call_script,"script_upgrade_troop_to_hero", reg20, reg21),
],
"I will defend my new title to my death, and I will not let you down. I promise you this; The blood on my steel will never dry!",
"close_window",
[]
],
[anyone,
"upgrade_talk_3b",
[
],
"Yes, {s65}",
"close_window",
[]
],
NaglFaar said:It shouldn't be too hard, if I'm not mistaken. AndifI know you have some skills with the module so it should be a piece of cake
Hello! My name is <John Bumbleson>. I was born a serf in a <Vaegir village>. But I left home because of <bubonic plague> and ended up in <Sargoth>. Then I fought for the <Nords> as a <footman>. I am <curiously bisexual> but do not enjoy <Khergit horse buggery>. I dislike companions who <have mustaches> and enjoy eating <Velvet>. I enjoy <burning villages> but I am annoyed by <boorish behavior while burning villages>.
yeah, but AFAIK, there's no way to rename the troops in gameplay. We may generate random name and apply the name before writting the troops.txt by tweaking proccess_troops.py, but it will be applied once, after compiling, the names will be fix.dstemmer said:Shh, don't tell anyone, I like to keep it a secret so I can get other people to write my code for me
Yeah it should be easy to write a Python script that will generate a bunch of randomly-named troops. You could even do mad-libs backstories for them!
dunde said:I see you implement the ugly face conversation fix, you should change the module_game_menus.py too:
("upgrade_to_hero",0,
"You notice that one or more of your warriors exceeds your expectations in battle. ^You walk towards the lines of your troops, and ...",
"none",
[
(assign, reg11, 0), # sub menu 1
(assign, reg12, 0), # sub menu 2
(assign, reg13, 0), # sub menu 3
(assign, reg14, 0), # sub menu 4
(assign, "$g_upgrade_talk", 0),
],
[
("hero_1",
[
(assign, ":limit", reg10),
(assign, ":found", 0),
(try_for_range, ":hero_id", ":limit", additional_heroes_end),
(eq, ":found", 0),
(troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
(gt, ":hero_ocu", 0),
(neq, ":hero_ocu",slto_kingdom_hero),
(neq, ":hero_ocu",slto_player_companion),
(main_party_has_troop, ":hero_ocu"),
(assign, ":found", 1),
(assign, reg11, ":hero_id"),
(try_end),
(eq, ":found", 1),
(str_store_troop_name,s1,reg11),
],"stop to talk to {s1}",
[
(assign, ":hero_id", reg11),
(troop_get_slot, ":troop_id", ":hero_id", slot_troop_occupation),
(assign, reg20, ":troop_id"),
(assign, reg21, ":hero_id"),
(assign, "$g_upgrade_talk", 1),
(start_map_conversation, ":hero_id"),
#changed from (start_map_conversation, ":troop_id"),
(change_screen_return),
]
),
("hero_2",
[
(ge, reg11, reg10),
(store_add, ":limit", reg11, 1),
(assign, ":found", 0),
(try_for_range, ":hero_id", ":limit", additional_heroes_end),
(eq, ":found", 0),
(troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
(gt, ":hero_ocu", 0),
(neq, ":hero_ocu",slto_kingdom_hero),
(neq, ":hero_ocu",slto_player_companion),
(main_party_has_troop, ":hero_ocu"),
(assign, ":found", 1),
(assign, reg12, ":hero_id"),
(try_end),
(eq, ":found", 1),
(str_store_troop_name,s1,reg12),
],"stop to talk to {s1}",
[
(assign, ":hero_id", reg12),
(troop_get_slot, ":troop_id", ":hero_id", slot_troop_occupation),
(assign, reg20, ":troop_id"),
(assign, reg21, ":hero_id"),
(assign, "$g_upgrade_talk", 1),
(start_map_ (start_map_conversation, ":hero_id"),
#changed from (start_map_conversation, ":troop_id"),
(change_screen_return),
]
),
("hero_3",
[
(gt, reg12, reg11),
(store_add, ":limit", reg12, 1),
(assign, ":found", 0),
(try_for_range, ":hero_id", ":limit", additional_heroes_end),
(eq, ":found", 0),
(troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
(gt, ":hero_ocu", 0),
(neq, ":hero_ocu",slto_kingdom_hero),
(neq, ":hero_ocu",slto_player_companion),
(main_party_has_troop, ":hero_ocu"),
(assign, ":found", 1),
(assign, reg13, ":hero_id"),
(try_end),
(eq, ":found", 1),
(str_store_troop_name,s1,reg13),
],"stop to talk to {s1}",
[
(assign, ":hero_id", reg13),
(troop_get_slot, ":troop_id", ":hero_id", slot_troop_occupation),
(assign, reg20, ":troop_id"),
(assign, reg21, ":hero_id"),
(assign, "$g_upgrade_talk", 1),
(start_map_conversation, ":hero_id"),
#changed from (start_map_conversation, ":troop_id"),
(change_screen_return),
]
),
("hero_4",
[
(gt, reg13, reg12),
(store_add, ":limit", reg13, 1),
(assign, ":found", 0),
(try_for_range, ":hero_id", ":limit", additional_heroes_end),
(eq, ":found", 0),
(troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
(gt, ":hero_ocu", 0),
(neq, ":hero_ocu",slto_kingdom_hero),
(neq, ":hero_ocu",slto_player_companion),
(main_party_has_troop, ":hero_ocu"),
(assign, ":found", 1),
(assign, reg14, ":hero_id"),
(try_end),
(eq, ":found", 1),
(str_store_troop_name,s1,reg14),
],"stop to talk to {s1}",
[
(assign, ":hero_id", reg14),
(troop_get_slot, ":troop_id", ":hero_id", slot_troop_occupation),
(assign, reg20, ":troop_id"),
(assign, reg21, ":hero_id"),
(assign, "$g_upgrade_talk", 1),
(start_map_conversation, ":hero_id"),
#changed from (start_map_conversation, ":troop_id"),
(change_screen_return),
]
),
("prev",
[
(gt, reg10, additional_heroes_begin),
(assign, ":limit", reg10),
(assign, ":found", 0),
(try_for_range_backwards, ":hero_id", ":limit", additional_heroes_begin),
(lt, ":found", 4),
(troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
(gt, ":hero_ocu", 0),
(neq, ":hero_ocu",slto_kingdom_hero),
(neq, ":hero_ocu",slto_player_companion),
(main_party_has_troop, ":hero_ocu"),
(assign, reg15, ":hero_id"),
(val_add, ":found", 1),
(try_end),
(gt, ":found", 0),
],"go to the previous lines",
[
(assign, reg10, reg15),
(jump_to_menu, "mnu_upgrade_to_hero"),
]
),
("next",
[
(gt, reg14, reg13),
(store_add, ":limit", reg14, 1),
(assign, ":found", 0),
(try_for_range, ":hero_id", ":limit", additional_heroes_end),
(eq, ":found", 0),
(troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
(gt, ":hero_ocu", 0),
(neq, ":hero_ocu",slto_kingdom_hero),
(neq, ":hero_ocu",slto_player_companion),
(main_party_has_troop, ":hero_ocu"),
(assign, ":found", 1),
(try_end),
(eq, ":found", 1),
],"go to the next lines",
[
(store_add, reg10, reg14, 1),
(jump_to_menu, "mnu_upgrade_to_hero"),
]
),
("close",
[
],"close",
[
(assign, "$g_upgrade_talk", 1),
(change_screen_map),
]
),
]
),
So we directly talk to the hero, not the troop, so because hero has fix facecode, start_map_conversation will call not ugly face person.
See the lines,
(assign, reg21,":hero_id"),
above. Those were connected with the line on module_dialogs.py:
(eq, "$g_talk_troop",reg21),
we call the hero to do map conversation on game_menus, and check if we talk to a hero on dialogs.py.
(start_map_conversation, ":hero_id"),
#changed from (start_map_conversation, ":troop_id"),