Author Topic: Recruit from your Prisoners! - Obsolete with new version of M&B  (Read 43024 times)

Leprechaun

  • Guest
Recruit from your Prisoners! - Obsolete with new version of M&B
« on: January 14, 2007, 10:40:42 AM »
I've put a mod that allows you to recruit from your prisoners on the File Repository. Their faction's standing with you ought to affect whether they will follow you or not, but this is relatively untested. Please report any problems. (Apologies if this mod has been released already, but I searched and couldn't find it.)

Updated 29th December 2006. I've re-ported it using python so you'll no longer need to start a new game to use it.

New version is up. v2.0 is for v0.808 of Mount&Blade.

Link: http://www.mbrepository.com/modules/PDdownloads/singlefile.php?cid=10&lid=153

Python source is up. See the next post for details on adding it to your own mod. Remember that I ask to be credited for the work if you use it in your own.
http://www.mbrepository.com/modules/PDdownloads/singlefile.php?cid=4&lid=321


Features

    * Recruit from your prisoners
    * Fixed conversation


With the latest version, if the prisoner refuses to join you, you cannot try again, you must sell him or kill him.

New version:
I've reworked the code to better calculate how likely the prisoner is to join your faction.


Reminder to self - update again with fixed code when you get a spare moment.
« Last Edit: March 06, 2008, 01:08:46 PM by Leprechaun »

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #1 on: January 14, 2007, 10:43:16 AM »
In module_constants:
Beneath "slot_town_import_rate_2" = 48 add "slot_prisoner_agreed = 1"

In module_dialogues:
Where it says
"[anyone|plyr,"prisoner_chat", [], "Don't 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",[]],"
or whatever, delete the entire lot and paste in:

Code: [Select]
  [anyone|plyr,"prisoner_chat", [[store_conversation_troop,reg(2)],[store_troop_faction,reg(3),reg(2)],[store_relation,reg(4),reg(3),"fac_player_faction"]], "Don't try running away or trying something stupid. I will be watching you.", "prisoner_chat_2",
   [[store_random_in_range,reg(5),reg(4),3]]],
  [anyone,"prisoner_chat_2", [], "No, I swear I won't.", "prisoner_chat_3",[]],
  [anyone|plyr,"prisoner_chat_3", [], "Good. You're not stupid like the rest of these scum.", "prisoner_chat_4",[]],
  [anyone|plyr,"prisoner_chat_4", [], "[End the conversation]", "prisoner_chat_5",[]],
  [anyone|plyr,"prisoner_chat_5", [], "I hope you're looking forward to life as a slave, scum.", "close_window",[]],
  [anyone|plyr,"prisoner_chat_4", [], "[Try to recruit the prisoner]", "prisoner_chat_6",[]],
  [anyone|plyr,"prisoner_chat_6", [], "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 to fight for me and 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 refusing.", "prisoner_chat_7",[]],
  [anyone,"prisoner_chat_7", [[lt,reg(5),0]], "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_8",[]],
  [anyone|plyr,"prisoner_chat_8", [], "[Kill the prisoner]", "prisoner_chat_14",[]],
  [anyone|plyr,"prisoner_chat_8", [], "[Sell the prisoner]", "prisoner_chat_10",[]],
  [anyone|plyr,"prisoner_chat_9", [], "(You advance on the prisoner with your weapon drawn)", "prisoner_chat_11",[]],
  [anyone|plyr,"prisoner_chat_4", [], "[Kill the prisoner]", "prisoner_chat_9",[]],
  [anyone|plyr,"prisoner_chat_10", [], "We have found a roaming slave trader. It's time for us to part ways. Goodbye, it was nice not to know you.", "close_window",
   [[store_conversation_troop,reg(2)],[remove_troops_from_prisoners,reg(2),1],[troop_add_gold,"trp_player",20]]],
  [anyone,"prisoner_chat_11", [], "Please, {sir/madam}, don't kill me. I am a defenceless prisoner. Surely you're not that cruel?", "prisoner_chat_12",[]],
  [anyone|plyr,"prisoner_chat_12", [], "[Kill the prisoner]", "prisoner_chat_13",[]],
  [anyone|plyr,"prisoner_chat_13", [], "Yes, idiot. I am that cruel. Prepare to die.", "prisoner_chat_14",[]],
  [anyone|plyr,"prisoner_chat_14", [], "(The prisoner struggles against his shackles, desperate to free himself and escape you, but to no avail. You slit his throat with a knife and watch, satisfied, as his corpse sags to the floor.)", "close_window",
   [[store_conversation_troop,reg(2)],[remove_troops_from_prisoners,reg(2),1]]],
  [anyone|plyr,"prisoner_chat_12", [], "[Let him live]", "prisoner_chat_15",[]],
  [anyone|plyr,"prisoner_chat_15", [], "Very well, I'll let you live. I hope you enjoy life as a slave.", "prisoner_chat_16",[]],
  [anyone,"prisoner_chat_16", [], "Oh, thank you, {sir/madam}.", "close_window",[]],
  [anyone,"prisoner_chat_7", [[ge,reg(5),0]], "Thank you for your mercy, {sir/madam}. I promise to drop all allegiances to serve you in any way I can.","prisoner_chat_17",[]],
  [anyone|plyr,"prisoner_chat_17", [], "Good. Now, I'll make the rules clear to you. There will be no discrimination against other soldiers in my army because they were once on the opposing side or were bandits. They fight for me now, as do you. Their ties with the past are broken. Think you can handle it?", "prisoner_chat_18",[]],
  [anyone,"prisoner_chat_18", [], "Yes, {sir/madam}. I will obey the rules.", "prisoner_chat_19",[]],
  [anyone|plyr, "prisoner_chat_19", [[neg|hero_can_join]],"Oh. There isn't enough room in my party for you. I will be back when I have made room.", "close_window",
   [[store_conversation_troop,reg(0)],[troop_set_slot,reg(0),slot_prisoner_agreed,1]]],
  [anyone|plyr, "prisoner_chat_19", [[hero_can_join]], "Excellent. From now on, you fight alongside these men. Help them when they need it, and they'll do the same for you. Get equipped and fed. We'll head out as soon as you're done.", "close_window",
   [[store_conversation_troop,reg(0)],[troop_join,reg(0)],[remove_troops_from_prisoners,reg(0),1]]],
  [anyone|plyr,"prisoner_chat", [[store_conversation_troop,reg(0)],[troop_get_slot,reg(1),reg(0),slot_prisoner_agreed],[eq,reg(1),1],[hero_can_join]], "All right, I have made room for you to join my party. Welcome aboard.", "close_window",
   [[store_conversation_troop,reg(0)],[troop_join,reg(0)],[remove_troops_from_prisoners,reg(0),1]]],
  [anyone|plyr,"prisoner_chat", [[store_conversation_troop,reg(0)],[troop_get_slot,reg(1),reg(0),slot_prisoner_agreed],[neg|reg(1),1],[hero_can_join]], "I am sorry, I still have no room for you. You'll have to wait a while longer, I'm afraid.", "close_window",[]],
« Last Edit: January 15, 2007, 04:13:36 PM by Leprechaun »

Jakethief

  • Guest
Re: Recruit from your Prisoners!
« Reply #2 on: January 15, 2007, 04:02:36 PM »
Wow, that's actually really awesome. If I ever make a mod I will definitely have this in it.

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #3 on: January 15, 2007, 04:13:18 PM »
However, I'd advise you to be careful - some part of my code is causing an error, and I haven't ascertained the cause yet. I'm fairly sure it's not this, but I'm not ruling it out. If you get an error when incorporating this code, please give me feedback.


I thought I'd post how it calculates the joining probability while I'm at it.

First it finds the prisoner's faction:
[store_conversation_troop,reg(2)],[store_troop_faction,reg(3),reg(2)]

Then it finds his relation to you:
[store_relation,reg(4),reg(3),"fac_player_faction"]

When you first join a faction your relations improve to three, so I class that as the maximum value to begin with. It then generates a random number between the best likely relations and their actual relations:
[store_random_in_range,reg(5),reg(4),3]

If this number is over or equal to 0, the prisoner will join:
[ge,reg(5),0]
If it's under, he won't:
[lt,reg(5),0]

Obviously, the lower his relations to you, the wider the range for the number to be selected from, so the less chance it has to be above 0, so the less chance he'll join you.
« Last Edit: January 15, 2007, 04:15:47 PM by Leprechaun »

Offline Hellequin

  • Journeyman
  • ***
  • Posts: 254
    • View Profile
Re: Recruit from your Prisoners!
« Reply #4 on: January 19, 2007, 01:20:15 PM »
Um... I'm not sure what (store_random_in_range) would do with an inverted range (store_random_in_range, ":Val", 10, 3), but it's possible that checking overfriendly troops with that script could be the source of your problems.  Try (val_min)ing it down to three before you check?

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #5 on: January 20, 2007, 03:51:05 AM »
All it does is make them join you every time. If they're a friendly faction why wouldn't they join up with someone?

If it's an inverted range, all that will happen, surely, is that it'll generate a number between the higher number and the lower number, which will always be over 0 so the troop will always join.

However, that means I need to fix up a new troop tree for deserters with the right faction, to avoid them joining you at once.

It also can't be the cause of the error (I think), because it occurs during game startup, not during the conversation. The conversation itself occurs fine. The error makes me think it may be an error in one of my troops (Winter tipped me of on this) where I have a troop with a skill over 10 in something due to the knows_common being added to something else.

Think I've found it - I altered a hero into a merchant but forgot to remove knows_common so his inventory management was 12.

Nope, not that. Forgot to put a space between comma and face code in three places, that didn't help either.

If it helps, error occurs right at the end of loading setting data as it starts loading textures. Hmm... I wonder. Just had a thought. I'll implement a bypass so any troop with relations over three will just join you, and alter the faction of deserters, but I have an inkling of what also may cause the problem.

atilladahun

  • Guest
Re: Recruit from your Prisoners!
« Reply #6 on: January 27, 2007, 07:48:23 PM »
Hmmm.... for some reason it wont work... i wonder why... it keeps opening a folder that has about 4 files in it plus a bunch of notepad stuff... plz help :(
« Last Edit: January 27, 2007, 07:52:26 PM by atilladahun »

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #7 on: January 28, 2007, 10:20:03 AM »
Four folders, and lots of text files? That would be the module, which goes in your modules folder.

juusohuu

  • Guest
Re: Recruit from your Prisoners!
« Reply #8 on: January 29, 2007, 01:31:39 PM »
Four folders, and lots of text files? That would be the module, which goes in your modules folder.
By extracting it to the module folder I get an additional mod to choose from at the start up of M&B. Choosing it I can start a new game (after clicking some error messages), but how can I continue my old games? I have missed something. This mod is a great idea!

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #9 on: January 29, 2007, 03:35:24 PM »
There used to be something I could do to allow you to load Native savegames in it, but I can't for the life of me remember what it was. I'm already looking into it, because it's driving me crazy.

Sturmspawn

  • Guest
Re: Recruit from your Prisoners!
« Reply #10 on: January 31, 2007, 11:34:14 AM »
Simplest workaround is to create another subdir under M&BSavedGames using the 'moduleName' that you put the recruit prisoners mod in. Then simply copy your current game into that folder.

BTW - I am still having some perf and grafic issues - I set up parallel modules and savegame dirs, one pure native and one with Recruit Prisoners. For the identical savegame loaded under recruit prisoner, the grafic for StrongBow, etc still pops out of your shoulder like a horn, wheras it doesn't in pure native. I am also getting the same 'delay' issue when firing a bow under the recruit prisoner mods. This is recreatable [as I have done so a few times]. I am guessing that you might have either introduced a subtle error, or unwittingly picked up an old file in the whole complex somewhere. I have not run any file version checks [I threw away all of my dev tools about 7 years ago and I am now merely a consumer].

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #11 on: January 31, 2007, 11:53:46 AM »
That's the odd thing though - I built this in the v0.808 python module, without touching any items in the released version, and it was a fresh install of the game, with only the necessary files copied from Native so it actually worked. Most odd. I'll try to fix it in the next version, but to be honest I don't really know where to begin.  ???

EDIT: Hey, custom tag!

Sturmspawn

  • Guest
Re: Recruit from your Prisoners!
« Reply #12 on: January 31, 2007, 11:43:49 PM »
Not to worry - At least I know that my machine is still stable [it's a bit low-end for this game]. I don't recruit that often, so I have Recruit set up as an alternate mod. When I want to recruit, I just copy the native save into the recruit save, do the recruit and copy it back. It's a little inconvenient, but the type of units I recruit [Khergits and Darks] rarely get killed and rarely need replacement thereafter [I think I've actually done recruiting about three times in this current game - don't need to go th the well too often]. As I mentioned in some of my taleworlds posts, this is a wonderful mod. Not that we'd take it for granted, but do you think it will be incorporated ino the base product [with credit where credit's due]?. I'm pretty new to M&B, so I don't have a clue about the culture and community.

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #13 on: February 01, 2007, 11:00:15 AM »
If you somehow managed to beg Armagan enough to include it, I'd be happy for it to be included, but the chances of that happening are fairly slim to none. You could ask though, I suppose.

atilladahun

  • Guest
Re: Recruit from your Prisoners!
« Reply #14 on: February 01, 2007, 04:55:57 PM »
Can yuo put this mod on other mods like say... Swadian civil war?

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #15 on: February 02, 2007, 11:36:38 AM »
If you a) beg or b) get hold of the source code by asking very nicely. Other than that, not without screwing things up.

Hist-Man

  • Guest
Re: Recruit from your Prisoners!
« Reply #16 on: March 09, 2007, 05:32:27 PM »
BIG PROBLEM!

OK for one, when I start the game and go through the error messages I tried a new game.

Well the arrows for my bow are sticking in me.

I'm serious the quiver is INSIDE my characters body  :shock:

I can shoot, but I also noticed that whenever I have archers with me they hold the bow down, with no arrow strung, and an arrow fires from their chest. So it's like they shoot, but without moving the bow. It is REALLY getting annoying.

I have M&B .808 and got the new version for this.

I NEED HELP!

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #17 on: March 10, 2007, 03:05:28 AM »
That sounds like a problem with either animations or item models, neither of which I even touched. Most strange. Have you tried reinstalling the mod?

Hist-Man

  • Guest
Re: Recruit from your Prisoners!
« Reply #18 on: March 10, 2007, 11:17:44 AM »
I reinstalled the game, but not the mod  :-[

I'll try that.

Thank you :)


Hist-Man

  • Guest
Re: Recruit from your Prisoners!
« Reply #19 on: March 10, 2007, 12:08:23 PM »
I got rid of anything that dealt with the mod then reinstalled it, but the problem's still there.

You can see the bottom of the quiver sticking out the bottom of the persons ***  :shock:

It's getting a little annoying because I can't tell when the enemy is going to shoot/throw something.

Their arms hang down and the arrow/javellin shoots out of their body (Where their arm would be)

I'd post a screen, but:

1) I don't know how to take one.
2) I don't know how to post one if I did take one...

