Author Topic: [Code] manhunter: attack them or sell them prisoners (a how to) also selling at taverns  (Read 7261 times)

0 Members and 1 Guest are viewing this topic.

Glabrezu

  • Recruit
  • *
    • View Profile
  • Faction: Neutral
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: [Select]
[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: [Select]
[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: [Select]
  [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: [Select]
[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: [Select]
  [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: [Select]
  ("game_get_prisoner_price",
3)copy this
Code: [Select]
  ("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: [Select]
  ("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...)
« Last Edit: May 18, 2011, 08:51:05 PM by Glabrezu »

Lumos

  • Probably Not a Help Desk
  • Moderator
  • *
  • Mens INsana in corpore sano
    • Steam - lumosx
    • YouTube - LumosX
    • View Profile
  • Faction: Nord
  • WBWF&SNWM&BVC
Care to put the code in code tags? Thanks.

Glabrezu

  • Recruit
  • *
    • View Profile
  • Faction: Neutral
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
« Last Edit: May 07, 2011, 08:09:29 PM by Glabrezu »

Crossbow Joe

  • Grandmaster Knight
  • *
  • Ez'ran!
    • View Profile
    • My Deviantart Profile
  • Faction: Vaegir
  • MP nick: Crossbow_Joe
  • M&BWB
Sounds like a nifty piece of code. I'm going to add it in just now, If there are any problems I'll ask.

EDIT: There weren't, thanks for this!
« Last Edit: May 08, 2011, 11:17:40 AM by Crossbow Joe »

Ikaguia

  • Grandmaster Knight
  • *
  • Defender of the Potato cult.
    • Skype - Ikaguia
    • Steam - Ikaguia
    • Twitch.tv - Ikaguia
    • View Profile
  • Faction: Sarranid
  • MP nick: Ikaguia
  • WBWF&SNW
Code: [Select]
  ("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),"

Sorry for my poor English, I'm Brazilian.

Glabrezu

  • Recruit
  • *
    • View Profile
  • Faction: Neutral
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

keinPlan86m

  • Squire
  • *
    • View Profile
  • Faction: Nord
  • VCWBNW
Nice idea Glabrezu, will be using it. :D
Conquer Calradia with Money!

More Information's can be found here:


Crossbow Joe

  • Grandmaster Knight
  • *
  • Ez'ran!
    • View Profile
    • My Deviantart Profile
  • Faction: Vaegir
  • MP nick: Crossbow_Joe
  • M&BWB
Oh :whoops: I meant that it worked fine. When I said "there wern't" I meant there were no problems.

Glabrezu

  • Recruit
  • *
    • View Profile
  • Faction: Neutral
im glad its of use to some people :D

Specialist

  • Master Knight
  • *
  • Coder
    • View Profile
  • Faction: Neutral
  • MP nick: TheSpecialist
  • WB
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?

Glabrezu

  • Recruit
  • *
    • View Profile
  • Faction: Neutral
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 :)

Code: [Select]
[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

« Last Edit: May 18, 2011, 09:02:48 PM by Glabrezu »

Specialist

  • Master Knight
  • *
  • Coder
    • View Profile
  • Faction: Neutral
  • MP nick: TheSpecialist
  • WB
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 :)

Code: [Select]
[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: [Select]
(val_sub, ":rel", 1), #reputation with manhunters loss
(call_script, "script_set_player_relation_with_faction", "$g_encountered_party_faction", ":rel"),

to
Code: [Select]
(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. :)
Or does it cause an error that way?

Glabrezu

  • Recruit
  • *
    • View Profile
  • Faction: Neutral
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

Specialist

  • Master Knight
  • *
  • Coder
    • View Profile
  • Faction: Neutral
  • MP nick: TheSpecialist
  • WB
Okay. It worked, and I couldn't be happier!

Now to make slavers! Hehehe


Glabrezu

  • Recruit
  • *
    • View Profile
  • Faction: Neutral
glad i could help, and gl with the slavers :)
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