Hiring village recruits as 'hero' companions?

Users who are viewing this thread

AngusH

Recruit
Anyone done this via scripting? I could have sworn I saw a thread on it, but I'll be damned if I can track it down now.
 
Assuming you got a bit of experience in scripting:

1. Make a new NPC, flag him as a hero, rest is personal taste, call him trp_gary for example
2. Assign him to the first troop tier of a faction in module_scripts

Code:
# Cultures:
      (faction_set_slot, "fac_culture_3", slot_faction_tier_1_troop, "trp_gary"),
      (faction_set_slot, "fac_culture_3", slot_faction_tier_2_troop, "trp_khergit_skirmisher"),
      (faction_set_slot, "fac_culture_3", slot_faction_tier_3_troop, "trp_khergit_horseman"),
      (faction_set_slot, "fac_culture_3", slot_faction_tier_4_troop, "trp_khergit_horse_archer"),
      (faction_set_slot, "fac_culture_3", slot_faction_tier_5_troop, "trp_khergit_veteran_horse_archer"),

3. Now you will be able to recruit Gary from khergit villages!

Other: EDIT

1. Make a new NPC, flag him as a hero, rest is personal taste
2. Make a sixth tier for the faction of your choice in module_scripts, script_game_start, example for the Rhodoks:

Code:
# Cultures:
      (faction_set_slot, "fac_culture_5", slot_faction_tier_1_troop, "trp_rhodok_tribesman"),
      (faction_set_slot, "fac_culture_5", slot_faction_tier_2_troop, "trp_rhodok_spearman"),
      (faction_set_slot, "fac_culture_5", slot_faction_tier_3_troop, "trp_rhodok_trained_spearman"),
      (faction_set_slot, "fac_culture_5", slot_faction_tier_4_troop, "trp_rhodok_veteran_spearman"),
      (faction_set_slot, "fac_culture_5", slot_faction_tier_5_troop, "trp_rhodok_sergeant"),
      (faction_set_slot, "fac_culture_5", slot_faction_tier_6_troop, "trp_your_troop/hero"),

To let the code check if one's available: (no need to change if you're going to add one to all factions)...

