OSP Code SP Manhunter: attack them or sell them prisoners (a how to) also selling at taverns

Users who are viewing this thread

Glabrezu

Recruit
Selling Prisoners to Tavern Keepers or Manhunters using the module system (for warband 1.34)
not sure if anyones did this already, if they have all credit to them! (pretty sure someones done the tavern one, i just added it for completeness)

1)in module_dialogues.py search for
Code:
[party_tpl|pt_manhunters,"start", [(eq,"$talk_context",tc_party_encounter)], "Hey, you there! You seen any outlaws around here?", "manhunter_talk_b",[]],

2)copy this
Code:
[party_tpl|pt_manhunters,"start", [(eq,"$talk_context",tc_party_encounter)], "Hey, you there! You seen any outlaws around here?", "manhunter_talk_b",[]],
[party_tpl|pt_manhunters|plyr,"manhunter_talk_b", [], "Yes, they went this way about an hour ago.", "manhunter_talk_b1",[]],
[party_tpl|pt_manhunters,"manhunter_talk_b1", [], "I knew it! Come on, lads, lets go get these bastards! Thanks a lot, friend.", "close_window",[(assign, "$g_leave_encounter",1)]],
[party_tpl|pt_manhunters|plyr,"manhunter_talk_b", [], "No, haven't seen any outlaws lately.", "manhunter_talk_b2",[]],
[party_tpl|pt_manhunters,"manhunter_talk_b2", [], "Bah. They're holed up in this country like rats, but we'll smoke them out yet. Sooner or later.", "close_window",[(assign, "$g_leave_encounter",1)]],
[party_tpl|pt_manhunters|plyr,"manhunter_talk_b", [], "I wish to collect on the bounties of some criminals i have captured.", "manhunter_talk_b3",
[[change_screen_trade_prisoners]]],
[party_tpl|pt_manhunters,"manhunter_talk_b3", [], "There's your bounty. Now me and the lads are going to hunt down more criminals.", "close_window",[(assign, "$g_leave_encounter",1)]],
[party_tpl|pt_manhunters|plyr,"manhunter_talk_b", [], "Kiss my arse.", "manhunter_talk_b4",[]],
[party_tpl|pt_manhunters,"manhunter_talk_b4", [], "How dare you! Prepare to die.", "close_window",
[[encounter_attack]]],

3)paste what you just copied over this
Code:
  [party_tpl|pt_manhunters,"start", [(eq,"$talk_context",tc_party_encounter)], "Hey, you there! You seen any outlaws around here?", "manhunter_talk_b",[]],
  [party_tpl|pt_manhunters|plyr,"manhunter_talk_b", [], "Yes, they went this way about an hour ago.", "manhunter_talk_b1",[]],
  [party_tpl|pt_manhunters,"manhunter_talk_b1", [], "I knew it! Come on, lads, lets go get these bastards! Thanks a lot, friend.", "close_window",[(assign, "$g_leave_encounter",1)]],
  [party_tpl|pt_manhunters|plyr,"manhunter_talk_b", [], "No, haven't seen any outlaws lately.", "manhunter_talk_b2",[]],
  [party_tpl|pt_manhunters,"manhunter_talk_b2", [], "Bah. They're holed up in this country like rats, but we'll smoke them out yet. Sooner or later.", "close_window",[(assign, "$g_leave_encounter",1)]],

4)save

you will now be able to sell prisoners to the manhunters (option 3 when talking to them)
or attack them (option 4 when talking to them)
feel free to edit the messages any way you like, if this code doesnt work, try the one i posted below Specialist's posting, on this page

for the tavern keeper
1) search for
Code:
[anyone,"tavernkeeper_job_result_2", [], "I'll keep my ears open for other opportunities. You may want to ask again from time to time.", "close_window",[]],
2) past this underneath
Code:
  [anyone|plyr,"tavernkeeper_talk", [],
  "I have some prisoners to sell...", "ransom_broker_sell_prisoners_2",
   [[change_screen_trade_prisoners]]],
#  [anyone, "ransom_broker_sell_prisoners_2", [], "You take more prisoners, bring them to me. I will pay well.", "close_window",[]],
  [anyone, "ransom_broker_sell_prisoners_2", [], "I will be staying here for a few days. Let me know if you need my services.", "close_window",[]],
3) save

you can now sell prisoners to the tavern keepers

and lastly for having prisoners sold at their level based value
1) open up module_scripts.py

