Training skill on ordinary soldiers?

Users who are viewing this thread

magitek

Recruit
I did a search for this, but didn't find anything. Is there any way to have an ordinary soldier's training skill actually provide XP to other soldiers? I've got a soldier type modded into my current game that has the skill (and is level 50 itself), and my nightly training XP does not change regardless of how many of these soldiers I have.
 
GetAssista said:
trainer script goes through only hero troops in your party. Modify it

But that requires actual effort on my part  :cry:

j/k, thanks for the info; I'll give it a shot.
 
As long  as I know, there's no trainer script for main party on native. The daily training XP is hard-coded, and it counts heroes skill only. But of course we can make a daily trigger to add more training XP that count only non heroes trainer skill.
 
What dunde said.
Code:
(24, [
(try_for_parties, ":party_no"),
  (party_is_active, ":party_no"),
  (party_get_num_companion_stacks, ":cap", ":party_no"),
  (gt, ":cap", 0),
  (str_store_party_name, s0, ":party_no"), #not necessary
  (try_for_range, ":outer_stack", 0, ":cap"),
    (party_stack_get_troop_id, ":troop", ":party_no", ":outer_stack"),
    (gt, ":troop", 0),
    (neg|is_between, ":troop", companions_begin, companions_end),
    (party_stack_get_size, ":size", ":party_no", ":outer_stack"),
    (party_stack_get_num_wounded, ":wounded", ":party_no", ":outer_stack"),
    (val_sub, ":size", ":wounded"),
    (gt, ":size", 0),
    (troop_get_skill_level, ":xp", "skl_trainer", ":troop"),
    (gt, ":xp", 0),
    (assign, ":total_xp", 0), #just debugging
    (try_begin), #too lazy to type out all the xp levels - see module_skills and parse accordingly
    (try_end), #if you leave this as-is, regular troops will only give xp=trainer level
    (val_mul, ":xp", ":size"),
    (store_troop_level, ":level", ":troop"),
    (try_for_range, ":inner_stack", 0, ":cap"),
      (neq, ":inner_stack", ":outer_stack"),
      (party_stack_get_troop_id, ":troop_no", ":party_no", ":inner_stack"),
      (store_troop_level, ":lvl", ":troop_no"),
      (gt, ":level", ":lvl"),
      (party_add_xp_to_stack, ":party_no", ":inner_stack", ":xp"),
      (val_add, ":total_xp", ":xp"), #accumulates xp total for each trainer stack
    (try_end),
   #this section displays how much xp
    (gt, ":total_xp", 0),
    (assign, reg1, ":size"),
    (try_begin),
      (eq, ":size", 1),
      (str_store_troop_name, s1, ":troop"),
      (assign, reg1, 0),
    (else_try),
      (assign, reg1, ":size"),
      (str_store_troop_name_plural, s1, ":troop"),
    (try_end),
    (assign, reg0, ":total_xp"),
    (display_message, "@Total experience gained by {s0} through {reg1?{reg1} {s1}:{s1}}'s training: {reg0}"),
    #which isn't really necessary
  (try_end),
(try_end),
]),
This basically goes through all the parties on the map, check for stacks of troops with trainer skills, and apply whatever arbitrary bonus per trainer skill * their stack size to the other members of the party. This won't actually upgrade them - for kingdom hero parties another trigger gives bonus xp to their party. You could add (party_upgrade_with_xp, ":party_no", 1, 0), to the end, which would actually make them troop to level up (in towns and such). Alternatively, you can make a check that the party isn't lead by a hero (so as to not take the choice from the player) before upgrading it arbitrarily in that way.
 
(party_add_xp_to_stack, ":party_no", ":inner_stack", ":mad:p"),

So the operation does work now at Warband? It's great. I did use the operation on MnB 1.011 and it didn't work for parties outside of main party. One more good reason to do porting :smile:
 
Haven't tested outside of the main party, but it does precisely what it says - adds xp to a stack, but doesn't upgrade them. You may have forgotten to use (party_upgrade_with_xp, ":party_no", 1, 0), in 1.011.
 
Ah, may be I forgot. I used party_upgrade_xp instead at the last, but never tried to use both with 1 xp for  party_upgrade_xp.

http://forums.taleworlds.com/index.php/topic,88874.msg2293853.html#msg2293853

BTW, I don't know why my topic there's moved to Pioneer. It's used to be my thread at Forge to discuss some ideas and ask things I didn't know yet, when I was a recruit.
 
Back
Top Bottom