Hist-Man

  • Guest
Re: Recruit from your Prisoners!
« Reply #20 on: March 10, 2007, 12:12:58 PM »
I see now, the kerget (sp?) bow is messed up.

It is supposed to be at your side, but it's kinda in your back. When you take it out you hold it down, when you shoot you see the string pulled back and the bow bends, the arrow is in your hand, and the bow is still down.

Then it shoots from where it would be if you were holding it up.

Does this not happen to ANYONE else?

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #21 on: March 10, 2007, 02:52:15 PM »
I've certainly not had any ordeals with it.

Hist-Man

  • Guest
Re: Recruit from your Prisoners!
« Reply #22 on: March 10, 2007, 04:16:21 PM »
I guess I just really have sucky luck then  :'(

Hist-Man

  • Guest
Re: Recruit from your Prisoners!
« Reply #23 on: March 10, 2007, 04:40:11 PM »
I might be missing something, I download it from mbrespitory (of course) and save it to the modules folder (for .808) and then extract it to modules, just like I do with all the others.

Am I supposed to add something? Maybe the file was corrupt for me? I downloaded it wrong?

I really want to play this, I really need help :(

Maybe you could give a link to the one you downloaded? (I'm desperate.)

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #24 on: March 11, 2007, 10:44:22 AM »
I don't need to download one, as it's on my PC already, but I've tested my download and it works fine for me (it's the same file as I use myself). It could be a corrupt file, I guess. Try redownloading it.

Hist-Man

  • Guest
Re: Recruit from your Prisoners!
« Reply #25 on: March 11, 2007, 01:24:19 PM »
Is there a different place to download from if it's corrupt?

I downloaded it several times from mbrespitory, but each time it does not work right. I can recruit fine, just nothing else.

And it's only on this mod that it does not work right.

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #26 on: March 11, 2007, 01:34:08 PM »
I'll take a look at it as soon as I get the chance, I promise. I simply can't think of anything that could possibly cause it.

Hist-Man

  • Guest
Re: Recruit from your Prisoners!
« Reply #27 on: March 11, 2007, 01:44:08 PM »
How do I take/post a screenshot?

Then I could at least show you what is happening.

Hist-Man

  • Guest
Re: Recruit from your Prisoners!
« Reply #28 on: March 13, 2007, 11:52:18 AM »
I FOUND THE PROBLEM!

OK when you start, don't you get the error message a few times, well if you press ignore you can still play.

But I still had the bow, arrow, and jav. problem so I did some stuff and fixed it. I fixed the arrow problem and the error messages.

I replaced the modules file in this with the one in native, and I also did it with the item kinds, and now the arrow problem is fixed, and I don't get that error message now.

Hope this helps some :)

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #29 on: March 13, 2007, 04:17:44 PM »
I think I love you. Run through exactly what you did for me, step by step.