2) search for
Code:
  ("game_get_prisoner_price",
3)copy this
Code:
  ("game_get_prisoner_price",
    [
      (store_script_param_1, ":troop_id"),

      (try_begin),
        (is_between, "$g_talk_troop", ransom_brokers_begin, ransom_brokers_end),
        (store_character_level, ":troop_level", ":troop_id"),
        (assign, ":ransom_amount", ":troop_level"),
        (val_add, ":ransom_amount", 10),
        (val_mul, ":ransom_amount", ":ransom_amount"),
        (val_div, ":ransom_amount", 6),
      (else_try),
        (store_character_level, ":troop_level", ":troop_id"),
        (assign, ":ransom_amount", ":troop_level"),
        (val_add, ":ransom_amount", 10),
        (val_mul, ":ransom_amount", ":ransom_amount"),
        (val_div, ":ransom_amount", 6),
      (try_end),

      (assign, reg0, ":ransom_amount"),

      (set_trigger_result, reg0),
  ]),
4) paste what you copied over this
Code:
  ("game_get_prisoner_price",
    [
      (store_script_param_1, ":troop_id"),
            
      (try_begin),
        (is_between, "$g_talk_troop", ransom_brokers_begin, ransom_brokers_end),
        (store_character_level, ":troop_level", ":troop_id"),
        (assign, ":ransom_amount", ":troop_level"),
        (val_add, ":ransom_amount", 10), 
        (val_mul, ":ransom_amount", ":ransom_amount"),
        (val_div, ":ransom_amount", 6),
      (else_try),  
        (assign, ":ransom_amount", 50),
      (try_end),
      
      (assign, reg0, ":ransom_amount"),
      
      (set_trigger_result, reg0),
  ]),
5)save

this should make it so anyone who buys prisoners will buy them at the level based price (i have it so village elders buy as well... hey  im lazy, saves me running to town or finding manhunters)

best to make back up copies of the files before modding (always a good precaution i sometimes forget...)
 
err not sure how, but ill look into it now

well that was easier than i expected, i better go do it to my other posting now
 
Code:
  ("game_get_prisoner_price",
    [
      (store_script_param_1, ":troop_id"),

      (try_begin),
        (is_between, "$g_talk_troop", ransom_brokers_begin, ransom_brokers_end),
        (store_character_level, ":troop_level", ":troop_id"),
        (assign, ":ransom_amount", ":troop_level"),
        (val_add, ":ransom_amount", 10),
        (val_mul, ":ransom_amount", ":ransom_amount"),
        (val_div, ":ransom_amount", 6),
      (else_try),
        (store_character_level, ":troop_level", ":troop_id"),
        (assign, ":ransom_amount", ":troop_level"),
        (val_add, ":ransom_amount", 10),
        (val_mul, ":ransom_amount", ":ransom_amount"),
        (val_div, ":ransom_amount", 6),
      (try_end),

      (assign, reg0, ":ransom_amount"),

      (set_trigger_result, reg0),
  ]),
wouldn't it be easier just removing the block "(is_between, "$g_talk_troop", ransom_brokers_begin, ransom_brokers_end),"
 
I was thinking that Ikaguia, but to be honest my knowledge of scripting and coding is very basic and i wasnt 100% sure that removing it would be ok (ie break the script - i suspected it wouldnt, just wasnt entirely sure, so i erred on the side of caution)
so anyone using the code, go by Ikaguia advice
and it should work fine Crossbow Joe, ive tested it on my own little mod, no problems encountered
 
Hey.... When I put this in my mod, I can click the attack dialog, and it goes to the attack screen. But it won't let me do any more than "Leave"  :cry:

I really wanted to slaughter a few manhunters today.... *sniffles*  :lol:

Any ideas?
Oh, and if I were to add a dialog ( say something like: "Hey, got any prisoners you could sell me?" to click on) what would I have to put to make it where you could buy slaves as members of your party?
 
Heya Specialist, funny you should make the post about not be able to attack them, i was about to post a change in the code
maybe its something in your mod? i was using Floris Mod Pack and it was the same with me, so after trial and error i changed the code a little, i can now attack the manhunters again :smile:

Code:
[party_tpl|pt_manhunters|plyr,"manhunter_talk_b", [], "Kiss my arse.", "manhunter_talk_b4",[]],
[party_tpl|pt_manhunters,"manhunter_talk_b4", [], "How dare you! Prepare to die.", "close_window",
#[[encounter_attack]]],
[(call_script, "script_diplomacy_party_attacks_neutral", "p_main_party", "$g_encountered_party"),

(store_relation,":rel", "$g_encountered_party_faction","fac_player_supporters_faction"),
(try_begin),
(gt, ":rel", 0),
(val_sub, ":rel", 0), #rep loss irrelevant here
(try_end),

(val_sub, ":rel", 1), #reputation with manhunters loss
(call_script, "script_set_player_relation_with_faction", "$g_encountered_party_faction", ":rel"),

(assign,"$encountered_party_hostile",1),
(assign,"$encountered_party_friendly",0),
]],

that code should now allow you to attack manhunters again, worked with Floris mod pack anyway
you will get a reputation hit with manhunters, but it appears to have no real effect, you still have the same options the next time you speak to them, and it seems you need this reputation hit to actually be able to attack them

 
Glabrezu said:
Heya Specialist, funny you should make the post about not be able to attack them, i was about to post a change in the code
maybe its something in your mod? i was using Floris Mod Pack and it was the same with me, so after trial and error i changed the code a little, i can now attack the manhunters again :smile:

Code:
[party_tpl|pt_manhunters|plyr,"manhunter_talk_b", [], "Kiss my arse.", "manhunter_talk_b4",[]],
[party_tpl|pt_manhunters,"manhunter_talk_b4", [], "How dare you! Prepare to die.", "close_window",
#[[encounter_attack]]],
[(call_script, "script_diplomacy_party_attacks_neutral", "p_main_party", "$g_encountered_party"),

(store_relation,":rel", "$g_encountered_party_faction","fac_player_supporters_faction"),
(try_begin),
(gt, ":rel", 0),
(val_sub, ":rel", 0), #rep loss irrelevant here
(try_end),

(val_sub, ":rel", 1), #reputation with manhunters loss
(call_script, "script_set_player_relation_with_faction", "$g_encountered_party_faction", ":rel"),

(assign,"$encountered_party_hostile",1),
(assign,"$encountered_party_friendly",0),
]],

that code should now allow you to attack manhunters again, worked with Floris mod pack anyway
you will get a reputation hit with manhunters, but it appears to have no real effect, you still have the same options the next time you speak to them, and it seems you need this reputation hit to actually be able to attack them

Could you change the section of the code:
Code:
(val_sub, ":rel", 1), #reputation with manhunters loss
(call_script, "script_set_player_relation_with_faction", "$g_encountered_party_faction", ":rel"),

to
Code:
(val_sub, ":rel", 0), ###reputation loss with Manhunters = 0 (no change) 
(call_script, "script_set_player_relation_with_faction", "$g_encountered_party_faction", ":rel"),


That way you lose no relations at all. :smile:
Or does it cause an error that way?
 
you lose reputation with manhunters only, but theres no real consequences, the rep lose part with the 0 is for their faction (i took it from village raiding), they have no faction so i made it 0, and the other part where rep is lost is dealing with the manhunters themselves and it is needed to be able to attack, without it there is still no option to attack, but like i said, theres no consequences
so just keep it the way it is and itll work fine
 
glad i could help, and gl with the slavers :smile:
maybe have a look at the mercenary unit spawning in taverns... may be a way to have random units appear in slavers buy list.... er... like i said gl
right now im trying to add 1 hit point per level to units... no luck yet
 
Good luck doing your bit too! :smile:

I was basically going to have random amounts of bandits spawn in the Manhunter party, and then add an option where you could buy prisoners as troops.

The fancy stuff can come later. :wink:
 
some ideas... maybe, they will get prisoners all on their own (could give them a helping hand by increasing their numbers), plus you could have them spawn with prisoners, although that would limit choice/randomness, but it would maybe save some coding induced headaches :wink:

as for my problem... i think ill need to post for help, my idea doesnt work

Code:
                        ("get_troop_max_hp", #myone add level?
                          [
                            (store_script_param_1, ":troop"),							
                            
                            (store_skill_level, ":skill", skl_ironflesh, ":troop"),
                            (store_attribute_level, ":attrib", ":troop", ca_strength),
							(store_character_level, ":level", ":troop"), #my addition						
                            (val_mul, ":skill", 2),							
                            (val_add, ":skill", ":attrib"),
							(val_add, ":skill", ":level"),	#my addition						
                            (val_add, ":skill", 35),							
                            (assign, reg0, ":skill"),
                        ]),
 
Back
Top Bottom