Code:
  #script_village_recruit_volunteers_recruit
  # INPUT: none
  # OUTPUT: none
  ("village_recruit_volunteers_recruit",
     [(try_begin),
	(eq,slot_center_original_faction,"fac_culture_(number_of_faction_with_sixth_troop),
	(assign,":volunteer_troop","6),
     (try_end),
     (party_get_slot, ":volunteer_troop", "$current_town", slot_center_volunteer_troop_type),
     (party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
     (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
     (val_min, ":volunteer_amount", ":free_capacity"),
     (store_troop_gold, ":gold", "trp_player"),
     (store_div, ":gold_capacity", ":gold", 10),#10 denars per man
     (val_min, ":volunteer_amount", ":gold_capacity"),
     (party_add_members, "p_main_party", ":volunteer_troop", ":volunteer_amount"),
     (try_begin),
                (eq,":volunteer_troop",6),
                (assign,":volunteer_troop",1),
     (try_end),
     (party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
     (store_mul, ":cost", ":volunteer_amount", 10),#10 denars per man
     (troop_remove_gold, "trp_player", ":cost"),
     ]),

3. Should work, but if it doesn't, tell me.
 
Interesting. 

I was about to post a question on the culture stuff.  So I take it that this is the reason?  The troops they can hire?
 
OK, so that would make every troop (of tier 1) hired a hero. Thanks very much!

But what if, say, you wanted to have the option to recruit troops normally, but have also have the ability to recruit a 'companion' (ie. custom hero) from each village? I know it would be a matter of creating the menu option and then assigning the code to "add" the npc, I'm just not sure how exactly to add an npc with code. :wink:
 
AngusH said:
OK, so that would make every troop (of tier 1) hired a hero. Thanks very much!

But what if, say, you wanted to have the option to recruit troops normally, but have also have the ability to recruit a 'companion' (ie. custom hero) from each village? I know it would be a matter of creating the menu option and then assigning the code to "add" the npc, I'm just not sure how exactly to add an npc with code. :wink:

Edited the post.

And: troop NPC's are the same as hero NPC's, except for that they have the hero flag. Makes them use up one slot each, lets you change their stats, inventory, etc. Same approach.
 
you can do a random availability check, then test if there are any "free" at the moment.  Not sure what would mark them as free, though I think only the player can hire them.  The rest are lords.
 
jik said:
you can do a random availability check, then test if there are any "free" at the moment.  Not sure what would mark them as free, though I think only the player can hire them.  The rest are lords.

? (yes, that ain't much)
 
Say you wanted it so that there are wandering heroes in your mod.  Or the posibility that 1 amung the new recruits is destined for fame(a hero).  You stop by a village and talk with the elder about recruiting.  He says that there are 5 available, and you hire them.  In a new screen you can put in some text like:

of these men, one seems to stand out.  Something in the way he holds his weapon or in his stance.  A hint of something you cannot learn, but are born with...

Some crap like that.  Maybe have a quick dialog in which the new hero then states his skills (healing, weapons, tracking, etc.).  Bang, new companion, captain, hero, etc.

I will be doing something similar with my mod, though it won't be from recruiting, it will be after a battle.
 
killkhergit said:
To let the code check if one's available: (no need to change if you're going to add one to all factions)...

Code:
  #script_village_recruit_volunteers_recruit
  # INPUT: none
  # OUTPUT: none
  ("village_recruit_volunteers_recruit",
     [(try_begin),
	(eq,slot_center_original_faction,"fac_culture_(number_of_faction_with_sixth_troop),
	(assign,":volunteer_troop","6),
     (try_end),
     (party_get_slot, ":volunteer_troop", "$current_town", slot_center_volunteer_troop_type),
     (party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
     (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
     (val_min, ":volunteer_amount", ":free_capacity"),
     (store_troop_gold, ":gold", "trp_player"),
     (store_div, ":gold_capacity", ":gold", 10),#10 denars per man
     (val_min, ":volunteer_amount", ":gold_capacity"),
     (party_add_members, "p_main_party", ":volunteer_troop", ":volunteer_amount"),
     (try_begin),
                (eq,":volunteer_troop",6),
                (assign,":volunteer_troop",1),
     (try_end),
     (party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
     (store_mul, ":cost", ":volunteer_amount", 10),#10 denars per man
     (troop_remove_gold, "trp_player", ":cost"),
     ]),

3. Should work, but if it doesn't, tell me.

(assign,":volunteer_troop","6), should be (assign,":volunteer_troop",6),

Outside of that, it looks fine. However, when I compile it's telling me that 'slot_faction_tier_6_troop' is not defined. I can see that it is though, to quote straight from my module_scripts.py file:

Code:
      (faction_set_slot, "fac_culture_5", slot_faction_tier_6_troop, "trp_wa_recruit"),

Strange. Anyone got any ideas why it thinks that variable is undefined?  :???:
 
you'll also need to define the slot in module_constants. If the compiler is throwing up an error it's because it can't find it there. So the slot nr isn't defined making the slot_etc mean nothing.

I've been watching this thread but I can't help but wonder if changing the faction 1 troop in this way won't affect other things as well, like recruitment for hero parties for instance.
 
MartinF said:
you'll also need to define the slot in module_constants. If the compiler is throwing up an error it's because it can't find it there. So the slot nr isn't defined making the slot_etc mean nothing.

I've been watching this thread but I can't help but wonder if changing the faction 1 troop in this way won't affect other things as well, like recruitment for hero parties for instance.

First part: true, forgot about the constant slot you need to add.

Second: the only thing I can think of is that you can't upgrade your new guy right away, but it's an easy job to change that in module_troops.

*ping* And yes, all khergit tribesmen (first example) will be changed to Gary. But a Lord doesn't upgrade his troops I believe. If he does, make the upgrade_troops thingy correct again.
 
upgrading is done by the game engine I think, when a troop gets enough xp, it upgrades. At least I've seen this happen to units in my patrol script so I assume it works that way.

What I meant was recruitment.
Just had a look through the script. #script_spawn_bandits uses the faction 1 troop for spawning deserters.

Also, the quest qst_raise_troops seems to do something with tier one troops, but that didn't make much sense to me.

Anyway apart from your deserter parties getting messed up, it seems you're pretty safe to use that method, although I think it lacks elegance. The second one is much better.
 
Also, the quest qst_raise_troops seems to do something with tier one troops, but that didn't make much sense to me.

You always get a few fresh recruits (tier 1!) from the lord who needs new men. Making it possible for that guy to be upgraded to ANY troop of his tier will fix things up.

What I meant was recruitment.
Just had a look through the script. #script_spawn_bandits uses the faction 1 troop for spawning deserters.

The script randomly makes tier 1 troops, adds random experience and spawns them. No problem if you (again) get the upgrading fixed.

Anyway apart from your deserter parties getting messed up, it seems you're pretty safe to use that method, although I think it lacks elegance. The second one is much better.

We have an agreement!
 
killkhergit, I think you are missing the point.

If you change a tier_1 troop to be a hero, then when a lord goes to raise his own troops what happens then?  Heroes need to be unique.  This may cause them to recruit a number of that hero.  Same goes with bandits/deserters/etc.  If you change their tier 1 troop type, then it could affect how there are spawned.  If you change one of the native tier trees, expect it to affect where ever these tier trees are used.

 
no, he wasn't. That's what I thought would happen to but if you search the whole module system for the tier 1 troop, it only gets used in those places I mentioned. So for the quest and for the deserters.

 
jik said:
killkhergit, I think you are missing the point.

If you change a tier_1 troop to be a hero, then when a lord goes to raise his own troops what happens then?  Heroes need to be unique.  This may cause them to recruit a number of that hero.  Same goes with bandits/deserters/etc.  If you change their tier 1 troop type, then it could affect how there are spawned.  If you change one of the native tier trees, expect it to affect where ever these tier trees are used.

Anyway apart from your deserter parties getting messed up, it seems you're pretty safe to use that method, although I think it lacks elegance. The second one is much better.
We have an agreement!

:grin:
 
Back
Top Bottom