Hist-Man

  • Guest
Re: Recruit from your Prisoners!
« Reply #30 on: March 14, 2007, 09:48:41 AM »
Well the only thing I did was replace the modules configurations settings in this mod with the modules configurations settings in native.

And I replaced the item_kinds1 file in this mod with the one in native.

Thats all I did. And it fixed both problems for me.

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #31 on: March 14, 2007, 11:07:34 AM »
Item_kinds. I KNEW it! Thank you. Now it's just finding the damned bug.

Hist-Man

  • Guest
Re: Recruit from your Prisoners!
« Reply #32 on: March 14, 2007, 04:31:04 PM »
Wow I actually fixed something  :P

Sturmspawn

  • Guest
Re: Recruit from your Prisoners!
« Reply #33 on: March 21, 2007, 02:46:34 PM »
What hist-man is reporting is the same issue that I had, so he [or she] isn't alone.

When I have a chance, I will attempt the same corrections and see if it helps, but this might not happen in a big hurry.

Thanks.

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #34 on: March 21, 2007, 03:02:31 PM »
I think I've figured it out. Unfortunately, I have a large problem whereby I've been given all of three whole days for study leave for my GCSEs, so my time is limited by revision. I'll have a fix up eventualy.

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #35 on: April 16, 2007, 06:30:18 AM »
No I won't, as it seems that even a copy of the Native module system causes the same error. Seriously, I downloaded the Native python source and overwrote every folder in my modules folder, and I stil get this error despite only running Native anywhere on my computer. Looks like unless I can figure out what's wrong my modding career just came to a crashing halt.  :(

Kinsume

  • Guest
Re: Recruit from your Prisoners!
« Reply #36 on: May 31, 2007, 01:16:34 PM »
im curious to know, is it possible to combined different mods, for my own personal use of course... but like there are a few minor mods id like to use with others such as the no horse one and this one, recruit from prisoners.

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #37 on: June 01, 2007, 03:55:36 AM »
You'd need the source code for each of them to combine the code, but yes, it is. The source for this is free for you to use, and I have no idea about the no horses mod. Ask the maker, I guess.

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #38 on: June 23, 2007, 02:58:25 AM »
Warning - this and all my other mods is unsupported until I can fix my installation of Python. The opening bug is caused by that, but just ignore it and the game will run fine.

Nethoras

  • Guest
Re: Recruit from your Prisoners!
« Reply #39 on: August 31, 2007, 09:27:57 AM »
sorry to pester, but I was adding thsi to my live by the sword (for personal use), and it says that it cant find slot_prisoner or something, is there soemthing besides that block in the dialougue that has to be added,

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #40 on: September 01, 2007, 06:02:54 AM »
Yes, I posted it with the rest of the code, on the first page. :lol:

In module_constants:
Beneath "slot_town_import_rate_2" = 48 add "slot_prisoner_agreed = 1"

Balduran

  • Guest
Re: Recruit from your Prisoners!
« Reply #41 on: October 10, 2007, 01:21:06 AM »
Well... About time someone implemented a thing like this :)

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #42 on: October 10, 2007, 10:14:37 AM »
I'll eventually get round to updating this for the new version.

