JACVBHINDS // 寒心420? said:Ackkckctually it's 100 million seconds which is just over 3 years.
seconds in a scene, hours on the world map, if you want to be technical , so half right, half wrong
JACVBHINDS // 寒心420? said:Ackkckctually it's 100 million seconds which is just over 3 years.
sorry to bump this but how would you get it to work for player faction?Zaitenko said:Zaitenko's Reinforcement Script
Allright I've made a modification to M&B that makes the castles/towns get reinforcements from their respective villages when they go below a number of troops in their garrisons.
I did it because I got tired of being able to tear down town defenses with alot less men than the castle/town by just attacking it repeatedly.
And when you had taken a castle/town I've never seen an npc lord that got command of it reinforce the garrison himself.
The modification makes Reinforcement parties spawn from the villages and travel to the castles/towns and then join them upon arrival.
It's set not to reinforce player owned towns/castles, but that is a personal preferance and easy to change.
To the code!!
In module_triggers we add this code. Basicly it's the main code that determins if a party should spawn, where it should go and what template it should use.
I do believe you can add the code anywhere you like in module_triggers. Afaik there are no hardwired triggers.
Code:(36, 0, 0.0, [], [ ## Set the reinforcements interval to 36 Game hours. Change as you feel like. (try_for_range, ":center", walled_centers_begin, walled_centers_end), (store_faction_of_party, ":faction", ":center"), (party_get_num_companions, ":garrison", ":center"), (faction_get_slot, ":party_template_a", ":faction", slot_faction_reinforcements_a), (faction_get_slot, ":party_template_b", ":faction", slot_faction_reinforcements_b), (faction_get_slot, ":party_template_c", ":faction", slot_faction_reinforcements_c), (assign, ":party_template", 0), (try_begin), (party_slot_eq, ":center", slot_party_type, spt_town), (lt, ":garrison", 200), ## Under this number of troops will towns get reinforcements (assign, ":party_template", "pt_reinforcements"), (else_try), (party_slot_eq, ":center", slot_party_type, spt_castle), (lt, ":garrison", 70), ## Under this number of troops will castles get reinforcements (assign, ":party_template", "pt_reinforcements"), (try_end), (try_begin), (gt, ":party_template", 0), (try_for_range, ":village_reinforcements", villages_begin, villages_end), (try_begin), (party_slot_eq, ":center", slot_party_type, spt_castle), ## For Castles (party_slot_eq, ":village_reinforcements", slot_village_bound_center, ":center"), (party_slot_eq, ":village_reinforcements", slot_village_state, svs_normal), ## Not if the village is being raided or is looted (neg|party_slot_eq, ":center", slot_town_lord, "trp_player"), ## Not a player owned center (spawn_around_party, ":village_reinforcements", ":party_template"), (assign, ":result", reg0), (store_random_in_range, ":rand", 0, 100), (try_begin), (is_between, ":rand", 0, 45), ## Get weakest template (party_add_template, ":result", ":party_template_a"), (else_try), (is_between, ":rand", 45, 85), ## Get stronger template (party_add_template, ":result", ":party_template_b"), (else_try), (ge, ":rand", 85), ## Get strongest template (party_add_template, ":result", ":party_template_c"), (try_end), (party_set_faction, ":result", ":faction"), (party_set_slot, ":result", slot_party_type, spt_reinforcement_party), (party_set_slot, ":result", slot_party_ai_object, ":center"), (str_store_party_name, s14, ":village_reinforcements"), (party_set_name, ":result", "@Reinforcements from {s14}"), (party_set_ai_behavior,":result",ai_bhvr_travel_to_party), (party_set_ai_object,":result", ":center"), (party_set_flags, ":result", pf_default_behavior, 1), (else_try), (party_slot_eq, ":center", slot_party_type, spt_town), ## For Towns (party_slot_eq, ":village_reinforcements", slot_village_bound_center, ":center"), (party_slot_eq, ":village_reinforcements", slot_village_state, svs_normal), ## Not if the village is being raided or is looted (neg|party_slot_eq, ":center", slot_town_lord, "trp_player"), ## Not a player owned center (spawn_around_party, ":village_reinforcements", ":party_template"), (assign, ":result", reg0), (store_random_in_range, ":rand", 0, 100), (try_begin), (is_between, ":rand", 0, 45), ## Get weakest template (party_add_template, ":result", ":party_template_a"), (else_try), (is_between, ":rand", 40, 85), ## Get stronger template (party_add_template, ":result", ":party_template_b"), (else_try), (ge, ":rand", 85), ## Get strongest template (party_add_template, ":result", ":party_template_c"), (try_end), (party_set_faction, ":result", ":faction"), (party_set_slot, ":result", slot_party_type, spt_reinforcement_party), (party_set_slot, ":result", slot_party_ai_object, ":center"), (str_store_party_name, s14, ":village_reinforcements"), (party_set_name, ":result", "@Reinforcements from {s14}"), (party_set_ai_behavior,":result",ai_bhvr_travel_to_party), (party_set_ai_object,":result", ":center"), (party_set_flags, ":result", pf_default_behavior, 1), (try_end), (try_end), (try_end), (try_end)])
Okay, that's a chunk of code that I've tried to comment for clarity on some parts of it.
The reinforcements will come even if the center is being besieged, but they will come as a small party(or well, as you have defined the reinforcements in you module_party_templates) so keep an eye open while resting at a castle/town and you can intercept them before they sneak in. This makes the most sense to me, but if you don't want them to come if the castle is being besieged, simply add this code
Code:(party_get_slot, ":besieged", ":center", slot_center_is_besieged_by), (neg|ge, ":besieged", 0), #Town/castle is under siege jump out
after the begining
Code:(try_for_range, ":center", walled_centers_begin, walled_centers_end),
I have not given that thorough testing, but I'm pretty sure that will work.
Two rather critical but very small steps will follow. First add this anywhere after the hardwired code in module_party_templates:
Code:("reinforcements","Reinforcements",icon_axeman|pf_show_faction,0,fac_commoners,soldier_personality,[]),
Now to the next step. You may or may not have noticed that I gave the reinforcement party a party type slot called: spt_reinforcement_party
Well there is no such thing if you don't create it. So open up module_constants which is where(afaik) all the diffrent slot types are stored.
Add this line of code where the rest of the slot_party_type value's are.
Code:spt_reinforcement_party = 14
Take notice, if you have modded in other party types your 14 slot may be taken and you may have to give it another slot value.
Easily done. Are we done? No.
At the moment we got reinforcement parties travelling allright, but they are not joining the town/castle. For this to work, we need module_simple_triggers.
I put this code close to the #Troop AI: Merchants thinking line.
Code:(0.2, #Every 0.2 game hours will the game check if there are any reinforcements in the centers. [ (try_for_parties, ":party_no"), (party_slot_eq, ":party_no", slot_party_type, spt_reinforcement_party), #Find parties of the type spt_reinforcement_party (party_is_in_any_town, ":party_no"), # Is the party in any town? (party_get_cur_town, ":cur_center", ":party_no"), #What town are they in? (call_script, "script_party_add_party_companions", ":cur_center", ":party_no"), #Add the party to the center, which is infact a party ;) (party_clear, ":party_no"), #Not sure if this cleaning up is necessary, but it's a precaution so we don't have a bundle of templates lying around. (try_end), ]),
Then ofcourse you can add some hip dialoge to them if you please. I did this quickly:
Code:# Reinforcements [party_tpl|pt_reinforcements,"start", [(eq,"$talk_context",tc_party_encounter), (party_get_slot, ":ai_object", "$g_encountered_party", slot_party_ai_object), (str_store_party_name,s21,":ai_object"), (str_store_party_name, s20, "$g_encountered_party")], "Who goes there? We are {s20}.\ We're on our way to {s21}.", "reinforcements_intro",[]], [anyone|plyr, "reinforcements_intro", [], "I am {playername}. I'm just passing by.", "close_window",[]], [anyone|plyr, "reinforcements_intro", [], "I am {playername}. And I'm here to stop you from reaching your destination!.", "reinforcement_hostile",[]], [party_tpl|pt_reinforcements,"reinforcement_hostile", [(faction_get_slot, ":faction_leader", "$g_encountered_party_faction",slot_faction_leader), (str_store_troop_name, s9, ":faction_leader"),], "What!? We are under the protection of {s9}!\ Be certain he will take vengance!", "reinforcements_attack",[]], [anyone|plyr, "reinforcements_attack", [], "Fine let him! I will kill him after I've dealt with you!", "close_window",[(call_script, "script_make_kingdom_hostile_to_player", "$g_encountered_party_faction", -1), (encounter_attack,0)]], [anyone|plyr, "reinforcements_attack", [], "Allright, go! But you have not seen the last of me!", "close_window",[]],
Haven't really had chance to test it yet but I think it'll work.
And there you have it. Hope you like it!
Zait
Edit - Working On:
Anyway, I've updated the script due to a simple copy/paste err of mine. The script still worked fine but it took the garrison size from the garrison AND the potential parties resting at the castle/town. This was not intended and it's been fixed. If you run the script in your mod, re-copy paste the part that goes into module_triggers.py.
Thanks NCrawler for dialogue correction.
(neg|party_slot_eq, ":center", slot_town_lord, "trp_player"), ## Not a player owned center
thank youTotenkopf900 said:Search and delete/or comment this line of code
Code:(neg|party_slot_eq, ":center", slot_town_lord, "trp_player"), ## Not a player owned center
##Script change_party_name
("change_party_name",
[
(try_for_parties, ":bandit_party"),
(party_get_template_id, ":bandit_party_template", ":bandit_party"),
(is_between, ":bandit_party_template", "pt_looters", "pt_deserters"),
(store_party_size, ":num", ":bandit_party"),
(ge, ":num", 25),#if the party has more than 25 units its name will change
(eq, ":bandit_party_template", "pt_looters"),
(party_set_name, ":bandit_party", "@Scavengers"),
(else_try),
(eq, ":bandit_party_template", "pt_forest_bandits"),
(party_set_name, ":bandit_party", "@Forest Ambushers"),
(else_try),
(eq, ":bandit_party_template", "pt_mountain_bandits"),
(party_set_name, ":bandit_party", "@Highlanders"),
(else_try),
(eq, ":bandit_party_template", "pt_sea_raiders"),
(party_set_name, ":bandit_party", "@Vikings"),
(else_try),
(eq, ":bandit_party_template", "pt_desert_bandits"),
(party_set_name, ":bandit_party", "@Desert Ambushers"),
(else_try),
(eq, ":bandit_party_template", "pt_taiga_bandits"),
(party_set_name, ":bandit_party", "@Taiga Headhunters"),
(else_try),
(eq, ":bandit_party_template", "pt_steppe_bandits"),
(party_set_name, ":bandit_party", "@Steppe Raiding Party"),
(try_end),
]),
(24,
[
(call_script, "script_change_party_name"),
]),
Mordachai said:Ok, I'm posting a bit of code that is fully functional, as far as I can tell, with a fair bit of testing (been playing using it for about 2 weeks). It was originally written by Leprechaun, but of course I've extended it and modified it, and fixed bugs, and so on, so its considerably more than it was when I first came by it (great idea from Leprechaun!).
Feel free to use it, abuse it, etc. As always, Leprechaun and I should get some mention.
Features:
* New, extended Prisoner Chat
* Ability to persuade prisoners to join you directly
* Ability to set them free
* Ability to murder regular prisoners
* Ability to taunt nobles
* Ability to let nobles go, with a gain to honor and relation
* Ability to kill nobles permanently in-game.
This last feature - permanent death to an enemy noble, includes selection of a new king for a kingdom, as well as extensive repercussions for ones actions. See the comments in the code for specifics, but it aint good.
The whole succession part of the code hasn't been tested in practice. There may be a bug or two there, so use at your own risk.
Update: I just happened to capture a King, and tested the succession code by having him killed. It works properly now, as I made some minor bug fixes to the code to correct for some missing messages and the order the messages were being produced so that its easier to get a sense of what happened if you look at the Quest->Recent Messages.
Enjoy:
The following goes in your module_dialogs.py. It must precede or replace the native prisoner dialogs (if you place it after, then it will be ignored in favor of the native code).
Code:################################################################################################### # Prisoner Talk - Originally written by Leprechaun, majorly overhauled & extended by Mordachai ################################################################################################### # this is a dummy dialog - it sets up the globals we need [anyone|plyr, "prisoner_chat", [ (store_conversation_troop,"$g_talk_troop"), (store_troop_faction,"$g_talk_troop_faction","$g_talk_troop"), (store_relation, "$g_talk_troop_faction_relation", "$g_talk_troop_faction", "fac_player_faction"), (call_script, "script_troop_get_player_relation", "$g_talk_troop"), (assign, "$g_talk_troop_relation", reg0), (eq, 1, 0) ], "", "close_window", []], # the following is intended to catch when you free up space for a prisoner that already agreed to join you [anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),(troops_can_join, 1)], "All right, I have made room for you.", "prisoner_chat_accept_confirm", []], [anyone, "prisoner_chat_accept_confirm", [], "I am at your command, my {lord/lady}.", "prisoner_chat_accept3", []], # and we catch the case where you still don't have any room for a pending conscripted prisoner [anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),(neg|troops_can_join, 1)], "I am sorry, I still have no room for you. You'll have to wait a while longer.", "close_window",[]], # default entry (no prior join agreement, or they've previously refused) [anyone|plyr, "prisoner_chat", [(neg|troop_slot_eq, "$g_talk_troop", slot_troop_occupation, slto_kingdom_hero)], "You there!", "prisoner_chat_commoner", []], [anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_troop_occupation, slto_kingdom_hero),(str_store_troop_name, s1, "$g_talk_troop")], "{s1}", "prisoner_chat_lord", []], # reaction to you based on noble or low-birth [anyone, "prisoner_chat_commoner", [], "Me?! (Gulp!)", "prisoner_chat_menu",[]], [anyone, "prisoner_chat_lord", [(str_store_troop_name, s1, "trp_player")], "Yes, {Lord/Lady} {s1}?", "prisoner_chat_noble",[]], # nobles chat begin [anyone|plyr,"prisoner_chat_noble", [], "You are free to go.", "prisoner_chat_noble_prerelease",[]], [anyone|plyr,"prisoner_chat_noble", [], "You will remain my prisoner.", "prisoner_chat_noble_prekeep",[]], [anyone|plyr,"prisoner_chat_noble", [(gt, "$players_kingdom", 0)], "You have committed high treason!", "prisoner_chat_treason",[]], [anyone|plyr,"prisoner_chat_noble_prerelease", [], "Despite what you may have heard, I am a {man/woman} of honor. You are free to go.", "prisoner_chat_noble_release", []], [anyone, "prisoner_chat_noble_release", [], "I will not forget this act of Chivalry!", "close_window", [ # remove the troop from prison (call_script, "script_remove_troop_from_prison", "$g_talk_troop"), (party_remove_prisoners, "p_main_party", "$g_talk_troop", 1), # determine how much honor and faction relation change this prisoner is worth (try_begin), # king (faction_slot_eq, "$g_talk_troop_faction", slot_faction_leader, "$g_talk_troop"), (assign, ":honor", 5), (assign, ":fac_reln", 15), (else_try), # other lord (assign, ":honor", 2), (assign, ":fac_reln", 5), (try_end), # give the player their honor, faction relation, and lord relation change (call_script, "script_change_player_relation_with_troop", "$g_talk_troop", 10), (call_script, "script_change_player_honor", ":honor"), (call_script, "script_change_player_relation_with_faction", "$g_talk_troop_faction", ":fac_reln" ), ]], [anyone|plyr,"prisoner_chat_noble_prekeep", [], "You will understand if I keep you hostage until your family can afford to... compensate me for certain expenses and hardships I have endured to keep you fed and ...safe... these past weeks.", "prisoner_chat_noble_keep",[]], [anyone, "prisoner_chat_noble_keep", [(ge, "$player_honor", 10),(ge, "$g_talk_troop_relation", 0)], "Truly, this is beneath you.", "close_window",[]], [anyone, "prisoner_chat_noble_keep", [], "And I trust you will be as understanding when I hunt you down like the dog you are!", "close_window",[(call_script, "script_change_player_relation_with_troop", "$g_talk_troop", -1)]], # commoners chat begin [anyone|plyr,"prisoner_chat_menu", [], "Hmmm... perhaps you're not as stupid as the rest of those rabble.", "prisoner_chat_offer",[]], [anyone|plyr,"prisoner_chat_menu", [], "As wretched as you are, I cannot help but feel sorry for you.", "prisoner_chat_release",[]], [anyone|plyr,"prisoner_chat_menu", [], "The sight of you makes me sick! You.. Die.. Now!", "prisoner_chat_die1",[]], [anyone|plyr,"prisoner_chat_menu", [], "Get back in line, Scum!", "close_window",[]], [anyone|plyr,"prisoner_chat_release", [], "I'm feeling magnanimous today. Begone, before I change my mind!", "prisoner_chat_release2", []], [anyone, "prisoner_chat_release2", [], "Oh, thank you, {sir/madam}. Blessings on you!", "close_window", [(remove_troops_from_prisoners, "$g_talk_troop", 1),(call_script, "script_change_player_honor", 1)]], [anyone|plyr,"prisoner_chat_offer", [], "Listen, scum, you have one last chance to redeem yourself before I sell you to the slave-traders. "\ "Drop all your previous allegiances and swear fealty to me, obey my every order to the letter, and you'll be paid, fed and equipped. "\ "If you don't....well, let's just say that life as a slave will be seemingly unending years of agony, malnutrition and beatings. "\ "I'd advise you to think very, very carefully before choosing. ", "prisoner_chat_reaction", [(call_script, "script_determine_prisoner_agreed", "$g_talk_troop", "$g_talk_troop_faction_relation")]], [anyone, "prisoner_chat_reaction", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1)], "Thank you for your mercy, {sir/madam}. I swear on my mothers grave I will serve you, my {lord/lady}!","prisoner_chat_accept1",[]], [anyone, "prisoner_chat_reaction", [], "I'll show you what I think of your offer! (The prisoner spits at your feet) There. Now get lost, I'm not interested.", "prisoner_chat_refuse",[]], [anyone|plyr,"prisoner_chat_refuse", [], "I see...", "prisoner_chat_menu",[]], [anyone|plyr,"prisoner_chat_die1", [], "(You advance on the prisoner...)", "prisoner_chat_die2",[]], [anyone, "prisoner_chat_die2", [], "Please, {sir/madam}, don't kill me. I am a defenceless prisoner. Surely you're not that cruel?", "prisoner_chat_die3",[]], [anyone|plyr,"prisoner_chat_die3", [], "(Kill the prisoner)", "prisoner_chat_die4",[]], [anyone|plyr,"prisoner_chat_die3", [], "No, I will not sink that low.", "close_window",[]], [anyone|plyr,"prisoner_chat_die4", [], "(The prisoner struggles against his shackles, desperate to free himself and escape you, but to no avail. You slit their throat with a knife and watch, satisfied, as his corpse sags to the floor.)", "close_window", [(remove_troops_from_prisoners, "$g_talk_troop", 1), (call_script, "script_change_player_honor", -1)]], [anyone|plyr, "prisoner_chat_accept1", [], "If you so much as fail to tremble on my command, I will have you severely disciplined!", "prisoner_chat_accept2",[]], [anyone|plyr, "prisoner_chat_accept1", [], "In my camp we are all treated as equals. I expect your obedience, but also your trust.", "prisoner_chat_accept2",[]], [anyone, "prisoner_chat_accept2", [], "I will obey your wishes, my {lord/lady}. I swear!", "prisoner_chat_accept3",[]], [anyone|plyr, "prisoner_chat_accept3", [(neg|troops_can_join, 1)], "Oh! Apparently there isn't enough room for you in my party. I will be back when I have made space.", "close_window", []], [anyone|plyr, "prisoner_chat_accept3", [(troops_can_join, 1)], "Excellent. Report to the quartermaster for provisions and equiment. There is hard fighting ahead.", "close_window", [(troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0), (remove_troops_from_prisoners, "$g_talk_troop",1), (party_add_members, "p_main_party", "$g_talk_troop", 1), (call_script, "script_change_troop_renown", "trp_player", 1),]], [anyone|plyr, "prisoner_chat_treason", [(str_store_troop_name, s1, "$g_talk_troop"), (str_store_faction_name, s2, "$players_kingdom")], "{s1}, you have committed cimes against the {s2}, for which you will now stand trial.^How plead you?", "prisoner_chat_treason_plead", [ # determine the noble's reaction to this accusation (store_random_in_range, reg0, 1, 5),#bug: must set upper number one higher to actually generate correct range #TODO: weight the reaction according to the renown? Or at least according to king or not... (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, reg0), ] ], [anyone, "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),], "Please have mercy upon my soul. All I have done, I have done in the name of my King and Country! I am but a patriot, as you, and I deserve your respect, if nothing else.", "prisoner_chat_treason_choose", []], [anyone, "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 2),], "You are gravely mistaken! I am an honorable Lord, and I have done nothing that you would not do were our roles exchanged.", "prisoner_chat_treason_choose", []], [anyone, "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 3),], "I spit on you and yours! You are but a cur come to put on airs, as though you were Noble and had any right whatsoever to judge me! Me! You are a nothing but a common brigand and a coward! I do not bow to you. You should drop to your knees and beg *my* forgiveness!", "prisoner_chat_treason_choose", []], [anyone, "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 4),], "You dare accuse me?! You sniveling whelpling! I should see you flogged and put in chains in one of my prisons for your insolence!", "prisoner_chat_treason_choose", []], [anyone|plyr, "prisoner_chat_treason_choose", [], "I am a {man/woman} of honor. I shall spare your life this day!", "prisoner_chat_treason_not_guilty", [ #TODO: have the relation with the prison have a mixed (random) result - relief, anger, etc, which dictates their final monologue to the player before exiting the dialog # make sure we don't try to recruit this prisoner later! (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0), ] ], [anyone, "prisoner_chat_treason_not_guilty", [(str_store_troop_name, s1, "trp_player")], "There is yet hope for you, {s1}.", "close_window", []], [anyone|plyr, "prisoner_chat_treason_choose", [], "You do not deserve leiniency. You must pay for your crimes with your life.", "prisoner_chat_treason_guilty", []], [anyone|plyr, "prisoner_chat_treason_guilty", [], "For your many crimes against {s1}, I hereby sentence you to death, to be carried out immediately. Have you any final words to say?", "prisoner_chat_treason_final_words", [(store_random_in_range, reg0, 1, 6), (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, reg0)]], [anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1)], "I believe you will one day come to regret your actions. There is only one who is worthy to decide another's fate... and that one is not you.", "prisoner_chat_treason_execute", []], [anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 2)], "You are a coward and a dog! May your soul rot eternal, damn you!", "prisoner_chat_treason_execute", []], [anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 3)], "Winter's mortality,^locked in frozen indifference,^melts with Spring's rebirth.", "prisoner_chat_treason_execute", []], [anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 4)], "You will find no peace on this earth! I shall haunt thee eternal! Unto death you will find nothing but unhappiness and fear. And beyond... only torture and pain!", "prisoner_chat_treason_execute", []], [anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 5)], "Who are you?^A day passes^We are but children", "prisoner_chat_treason_execute", []], [anyone|plyr, "prisoner_chat_treason_execute", [], "(The prisoner struggles against his shackles, desperate to free himself and escape you, but to no avail. You slit his throat and watch, satisfied, as his corpse sags to the floor.)", "close_window", [ # attempt to allow the player to see the consequences of their actions #(set_show_messages, 1), # this not only fails - but messages are hereafter disabled in the main game... # make sure we don't try to recruit this prisoner stack later! (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0), # "kill" the NPC - force the 48 hr respawn kingdom heros trigger to ignore this troop (no party will be created for this troop, ever again) # [q.v. script_create_kingdom_hero_party] (troop_set_slot, "$g_talk_troop", slot_troop_occupation, slto_dead), # remove them from their faction (troop_set_slot, "$g_talk_troop", slot_troop_change_to_faction, "fac_no_faction"), (troop_set_slot, "$g_talk_troop", slot_troop_original_faction, "fac_no_faction"), # determine the penalty for this act (based on the honor of the troop they've killed) (troop_get_slot, ":impact", "$g_talk_troop", slot_troop_renown), (val_div, ":impact", -33), (store_div, ":half", ":impact", 2), # reduce the player's relationship with every village, town, and castle (try_for_range, ":center", centers_begin, centers_end), (store_faction_of_party, ":faction", ":center"), (store_relation, ":relation", ":faction", "$g_talk_troop_faction"), (try_begin), (le, ":relation", -10), # enemies, half impact (call_script, "script_change_player_relation_with_center", ":center", ":half"), (else_try), # not at war, full impact (call_script, "script_change_player_relation_with_center", ":center", ":impact"), (try_end), (try_end), # reduce the player's relationship with every hero, companion, lady, and daughter (try_for_range, ":troop", trp_npc1, trp_heroes_end), # don't make the dead any angrier than they already are! (neg|troop_slot_eq, ":troop", slot_troop_occupation, slto_dead), (store_troop_faction, ":faction", ":troop"), (store_relation, ":relation", ":faction", "$g_talk_troop_faction"), (try_begin), (le, ":relation", -10), # enemies, half impact (call_script, "script_change_player_relation_with_troop", ":troop", ":half"), (else_try), # not at war, full impact (call_script, "script_change_player_relation_with_troop", ":troop", ":impact"), (try_end), (try_end), # reduce the player's relationship with every faction (enemies 1/2 as much) (try_for_range, ":faction", kingdoms_begin, kingdoms_end), (store_relation, ":relation", ":faction", "$g_talk_troop_faction"), (try_begin), (le, ":relation", -10), # enemies, half impact (call_script, "script_change_player_relation_with_faction", ":faction", ":half"), (else_try), # not at war, full impact (call_script, "script_change_player_relation_with_faction", ":faction", ":impact"), (try_end), (try_end), # apply the honor hit (call_script, "script_change_player_honor", ":impact"), # party morale takes a hit as well (call_script, "script_change_player_party_morale", ":half"), # but give them renown for this evil deed (their deed spreads upon every tongue, impressing some, and cowing others) (val_mul, ":impact", -1), (call_script, "script_change_troop_renown", "trp_player" , ":impact"), # start with the assumption that the fief should return to its faction for redistribution (assign, ":fief_faction", "$g_talk_troop_faction"), (try_begin), # handle executing the King! (faction_slot_eq, "$g_talk_troop_faction", slot_faction_leader, "$g_talk_troop"), # find best candidate to become king (assign, ":best_troop", -1), (assign, ":best_renown", -1), (try_for_range, ":troop", kingdom_heroes_begin, kingdom_heroes_end), (neg|troop_slot_eq, ":troop", slot_troop_occupation, slto_dead), #can't choose a dead hero! (store_troop_faction, ":faction", ":troop"), (eq, ":faction", "$g_talk_troop_faction"), (troop_slot_eq, ":troop", slot_troop_occupation, slto_kingdom_hero), #only other heros of this faction may become the king (troop_get_slot, ":renown", ":troop", slot_troop_renown), (gt, ":renown", ":best_renown"), (assign, ":best_troop", ":troop"), (assign, ":best_renown", ":renown"), (try_end), (try_begin), # check if a candidate was found (neq, ":best_troop", -1), # make them king (faction_set_slot, "$g_talk_troop_faction", slot_faction_leader, ":best_troop"), # announce it! #TODO: generate a presentation for this! (start_presentation, "prsnt_enemy_succession"), (str_store_troop_name, s1, ":best_troop"), (str_store_faction_name, s2, "$g_talk_troop_faction"), (display_message, "@{s1} is the new King of the {s2}!!!", 0xFFFF2222), #TODO: update the game log for this event (else_try), # all of the lords have been eliminated - so eliminate the faction by making their last fief neutral (q.v. trigger: # Check if a faction is defeated every day) (assign, ":fief_faction", "fac_no_faction"), (try_end), (try_end), # free up the deceased's fief (try_for_range, ":fief", centers_begin, centers_end), (party_get_slot, ":lord", ":fief", slot_town_lord), (eq, ":lord", "$g_talk_troop"), (call_script, "script_give_center_to_faction", ":fief", ":fief_faction"), (try_end), # no longer our prisoner (call_script, "script_remove_troop_from_prison", "$g_talk_troop"), (remove_troops_from_prisoners, "$g_talk_troop", 1), ] ], ################################################################################################### # End Prisoner Talk ###################################################################################################
Please note that slto_dead is not a native symbol - if you want to use the above you'll also need to add slto_dead = 86 in your module_constants.py.
Please note that slot_prisoner_agreed is not a native symbol - simply add slot_prisoner_agreed = 142 to your module_constants.py. Actually, 142 is arbitrary - any unused slot will do.
Additionally, you'll need to add this script to module_scripts.py - I added it towards the end, as the last script in the file, but you're welcome to place it anywhere within the list of scripts within that file:
Code:#MORDACHAI - update whether the specified prisoner would like to join the player's party # script_determine_prisoner_agreed # Input: arg1 = troop, arg2 = troop faction relation # Output: slot_prisoner_agreed is set to 1 if they agreed, or 0 if not # reg0 = agreed or not ("determine_prisoner_agreed", [ (store_script_param, ":troop", 1), (store_script_param, ":relation", 2), # upper bound = Persuasion*3 + Charisma + Leadership*3 + Honor/2 + Renown/100 (store_attribute_level, ":charisma", "trp_player", ca_charisma), (store_skill_level, ":persuasion", "skl_persuasion", "trp_player"), (store_skill_level, ":leadership", "skl_leadership", "trp_player"), (val_mul, ":persuasion", 3), (val_mul, ":leadership", 3), (store_div, ":half_honor", "$player_honor", 2), (troop_get_slot, ":renown_factor", slot_troop_renown), (val_div, ":renown_factor", 100), (assign, ":upper_bound", ":persuasion"), (val_add, ":upper_bound", ":leadership"), (val_add, ":upper_bound", ":charisma"), (val_add, ":upper_bound", ":half_honor"), (val_add, ":upper_bound", ":renown_factor"), (val_min, ":relation", ":upper_bound"), # determine their reaction (relation...upper_bound) (store_random_in_range, ":reaction", ":relation", ":upper_bound"), (assign, reg1, ":reaction"), (assign, reg2, ":relation"), (assign, reg3, ":upper_bound"), #(display_message, "@Prisoner Agrees Check: rolled a {reg1} out of a possible {reg2}-{reg3}"),#diagnostic only # record whether they agree or not (try_begin), (ge, ":reaction", 0), (troop_set_slot, ":troop", slot_prisoner_agreed, 1), (else_try), (troop_set_slot, ":troop", slot_prisoner_agreed, 0), (try_end), # return the results (troop_get_slot, reg0, ":troop", slot_prisoner_agreed), #(display_message, "@Prisoner Agrees Check: slot_prisoner_agreed = {reg0?yes:no}"),#diagnostic only ] ),
No I didn't i'm going to try that now,thank youTotenkopf900 said:did you replace the entire prisoner dialog as asked? I just found out that dialog placement is important for things to work properly.
Its working but for some reason i'm getting duplicate texts.Totenkopf900 said:did you replace the entire prisoner dialog as asked? I just found out that dialog placement is important for things to work properly.
[anyone|plyr,"prisoner_chat", [], "Do not try running away or trying something stupid. I will be watching you.", "prisoner_chat_2",[]],
[anyone,"prisoner_chat_2", [], "No, I swear I won't.", "close_window",[]],
That's what I replaced i mean in game during dialog i'm getting duplicate dialog texts.Totenkopf900 said:What do you mean by duplicate text? The code you should be replacing looks like this
Code:[anyone|plyr,"prisoner_chat", [], "Do not try running away or trying something stupid. I will be watching you.", "prisoner_chat_2",[]], [anyone,"prisoner_chat_2", [], "No, I swear I won't.", "close_window",[]],
here you go good sir lolTotenkopf900 said:That is weird, care to post the code and a screenshot?
###################################################################################################
# Prisoner Talk - Originally written by Leprechaun, majorly overhauled & extended by Mordachai
###################################################################################################
# this is a dummy dialog - it sets up the globals we need
[anyone|plyr, "prisoner_chat", [
(store_conversation_troop,"$g_talk_troop"),
(store_troop_faction,"$g_talk_troop_faction","$g_talk_troop"),
(store_relation, "$g_talk_troop_faction_relation", "$g_talk_troop_faction", "fac_player_faction"),
(call_script, "script_troop_get_player_relation", "$g_talk_troop"),
(assign, "$g_talk_troop_relation", reg0),
(eq, 1, 0)
], "", "close_window", []],
# the following is intended to catch when you free up space for a prisoner that already agreed to join you
[anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),(troops_can_join, 1)], "All right, I have made room for you.", "prisoner_chat_accept_confirm", []],
[anyone, "prisoner_chat_accept_confirm", [], "I am at your command, my {lord/lady}.", "prisoner_chat_accept3", []],
# and we catch the case where you still don't have any room for a pending conscripted prisoner
[anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),(neg|troops_can_join, 1)], "I am sorry, I still have no room for you. You'll have to wait a while longer.", "close_window",[]],
# default entry (no prior join agreement, or they've previously refused)
[anyone|plyr, "prisoner_chat", [(neg|troop_slot_eq, "$g_talk_troop", slot_troop_occupation, slto_kingdom_hero)], "You there!", "prisoner_chat_commoner", []],
[anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_troop_occupation, slto_kingdom_hero),(str_store_troop_name, s1, "$g_talk_troop")], "{s1}", "prisoner_chat_lord", []],
# reaction to you based on noble or low-birth
[anyone, "prisoner_chat_commoner", [], "Me?! (Gulp!)", "prisoner_chat_menu",[]],
[anyone, "prisoner_chat_lord", [(str_store_troop_name, s1, "trp_player")], "Yes, {Lord/Lady} {s1}?", "prisoner_chat_noble",[]],
# nobles chat begin
[anyone|plyr,"prisoner_chat_noble", [], "You are free to go.", "prisoner_chat_noble_prerelease",[]],
[anyone|plyr,"prisoner_chat_noble", [], "You will remain my prisoner.", "prisoner_chat_noble_prekeep",[]],
[anyone|plyr,"prisoner_chat_noble", [(gt, "$players_kingdom", 0)], "You have committed high treason!", "prisoner_chat_treason",[]],
[anyone|plyr,"prisoner_chat_noble_prerelease", [], "Despite what you may have heard, I am a {man/woman} of honor. You are free to go.", "prisoner_chat_noble_release", []],
[anyone, "prisoner_chat_noble_release", [], "I will not forget this act of Chivalry!", "close_window",
[
# remove the troop from prison
(call_script, "script_remove_troop_from_prison", "$g_talk_troop"),
(party_remove_prisoners, "p_main_party", "$g_talk_troop", 1),
# determine how much honor and faction relation change this prisoner is worth
(try_begin),
# king
(faction_slot_eq, "$g_talk_troop_faction", slot_faction_leader, "$g_talk_troop"),
(assign, ":honor", 5),
(assign, ":fac_reln", 15),
(else_try),
# other lord
(assign, ":honor", 2),
(assign, ":fac_reln", 5),
(try_end),
# give the player their honor, faction relation, and lord relation change
(call_script, "script_change_player_relation_with_troop", "$g_talk_troop", 10),
(call_script, "script_change_player_honor", ":honor"),
(call_script, "script_change_player_relation_with_faction", "$g_talk_troop_faction", ":fac_reln" ),
]],
[anyone|plyr,"prisoner_chat_noble_prekeep", [], "You will understand if I keep you hostage until your family can afford to... compensate me for certain expenses and hardships I have endured to keep you fed and ...safe... these past weeks.", "prisoner_chat_noble_keep",[]],
[anyone, "prisoner_chat_noble_keep", [(ge, "$player_honor", 10),(ge, "$g_talk_troop_relation", 0)], "Truly, this is beneath you.", "close_window",[]],
[anyone, "prisoner_chat_noble_keep", [], "And I trust you will be as understanding when I hunt you down like the dog you are!", "close_window",[(call_script, "script_change_player_relation_with_troop", "$g_talk_troop", -1)]],
# commoners chat begin
[anyone|plyr,"prisoner_chat_menu", [], "Hmmm... perhaps you're not as stupid as the rest of those rabble.", "prisoner_chat_offer",[]],
[anyone|plyr,"prisoner_chat_menu", [], "As wretched as you are, I cannot help but feel sorry for you.", "prisoner_chat_release",[]],
[anyone|plyr,"prisoner_chat_menu", [], "The sight of you makes me sick! You.. Die.. Now!", "prisoner_chat_die1",[]],
[anyone|plyr,"prisoner_chat_menu", [], "Get back in line, Scum!", "close_window",[]],
[anyone|plyr,"prisoner_chat_release", [], "I'm feeling magnanimous today. Begone, before I change my mind!", "prisoner_chat_release2", []],
[anyone, "prisoner_chat_release2", [], "Oh, thank you, {sir/madam}. Blessings on you!", "close_window",
[(remove_troops_from_prisoners, "$g_talk_troop", 1),(call_script, "script_change_player_honor", 1)]],
[anyone|plyr,"prisoner_chat_offer", [], "Listen, scum, you have one last chance to redeem yourself before I sell you to the slave-traders. "\
"Drop all your previous allegiances and swear fealty to me, obey my every order to the letter, and you'll be paid, fed and equipped. "\
"If you don't....well, let's just say that life as a slave will be seemingly unending years of agony, malnutrition and beatings. "\
"I'd advise you to think very, very carefully before choosing. ", "prisoner_chat_reaction",
[(call_script, "script_determine_prisoner_agreed", "$g_talk_troop", "$g_talk_troop_faction_relation")]],
[anyone, "prisoner_chat_reaction", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1)], "Thank you for your mercy, {sir/madam}. I swear on my mothers grave I will serve you, my {lord/lady}!","prisoner_chat_accept1",[]],
[anyone, "prisoner_chat_reaction", [], "I'll show you what I think of your offer! (The prisoner spits at your feet) There. Now get lost, I'm not interested.", "prisoner_chat_refuse",[]],
[anyone|plyr,"prisoner_chat_refuse", [], "I see...", "prisoner_chat_menu",[]],
[anyone|plyr,"prisoner_chat_die1", [], "(You advance on the prisoner...)", "prisoner_chat_die2",[]],
[anyone, "prisoner_chat_die2", [], "Please, {sir/madam}, don't kill me. I am a defenceless prisoner. Surely you're not that cruel?", "prisoner_chat_die3",[]],
[anyone|plyr,"prisoner_chat_die3", [], "(Kill the prisoner)", "prisoner_chat_die4",[]],
[anyone|plyr,"prisoner_chat_die3", [], "No, I will not sink that low.", "close_window",[]],
[anyone|plyr,"prisoner_chat_die4", [], "(The prisoner struggles against his shackles, desperate to free himself and escape you, but to no avail. You slit their throat with a knife and watch, satisfied, as his corpse sags to the floor.)", "close_window",
[(remove_troops_from_prisoners, "$g_talk_troop", 1),
(call_script, "script_change_player_honor", -1)]],
[anyone|plyr, "prisoner_chat_accept1", [], "If you so much as fail to tremble on my command, I will have you severely disciplined!", "prisoner_chat_accept2",[]],
[anyone|plyr, "prisoner_chat_accept1", [], "In my camp we are all treated as equals. I expect your obedience, but also your trust.", "prisoner_chat_accept2",[]],
[anyone, "prisoner_chat_accept2", [], "I will obey your wishes, my {lord/lady}. I swear!", "prisoner_chat_accept3",[]],
[anyone|plyr, "prisoner_chat_accept3", [(neg|troops_can_join, 1)], "Oh! Apparently there isn't enough room for you in my party. I will be back when I have made space.", "close_window", []],
[anyone|plyr, "prisoner_chat_accept3", [(troops_can_join, 1)], "Excellent. Report to the quartermaster for provisions and equiment. There is hard fighting ahead.", "close_window",
[(troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0),
(remove_troops_from_prisoners, "$g_talk_troop",1),
(party_add_members, "p_main_party", "$g_talk_troop", 1),
(call_script, "script_change_troop_renown", "trp_player", 1),]],
[anyone|plyr, "prisoner_chat_treason", [(str_store_troop_name, s1, "$g_talk_troop"), (str_store_faction_name, s2, "$players_kingdom")],
"{s1}, you have committed cimes against the {s2}, for which you will now stand trial.^How plead you?", "prisoner_chat_treason_plead",
[
# determine the noble's reaction to this accusation
(store_random_in_range, reg0, 1, 5),#bug: must set upper number one higher to actually generate correct range
#TODO: weight the reaction according to the renown? Or at least according to king or not...
(troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, reg0),
]
],
[anyone, "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),],
"Please have mercy upon my soul. All I have done, I have done in the name of my King and Country! I am but a patriot, as you, and I deserve your respect, if nothing else.", "prisoner_chat_treason_choose", []],
[anyone, "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 2),],
"You are gravely mistaken! I am an honorable Lord, and I have done nothing that you would not do were our roles exchanged.", "prisoner_chat_treason_choose", []],
[anyone, "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 3),],
"I spit on you and yours! You are but a cur come to put on airs, as though you were Noble and had any right whatsoever to judge me! Me! You are a nothing but a common brigand and a coward! I do not bow to you. You should drop to your knees and beg *my* forgiveness!", "prisoner_chat_treason_choose", []],
[anyone, "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 4),],
"You dare accuse me?! You sniveling whelpling! I should see you flogged and put in chains in one of my prisons for your insolence!", "prisoner_chat_treason_choose", []],
[anyone|plyr, "prisoner_chat_treason_choose", [], "I am a {man/woman} of honor. I shall spare your life this day!", "prisoner_chat_treason_not_guilty",
[
#TODO: have the relation with the prison have a mixed (random) result - relief, anger, etc, which dictates their final monologue to the player before exiting the dialog
# make sure we don't try to recruit this prisoner later!
(troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0),
]
],
[anyone, "prisoner_chat_treason_not_guilty", [(str_store_troop_name, s1, "trp_player")], "There is yet hope for you, {s1}.", "close_window", []],
[anyone|plyr, "prisoner_chat_treason_choose", [], "You do not deserve leiniency. You must pay for your crimes with your life.", "prisoner_chat_treason_guilty", []],
[anyone|plyr, "prisoner_chat_treason_guilty", [], "For your many crimes against {s1}, I hereby sentence you to death, to be carried out immediately. Have you any final words to say?", "prisoner_chat_treason_final_words",
[(store_random_in_range, reg0, 1, 6), (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, reg0)]],
[anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1)], "I believe you will one day come to regret your actions. There is only one who is worthy to decide another's fate... and that one is not you.", "prisoner_chat_treason_execute", []],
[anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 2)], "You are a coward and a dog! May your soul rot eternal, damn you!", "prisoner_chat_treason_execute", []],
[anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 3)], "Winter's mortality,^locked in frozen indifference,^melts with Spring's rebirth.", "prisoner_chat_treason_execute", []],
[anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 4)], "You will find no peace on this earth! I shall haunt thee eternal! Unto death you will find nothing but unhappiness and fear. And beyond... only torture and pain!", "prisoner_chat_treason_execute", []],
[anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 5)], "Who are you?^A day passes^We are but children", "prisoner_chat_treason_execute", []],
[anyone|plyr, "prisoner_chat_treason_execute", [],
"(The prisoner struggles against his shackles, desperate to free himself and escape you, but to no avail. You slit his throat and watch, satisfied, as his corpse sags to the floor.)",
"close_window",
[
# attempt to allow the player to see the consequences of their actions
#(set_show_messages, 1), # this not only fails - but messages are hereafter disabled in the main game...
# make sure we don't try to recruit this prisoner stack later!
(troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0),
# "kill" the NPC - force the 48 hr respawn kingdom heros trigger to ignore this troop (no party will be created for this troop, ever again)
# [q.v. script_create_kingdom_hero_party]
(troop_set_slot, "$g_talk_troop", slot_troop_occupation, slto_dead),
# remove them from their faction
(troop_set_slot, "$g_talk_troop", slot_troop_change_to_faction, "fac_no_faction"),
(troop_set_slot, "$g_talk_troop", slot_troop_original_faction, "fac_no_faction"),
# determine the penalty for this act (based on the honor of the troop they've killed)
(troop_get_slot, ":impact", "$g_talk_troop", slot_troop_renown),
(val_div, ":impact", -33),
(store_div, ":half", ":impact", 2),
# reduce the player's relationship with every village, town, and castle
(try_for_range, ":center", centers_begin, centers_end),
(store_faction_of_party, ":faction", ":center"),
(store_relation, ":relation", ":faction", "$g_talk_troop_faction"),
(try_begin),
(le, ":relation", -10),
# enemies, half impact
(call_script, "script_change_player_relation_with_center", ":center", ":half"),
(else_try),
# not at war, full impact
(call_script, "script_change_player_relation_with_center", ":center", ":impact"),
(try_end),
(try_end),
# reduce the player's relationship with every hero, companion, lady, and daughter
(try_for_range, ":troop", trp_npc1, trp_heroes_end),
# don't make the dead any angrier than they already are!
(neg|troop_slot_eq, ":troop", slot_troop_occupation, slto_dead),
(store_troop_faction, ":faction", ":troop"),
(store_relation, ":relation", ":faction", "$g_talk_troop_faction"),
(try_begin),
(le, ":relation", -10),
# enemies, half impact
(call_script, "script_change_player_relation_with_troop", ":troop", ":half"),
(else_try),
# not at war, full impact
(call_script, "script_change_player_relation_with_troop", ":troop", ":impact"),
(try_end),
(try_end),
# reduce the player's relationship with every faction (enemies 1/2 as much)
(try_for_range, ":faction", kingdoms_begin, kingdoms_end),
(store_relation, ":relation", ":faction", "$g_talk_troop_faction"),
(try_begin),
(le, ":relation", -10),
# enemies, half impact
(call_script, "script_change_player_relation_with_faction", ":faction", ":half"),
(else_try),
# not at war, full impact
(call_script, "script_change_player_relation_with_faction", ":faction", ":impact"),
(try_end),
(try_end),
# apply the honor hit
(call_script, "script_change_player_honor", ":impact"),
# party morale takes a hit as well
(call_script, "script_change_player_party_morale", ":half"),
# but give them renown for this evil deed (their deed spreads upon every tongue, impressing some, and cowing others)
(val_mul, ":impact", -1),
(call_script, "script_change_troop_renown", "trp_player" , ":impact"),
# start with the assumption that the fief should return to its faction for redistribution
(assign, ":fief_faction", "$g_talk_troop_faction"),
(try_begin),
# handle executing the King!
(faction_slot_eq, "$g_talk_troop_faction", slot_faction_leader, "$g_talk_troop"),
# find best candidate to become king
(assign, ":best_troop", -1),
(assign, ":best_renown", -1),
(try_for_range, ":troop", kingdom_heroes_begin, kingdom_heroes_end),
(neg|troop_slot_eq, ":troop", slot_troop_occupation, slto_dead), #can't choose a dead hero!
(store_troop_faction, ":faction", ":troop"),
(eq, ":faction", "$g_talk_troop_faction"),
(troop_slot_eq, ":troop", slot_troop_occupation, slto_kingdom_hero), #only other heros of this faction may become the king
(troop_get_slot, ":renown", ":troop", slot_troop_renown),
(gt, ":renown", ":best_renown"),
(assign, ":best_troop", ":troop"),
(assign, ":best_renown", ":renown"),
(try_end),
(try_begin),
# check if a candidate was found
(neq, ":best_troop", -1),
# make them king
(faction_set_slot, "$g_talk_troop_faction", slot_faction_leader, ":best_troop"),
# announce it!
#TODO: generate a presentation for this! (start_presentation, "prsnt_enemy_succession"),
(str_store_troop_name, s1, ":best_troop"),
(str_store_faction_name, s2, "$g_talk_troop_faction"),
(display_message, "@{s1} is the new King of the {s2}!!!", 0xFFFF2222),
#TODO: update the game log for this event
(else_try),
# all of the lords have been eliminated - so eliminate the faction by making their last fief neutral (q.v. trigger: # Check if a faction is defeated every day)
(assign, ":fief_faction", "fac_no_faction"),
(try_end),
(try_end),
# free up the deceased's fief
(try_for_range, ":fief", centers_begin, centers_end),
(party_get_slot, ":lord", ":fief", slot_town_lord),
(eq, ":lord", "$g_talk_troop"),
(call_script, "script_give_center_to_faction", ":fief", ":fief_faction"),
(try_end),
# no longer our prisoner
(call_script, "script_remove_troop_from_prison", "$g_talk_troop"),
(remove_troops_from_prisoners, "$g_talk_troop", 1),
]
],
###################################################################################################
# End Prisoner Talk
###################################################################################################
##################### Supa's Dual Wielding Throw #######################
# USAGE: Please only declare inside ti_on_weapon_attack! Although you might end up with a funny endless chain of throws if declared on ti_on_missile_hit. I haven't tried this particular case, but it /feels/ right.
# INPUT: arg1 = offhand itm_name, arg2 = thrown itm_name
# OUTPUT: none
("cf_fate_double_throw", [
(set_fixed_point_multiplier, 100),
(store_trigger_param_1, ":agent_no"), # info from ti_on_weapon_attack, determines throwing agent
(store_script_param_1, ":itm_shield"), # declared user parameter 1, off-hand weapon that enables the agent to double throw
(store_script_param_2, ":itm_thrown"), # declared user parameter 2, thrown version of the off-hand weapon
(agent_get_ammo, ":ammo", ":agent_no", 1), # counts ammo in active ranged weapon, in this case, the right hand's throwing weapon
(agent_get_wielded_item, ":right", ":agent_no", 0), # gets the name of the right hand weapon
(agent_get_wielded_item, ":left", ":agent_no", 1), # gets the name of the left hand weapon
(item_get_missile_speed, ":missile_speed", ":right"), # checks missile speed of right hand weapon
(gt, ":ammo", 1), # checks that agent has ammo to throw two weapons
(eq, ":left", ":itm_shield"), # checks if left hand weapon is declared weapon in parameter 2
(agent_get_look_position, pos1, ":agent_no"), # checks agents aim
(position_move_y, pos1, 130, 0), # adjust missile spawn point to ~roughly~ hand height
(position_move_x, pos1, -40, 0), # adjust missile spawn point to ~roughly~ left hand
(position_move_z, pos1, 170, 0), # I genuinely forget why this one is here.
(val_mul, ":missile_speed", 100), # converts missile speed to something useable by add_missile
(add_missile, ":agent_no", pos1, ":missile_speed", ":itm_thrown", 0, ":itm_thrown", 0), # finally commits the left hand throw
(val_sub, ":ammo", 1), # takes 1 from ammo count
(try_begin),
(le, ":ammo", 1), # If we only have 1 or less ammo left
(agent_unequip_item, ":agent_no", ":itm_shield"), # get rid of the item
(try_end),
(agent_set_ammo, ":agent_no", ":right", ":ammo"), # adjusts ammo count to take double throw into account
]
),
## Place within the right hand throwing weapon ##
[(ti_on_weapon_attack, [
(call_script, "script_cf_fate_double_throw", "itm_shield_version", "itm_thrown_version"),
]),]
It's due to the changing fixed point multiplier during the mission.SupaNinjaMan said:Known Issues:
Occasionally, when fighting in certain random battles, your add_missile weapon will fly in slow motion. I do not know what might cause this, but I personally find it hilarious.
The arc on the add_missile weapon is always a touch shallower, no matter the missile_speed. I also do not know how to modify this.
# script_whos_in_the_hall
# Who's in the hall? +Dj_FRedy
# INPUT: center
# OUTPUT:
# reg0 = num_total_in_hall
# reg1 = num_lords
# reg2 = num_ladies
# reg3 = num_heroes
# reg4 = num_pretenders
# string s16
# It shows only the Nobles, omitting the rest and including the pretenders
# who are currently in the hall of the castle. It also shows the heroes/companions who visit the tavern.
("whos_in_the_hall",
[
(store_script_param_1, ":center_no"),
(store_faction_of_party, ":center_faction", ":center_no"),
(try_for_range, ":troop_no", heroes_begin, heroes_end),
(troop_set_slot, ":troop_no", slot_troop_temp_slot, 0),
(try_end),
(str_clear, s16),
(assign, ":num_ladies", 0),
(assign, ":num_heroes", 0),
(assign, ":num_pretenders", 0),
(assign, ":num_lords", 0),
(try_for_range, ":troop_no", heroes_begin, heroes_end),
(troop_slot_eq, ":troop_no", slot_troop_temp_slot, 0),
(troop_get_slot, ":center_id", ":troop_no", slot_troop_cur_center),
(try_begin),
(eq, ":center_id", ":center_no"),
(is_between, ":center_id", centers_begin, centers_end),
(try_begin), #ladies
(is_between, ":troop_no", kingdom_ladies_begin, kingdom_ladies_end),
(troop_slot_eq, ":troop_no", slot_troop_cur_center, ":center_no"),
(assign, ":lady_meets_visitors", 0),
(try_begin), #is present at the center and in place of honor
(this_or_next|troop_slot_eq, "trp_player", slot_troop_spouse, ":troop_no"),
(this_or_next|troop_slot_eq, "trp_player", slot_troop_betrothed, ":troop_no"),
(this_or_next|troop_slot_eq, ":troop_no", slot_troop_spouse, "trp_player"),
(troop_slot_eq, ":troop_no", slot_troop_betrothed, "trp_player"),
(assign, ":lady_meets_visitors", 0),
(else_try), #is present at the center as a refugee
(store_troop_faction, ":lady_faction", ":troop_no"), #lady is troop
(neq, ":lady_faction", ":center_faction"),
(assign, ":lady_meets_visitors", 1),
(else_try),
(troop_slot_ge, ":troop_no", slot_troop_spouse, 1),
(try_begin), #is present at the center and not attending the feast
(faction_slot_eq, ":center_faction", slot_faction_ai_state, sfai_feast),
(faction_slot_eq, ":center_faction", slot_faction_ai_object, ":center_no"),
(assign, ":lady_meets_visitors", 0),
(else_try), #is present at the center and is married
(assign, ":lady_meets_visitors", 1),
(try_end),
(else_try), #is present at the center and is attending the feast
(faction_slot_eq, ":center_faction", slot_faction_ai_state, sfai_feast), #feast is in progress
(faction_slot_eq, ":center_faction", slot_faction_ai_object, ":center_no"),
(assign, ":lady_meets_visitors", 1),
(else_try), #is present at the center and is awaiting the player in private
(troop_slot_ge, ":troop_no", slot_troop_met, 2), #already met - awaits in private
(assign, ":lady_meets_visitors", 0),
(else_try), #is present at the center and is allowed to meet the player
(call_script, "script_get_kingdom_lady_social_determinants", ":troop_no"),
(call_script, "script_npc_decision_checklist_male_guardian_assess_suitor", reg0, "trp_player"),
(gt, reg0, 0),
(assign, ":lady_meets_visitors", 1),
(else_try), #is present at the center and is not allowed to meet the player
(assign, ":lady_meets_visitors", 0),
(try_end),
(try_begin),
(eq, ":lady_meets_visitors", 1),
(str_store_troop_name, s22, ":troop_no"),
(try_begin),
(eq, ":num_ladies", 0),
(str_store_troop_name, s19, ":troop_no"),
(else_try),
(eq, ":num_ladies", 1),
(str_store_troop_name, s22, ":troop_no"),
(str_store_string, s19, "str_s22_and_s19"),
(else_try),
(str_store_troop_name, s22, ":troop_no"),
(str_store_string, s19, "str_s22_coma_s19"),
(try_end),
(val_add, ":num_ladies", 1),
(try_end),
(else_try), #heroes
(is_between, ":troop_no", companions_begin, companions_end),
(troop_slot_eq, ":troop_no", slot_troop_cur_center, ":center_no"),
(str_store_troop_name, s23, ":troop_no"),
(try_begin),
(eq, ":num_heroes", 0),
(str_store_troop_name, s20, ":troop_no"),
(else_try),
(eq, ":num_heroes", 1),
(str_store_troop_name, s23, ":troop_no"),
(str_store_string, s20, "str_s23_and_s20"),
(else_try),
(str_store_troop_name, s23, ":troop_no"),
(str_store_string, s20, "str_s23_coma_s20"),
(try_end),
(val_add, ":num_heroes", 1),
(else_try), #pretenders
(is_between, ":troop_no", pretenders_begin, pretenders_end),
(troop_slot_eq, ":troop_no", slot_troop_cur_center, ":center_no"),
(str_store_troop_name, s24, ":troop_no"),
(try_begin),
(eq, ":num_pretenders", 0),
(str_store_troop_name, s21, ":troop_no"),
(else_try),
(eq, ":num_pretenders", 1),
(str_store_troop_name, s24, ":troop_no"),
(str_store_string, s21, "str_s24_and_s21"),
(else_try),
(str_store_troop_name, s24, ":troop_no"),
(str_store_string, s21, "str_s24_coma_s21"),
(try_end),
(val_add, ":num_pretenders", 1),
(try_end),
(else_try), #lords
(troop_get_slot, ":party_no", ":troop_no", slot_troop_leaded_party),
(party_is_active, ":party_no"),
(assign, ":attached_party_no", -1),
(try_begin),
(gt, ":party_no", 0),
(party_get_attached_to, ":attached_party_no", ":party_no"),
(try_end),
(assign, ":center_id", ":attached_party_no"),
(try_begin),
(eq, ":center_id", ":center_no"),
(is_between, ":center_id", centers_begin, centers_end),
(is_between, ":troop_no", kings_begin, lords_end),
(str_store_troop_name, s17, ":troop_no"),
(try_begin),
(eq, ":num_lords", 0),
(str_store_troop_name, s18, ":troop_no"),
(else_try),
(eq, ":num_lords", 1),
(str_store_troop_name, s17, ":troop_no"),
(str_store_string, s18, "str_s17_and_s18"),
(else_try),
(str_store_troop_name, s17, ":troop_no"),
(str_store_string, s18, "str_s17_coma_s18"),
(try_end),
(val_add, ":num_lords", 1),
(try_end),
(try_end),
(troop_set_slot, ":troop_no", slot_troop_temp_slot, 1),
(try_end),
(store_add, ":num_total_in_hall", ":num_ladies", ":num_lords"),
(val_add, ":num_total_in_hall", ":num_pretenders"),
(assign, reg0, ":num_total_in_hall"),
(assign, reg1, ":num_lords"),
(assign, reg2, ":num_ladies"),
(assign, reg3, ":num_heroes"),
(assign, reg4, ":num_pretenders"),
(str_store_string, s16, "str_nobles_at_hall"),
]
),
#Who's in the hall? {s16} + Dj_FRedy
(call_script, "script_whos_in_the_hall", "$current_town"),
#Who's in the hall? - Dj_FRedy
#Who's in the hall?
("s22_and_s19", "{s22} and {s19}"),
("s22_coma_s19", "{s22}, {s19}"),
("s23_and_s20", "{s23} and {s20}"),
("s23_coma_s20", "{s23}, {s20}"),
("s24_and_s21", "{s24} and {s21}"),
("s24_coma_s21", "{s24}, {s21}"),
("s17_and_s18", "{s17} and {s18}"),
("s17_coma_s18", "{s17}, {s18}"),
("nobles_at_hall", "{reg0?Nobles at hall {reg0}.{reg1? Lords {reg1} ({s18}).:} {reg2?Ladies {reg2} ({s19}).:}:}{reg4? pretenders to the throne {reg4} ({s21}).:} {reg3?Heroes in the tavern {reg3} ({s20}).:}"),
Specialist said:This is Mordechai's Extended Prisoner Chat script, made ready for Warband 1.143 by me. Enjoy!
Code:################################################################################################### # Prisoner Talk - Originally written by Leprechaun, majorly overhauled & extended by Mordachai ################################################################################################### # this is a dummy dialog - it sets up the globals we need [anyone|plyr, "prisoner_chat", [ (store_conversation_troop,"$g_talk_troop"), (store_troop_faction,"$g_talk_troop_faction","$g_talk_troop"), (store_relation, "$g_talk_troop_faction_relation", "$g_talk_troop_faction", "fac_player_faction"), (call_script, "script_troop_get_player_relation", "$g_talk_troop"), (assign, "$g_talk_troop_relation", reg0), (eq, 1, 0) ], "", "close_window", []], # the following is intended to catch when you free up space for a prisoner that already agreed to join you [anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),(troops_can_join, 1)], "All right, I have made room for you.", "prisoner_chat_accept_confirm", []], [anyone, "prisoner_chat_accept_confirm", [], "I am at your command, my {lord/lady}.", "prisoner_chat_accept3", []], # and we catch the case where you still don't have any room for a pending conscripted prisoner [anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),(neg|troops_can_join, 1)], "I am sorry, I still have no room for you. You'll have to wait a while longer.", "close_window",[]], # default entry (no prior join agreement, or they've previously refused) [anyone|plyr, "prisoner_chat", [(neg|troop_slot_eq, "$g_talk_troop", slot_troop_occupation, slto_kingdom_hero)], "You there!", "prisoner_chat_commoner", []], [anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_troop_occupation, slto_kingdom_hero),(str_store_troop_name, s1, "$g_talk_troop")], "{s1}", "prisoner_chat_lord", []], # reaction to you based on noble or low-birth [anyone, "prisoner_chat_commoner", [], "Me?! (Gulp!)", "prisoner_chat_menu",[]], [anyone, "prisoner_chat_lord", [(str_store_troop_name, s1, "trp_player")], "Yes, {Lord/Lady} {s1}?", "prisoner_chat_noble",[]], # nobles chat begin [anyone|plyr,"prisoner_chat_noble", [], "You are free to go.", "prisoner_chat_noble_prerelease",[]], [anyone|plyr,"prisoner_chat_noble", [], "You will remain my prisoner.", "prisoner_chat_noble_prekeep",[]], [anyone|plyr,"prisoner_chat_noble", [(gt, "$players_kingdom", 0)], "You have committed high treason!", "prisoner_chat_treason",[]], [anyone|plyr,"prisoner_chat_noble_prerelease", [], "Despite what you may have heard, I am a {man/woman} of honor. You are free to go.", "prisoner_chat_noble_release", []], [anyone, "prisoner_chat_noble_release", [], "I will not forget this act of Chivalry!", "close_window", [ # remove the troop from prison (call_script, "script_remove_troop_from_prison", "$g_talk_troop"), (party_remove_prisoners, "p_main_party", "$g_talk_troop", 1), # determine how much honor and faction relation change this prisoner is worth (try_begin), # king (faction_slot_eq, "$g_talk_troop_faction", slot_faction_leader, "$g_talk_troop"), (assign, ":honor", 5), (assign, ":fac_reln", 15), (else_try), # other lord (assign, ":honor", 2), (assign, ":fac_reln", 5), (try_end), # give the player their honor, faction relation, and lord relation change (call_script, "script_change_player_relation_with_troop", "$g_talk_troop", 10), (call_script, "script_change_player_honor", ":honor"), (call_script, "script_change_player_relation_with_faction", "$g_talk_troop_faction", ":fac_reln" ), ]], [anyone|plyr,"prisoner_chat_noble_prekeep", [], "You will understand if I keep you hostage until your family can afford to... compensate me for certain expenses and hardships I have endured to keep you fed and ...safe... these past weeks.", "prisoner_chat_noble_keep",[]], [anyone, "prisoner_chat_noble_keep", [(ge, "$player_honor", 10),(ge, "$g_talk_troop_relation", 0)], "Truly, this is beneath you.", "close_window",[]], [anyone, "prisoner_chat_noble_keep", [], "And I trust you will be as understanding when I hunt you down like the dog you are!", "close_window",[(call_script, "script_change_player_relation_with_troop", "$g_talk_troop", -1)]], # commoners chat begin [anyone|plyr,"prisoner_chat_menu", [], "Hmmm... perhaps you're not as stupid as the rest of those rabble.", "prisoner_chat_offer",[]], [anyone|plyr,"prisoner_chat_menu", [], "As wretched as you are, I cannot help but feel sorry for you.", "prisoner_chat_release",[]], [anyone|plyr,"prisoner_chat_menu", [], "The sight of you makes me sick! You.. Die.. Now!", "prisoner_chat_die1",[]], [anyone|plyr,"prisoner_chat_menu", [], "Get back in line, Scum!", "close_window",[]], [anyone|plyr,"prisoner_chat_release", [], "I'm feeling magnanimous today. Begone, before I change my mind!", "prisoner_chat_release2", []], [anyone, "prisoner_chat_release2", [], "Oh, thank you, {sir/madam}. Blessings on you!", "close_window", [(remove_troops_from_prisoners, "$g_talk_troop", 1),(call_script, "script_change_player_honor", 1)]], [anyone|plyr,"prisoner_chat_offer", [], "Listen, scum, you have one last chance to redeem yourself before I sell you to the slave-traders. "\ "Drop all your previous allegiances and swear fealty to me, obey my every order to the letter, and you'll be paid, fed and equipped. "\ "If you don't....well, let's just say that life as a slave will be seemingly unending years of agony, malnutrition and beatings. "\ "I'd advise you to think very, very carefully before choosing. ", "prisoner_chat_reaction", [(call_script, "script_determine_prisoner_agreed", "$g_talk_troop", "$g_talk_troop_faction_relation")]], [anyone, "prisoner_chat_reaction", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1)], "Thank you for your mercy, {sir/madam}. I swear on my mothers grave I will serve you, my {lord/lady}!","prisoner_chat_accept1",[]], [anyone, "prisoner_chat_reaction", [], "I'll show you what I think of your offer! (The prisoner spits at your feet) There. Now get lost, I'm not interested.", "prisoner_chat_refuse",[]], [anyone|plyr,"prisoner_chat_refuse", [], "I see...", "prisoner_chat_menu",[]], [anyone|plyr,"prisoner_chat_die1", [], "(You advance on the prisoner...)", "prisoner_chat_die2",[]], [anyone, "prisoner_chat_die2", [], "Please, {sir/madam}, don't kill me. I am a defenceless prisoner. Surely you're not that cruel?", "prisoner_chat_die3",[]], [anyone|plyr,"prisoner_chat_die3", [], "(Kill the prisoner)", "prisoner_chat_die4",[]], [anyone|plyr,"prisoner_chat_die3", [], "No, I will not sink that low.", "close_window",[]], [anyone|plyr,"prisoner_chat_die4", [], "(The prisoner struggles against his shackles, desperate to free himself and escape you, but to no avail. You slit their throat with a knife and watch, satisfied, as his corpse sags to the floor.)", "close_window", [(remove_troops_from_prisoners, "$g_talk_troop", 1), (call_script, "script_change_player_honor", -1)]], [anyone|plyr, "prisoner_chat_accept1", [], "If you so much as fail to tremble on my command, I will have you severely disciplined!", "prisoner_chat_accept2",[]], [anyone|plyr, "prisoner_chat_accept1", [], "In my camp we are all treated as equals. I expect your obedience, but also your trust.", "prisoner_chat_accept2",[]], [anyone, "prisoner_chat_accept2", [], "I will obey your wishes, my {lord/lady}. I swear!", "prisoner_chat_accept3",[]], [anyone|plyr, "prisoner_chat_accept3", [(neg|troops_can_join, 1)], "Oh! Apparently there isn't enough room for you in my party. I will be back when I have made space.", "close_window", []], [anyone|plyr, "prisoner_chat_accept3", [(troops_can_join, 1)], "Excellent. Report to the quartermaster for provisions and equiment. There is hard fighting ahead.", "close_window", [(troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0), (remove_troops_from_prisoners, "$g_talk_troop",1), (party_add_members, "p_main_party", "$g_talk_troop", 1), (call_script, "script_change_troop_renown", "trp_player", 1),]], [anyone|plyr, "prisoner_chat_treason", [(str_store_troop_name, s1, "$g_talk_troop"), (str_store_faction_name, s2, "$players_kingdom")], "{s1}, you have committed cimes against the {s2}, for which you will now stand trial.^How plead you?", "prisoner_chat_treason_plead", [ # determine the noble's reaction to this accusation (store_random_in_range, reg0, 1, 5),#bug: must set upper number one higher to actually generate correct range #TODO: weight the reaction according to the renown? Or at least according to king or not... (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, reg0), ] ], [anyone, "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),], "Please have mercy upon my soul. All I have done, I have done in the name of my King and Country! I am but a patriot, as you, and I deserve your respect, if nothing else.", "prisoner_chat_treason_choose", []], [anyone, "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 2),], "You are gravely mistaken! I am an honorable Lord, and I have done nothing that you would not do were our roles exchanged.", "prisoner_chat_treason_choose", []], [anyone, "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 3),], "I spit on you and yours! You are but a cur come to put on airs, as though you were Noble and had any right whatsoever to judge me! Me! You are a nothing but a common brigand and a coward! I do not bow to you. You should drop to your knees and beg *my* forgiveness!", "prisoner_chat_treason_choose", []], [anyone, "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 4),], "You dare accuse me?! You sniveling whelpling! I should see you flogged and put in chains in one of my prisons for your insolence!", "prisoner_chat_treason_choose", []], [anyone|plyr, "prisoner_chat_treason_choose", [], "I am a {man/woman} of honor. I shall spare your life this day!", "prisoner_chat_treason_not_guilty", [ #TODO: have the relation with the prison have a mixed (random) result - relief, anger, etc, which dictates their final monologue to the player before exiting the dialog # make sure we don't try to recruit this prisoner later! (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0), ] ], [anyone, "prisoner_chat_treason_not_guilty", [(str_store_troop_name, s1, "trp_player")], "There is yet hope for you, {s1}.", "close_window", []], [anyone|plyr, "prisoner_chat_treason_choose", [], "You do not deserve leiniency. You must pay for your crimes with your life.", "prisoner_chat_treason_guilty", []], [anyone|plyr, "prisoner_chat_treason_guilty", [], "For your many crimes against {s1}, I hereby sentence you to death, to be carried out immediately. Have you any final words to say?", "prisoner_chat_treason_final_words", [(store_random_in_range, reg0, 1, 6), (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, reg0)]], [anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1)], "I believe you will one day come to regret your actions. There is only one who is worthy to decide another's fate... and that one is not you.", "prisoner_chat_treason_execute", []], [anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 2)], "You are a coward and a dog! May your soul rot eternal, damn you!", "prisoner_chat_treason_execute", []], [anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 3)], "Winter's mortality,^locked in frozen indifference,^melts with Spring's rebirth.", "prisoner_chat_treason_execute", []], [anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 4)], "You will find no peace on this earth! I shall haunt thee eternal! Unto death you will find nothing but unhappiness and fear. And beyond... only torture and pain!", "prisoner_chat_treason_execute", []], [anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 5)], "Who are you?^A day passes^We are but children", "prisoner_chat_treason_execute", []], [anyone|plyr, "prisoner_chat_treason_execute", [], "(The prisoner struggles against his shackles, desperate to free himself and escape you, but to no avail. You slit his throat and watch, satisfied, as his corpse sags to the floor.)", "close_window", [ # attempt to allow the player to see the consequences of their actions #(set_show_messages, 1), # this not only fails - but messages are hereafter disabled in the main game... # make sure we don't try to recruit this prisoner stack later! (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0), # "kill" the NPC - force the 48 hr respawn kingdom heros trigger to ignore this troop (no party will be created for this troop, ever again) # [q.v. script_create_kingdom_hero_party] (troop_set_slot, "$g_talk_troop", slot_troop_occupation, slto_dead), # remove them from their faction (troop_set_slot, "$g_talk_troop", slot_troop_change_to_faction, "fac_no_faction"), (troop_set_slot, "$g_talk_troop", slot_troop_original_faction, "fac_no_faction"), # determine the penalty for this act (based on the honor of the troop they've killed) (troop_get_slot, ":impact", "$g_talk_troop", slot_troop_renown), (val_div, ":impact", -33), (store_div, ":half", ":impact", 2), # reduce the player's relationship with every village, town, and castle (try_for_range, ":center", centers_begin, centers_end), (store_faction_of_party, ":faction", ":center"), (store_relation, ":relation", ":faction", "$g_talk_troop_faction"), (try_begin), (le, ":relation", -10), # enemies, half impact (call_script, "script_change_player_relation_with_center", ":center", ":half"), (else_try), # not at war, full impact (call_script, "script_change_player_relation_with_center", ":center", ":impact"), (try_end), (try_end), # reduce the player's relationship with every hero, companion, lady, and daughter (try_for_range, ":troop", trp_npc1, trp_heroes_end), # don't make the dead any angrier than they already are! (neg|troop_slot_eq, ":troop", slot_troop_occupation, slto_dead), (store_troop_faction, ":faction", ":troop"), (store_relation, ":relation", ":faction", "$g_talk_troop_faction"), (try_begin), (le, ":relation", -10), # enemies, half impact (call_script, "script_change_player_relation_with_troop", ":troop", ":half"), (else_try), # not at war, full impact (call_script, "script_change_player_relation_with_troop", ":troop", ":impact"), (try_end), (try_end), # reduce the player's relationship with every faction (enemies 1/2 as much) (try_for_range, ":faction", kingdoms_begin, kingdoms_end), (store_relation, ":relation", ":faction", "$g_talk_troop_faction"), (try_begin), (le, ":relation", -10), # enemies, half impact (call_script, "script_change_player_relation_with_faction", ":faction", ":half"), (else_try), # not at war, full impact (call_script, "script_change_player_relation_with_faction", ":faction", ":impact"), (try_end), (try_end), # apply the honor hit (call_script, "script_change_player_honor", ":impact"), # party morale takes a hit as well (call_script, "script_change_player_party_morale", ":half"), # but give them renown for this evil deed (their deed spreads upon every tongue, impressing some, and cowing others) (val_mul, ":impact", -1), (call_script, "script_change_troop_renown", "trp_player" , ":impact"), # start with the assumption that the fief should return to its faction for redistribution (assign, ":fief_faction", "$g_talk_troop_faction"), (try_begin), # handle executing the King! (faction_slot_eq, "$g_talk_troop_faction", slot_faction_leader, "$g_talk_troop"), # find best candidate to become king (assign, ":best_troop", -1), (assign, ":best_renown", -1), (try_for_range, ":troop", trp_kingdom_heroes_including_player_begin, trp_knight_6_20), (neg|troop_slot_eq, ":troop", slot_troop_occupation, slto_dead), #can't choose a dead hero! (store_troop_faction, ":faction", ":troop"), (eq, ":faction", "$g_talk_troop_faction"), (troop_slot_eq, ":troop", slot_troop_occupation, slto_kingdom_hero), #only other heros of this faction may become the king (troop_get_slot, ":renown", ":troop", slot_troop_renown), (gt, ":renown", ":best_renown"), (assign, ":best_troop", ":troop"), (assign, ":best_renown", ":renown"), (try_end), (try_begin), # check if a candidate was found (neq, ":best_troop", -1), # make them king (faction_set_slot, "$g_talk_troop_faction", slot_faction_leader, ":best_troop"), # announce it! #TODO: generate a presentation for this! (start_presentation, "prsnt_enemy_succession"), (str_store_troop_name, s1, ":best_troop"), (str_store_faction_name, s2, "$g_talk_troop_faction"), (display_message, "@{s1} is the new King of the {s2}!!!", 0xFFFF2222), #TODO: update the game log for this event (else_try), # all of the lords have been eliminated - so eliminate the faction by making their last fief neutral (q.v. trigger: # Check if a faction is defeated every day) (assign, ":fief_faction", "fac_no_faction"), (try_end), (try_end), # free up the deceased's fief (try_for_range, ":fief", centers_begin, centers_end), (party_get_slot, ":lord", ":fief", slot_town_lord), (eq, ":lord", "$g_talk_troop"), (call_script, "script_give_center_to_faction", ":fief", ":fief_faction"), (try_end), # no longer our prisoner (call_script, "script_remove_troop_from_prison", "$g_talk_troop"), (remove_troops_from_prisoners, "$g_talk_troop", 1), ] ], ################################################################################################### # End Prisoner Talk ###################################################################################################
Note: Search for prisoner_chat in module_dialogs. Simply erase the two lines there, and paste these lines in where the Native prisoner chat used to be.
Now: Search for slot_troop_kingsupport_objection_state = 145 in module_constants. Put a line or two below it, then add these lines underneath...
Code:####Mordechai EPC Begin slto_dead = 146 slot_prisoner_agreed = 147 ####Mordechai EPC End
Then add the final code below to module_scripts
Code:#MORDACHAI - update whether the specified prisoner would like to join the player's party # script_determine_prisoner_agreed # Input: arg1 = troop, arg2 = troop faction relation # Output: slot_prisoner_agreed is set to 1 if they agreed, or 0 if not # reg0 = agreed or not ("determine_prisoner_agreed", [ (store_script_param, ":troop", 1), (store_script_param, ":relation", 2), # upper bound = Persuasion*3 + Charisma + Leadership*3 + Honor/2 + Renown/100 (store_attribute_level, ":charisma", "trp_player", ca_charisma), (store_skill_level, ":persuasion", "skl_persuasion", "trp_player"), (store_skill_level, ":leadership", "skl_leadership", "trp_player"), (val_mul, ":persuasion", 3), (val_mul, ":leadership", 3), (store_div, ":half_honor", "$player_honor", 2), (troop_get_slot, ":renown_factor", slot_troop_renown), (val_div, ":renown_factor", 100), (assign, ":upper_bound", ":persuasion"), (val_add, ":upper_bound", ":leadership"), (val_add, ":upper_bound", ":charisma"), (val_add, ":upper_bound", ":half_honor"), (val_add, ":upper_bound", ":renown_factor"), (val_min, ":relation", ":upper_bound"), # determine their reaction (relation...upper_bound) (store_random_in_range, ":reaction", ":relation", ":upper_bound"), (assign, reg1, ":reaction"), (assign, reg2, ":relation"), (assign, reg3, ":upper_bound"), #(display_message, "@Prisoner Agrees Check: rolled a {reg1} out of a possible {reg2}-{reg3}"),#diagnostic only # record whether they agree or not (try_begin), (ge, ":reaction", 0), (troop_set_slot, ":troop", slot_prisoner_agreed, 1), (else_try), (troop_set_slot, ":troop", slot_prisoner_agreed, 0), (try_end), # return the results (troop_get_slot, reg0, ":troop", slot_prisoner_agreed), #(display_message, "@Prisoner Agrees Check: slot_prisoner_agreed = {reg0?yes:no}"),#diagnostic only ] ),
I take no credit for any of the code, all I did was properly number the constants and change some troop references that caused Compilation Errors. All credit goes to Mordachai and Leprechaun for the code.
Enjoy!
[anyone|plyr,"prisoner_chat_menu", [], "Hmmm... perhaps you're not as stupid as the rest of those rabble.", "prisoner_chat_offer",[]],
change_screen_loot = 2041 # (change_screen_loot, <troop_id>),
# Opens the Looting interface, using the provided troop as loot storage. Player has full access to troop inventory.