Actually, no I won't, as the new version has it anyway.

KingSerio

  • Guest
Re: Recruit from your Prisoners!
« Reply #43 on: October 24, 2007, 01:12:24 AM »
How i use this ???
Please help, I already download the file.

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #44 on: October 25, 2007, 02:48:12 AM »
If you've got the new version 0.890 or newer, this mod is obsolete. What version are you running?

KingSerio

  • Guest
Re: Recruit from your Prisoners!
« Reply #45 on: October 25, 2007, 05:47:34 PM »
Version 0.808 using the Native Mod (the vanilla mod). What exactly I have to do, which folders i have to put inside where and so on?


Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #46 on: October 27, 2007, 05:50:26 AM »
If it's an exe file in that zipped folder, just run it to the default path.

If it's a folder, you need to extract that folder into Mount&Blade\Modules or whatever your filepath is.

KingSerio

  • Guest
Re: Recruit from your Prisoners!
« Reply #47 on: October 27, 2007, 11:48:53 AM »
Yes Sir!!!
I got it to work and have actually played it for about 4 hours, is a great advance to the game, is so cool to recruit from the prisoners and that makes the game even more realistic. Thanks for all your advices. Great!!!!

And of course, if I want to put it into my own Mod, because when I'm going to run the game, in the first screen before playing the game I have to chose "Recruit from prisoners" (Mod) in order to get that on the game or I can play any Mod and it will be integrated. I know there is a way to use it in any Mod , right? It would be fantastic because I'm hooked to recruiting prisoners!!!
Thanks!!!

Leprechaun

  • Guest
Re: Recruit from your Prisoners!
« Reply #48 on: October 28, 2007, 04:03:09 AM »
Instructions for adding it are on the first page of this thread. Of course, it's redundant in the new version (0.894), as Native has incorporated it.