OSP Kit SP Custom Commander kit. Control the NPCs to fight in battles instead of the player

rubik

Squire
Best answers
0
Source codes: http://www.mbrepository.com/file.php?id=1109

This feature is from my MOD - Everyone Can Be The Leader. 
http://forums.taleworlds.com/index.php/topic,46178.0.html

As the title suggests, this feature will allow you (the player) to pick a hero (this includes your character of course) to control in battle so that they fare better in combat and can upgrade easily. As a bonus, this means that as long as there is a NPC who is not wounded, you do not have to resort to auto-resolving fights (as anyone who has played M&B knows, auto-resolve is not exactly the best way to finish fights...).

List of changes:

module_game_menus: (20 places)
*the menu options of selecting the commander for any applicable mission
*the menu of selecting a companion as the commander
*check whether the selected commander is wounded for any applicable mission
*judge the sex of the selected commander to decide the picture at the bottom-right in the background
*codes make the player regain hp lost during mission according to the skill level of first aid when the player was not the commander
  (the skill first aid take no effects to the player when the player was not the commander)

module_mission_templates: (9 places)
*check whether the player can join battle when the player was not the commander
*display messages about the changes of npc's proficiency when he/she was selected as the commander

module_scripts: (5 places)
*some changes of battle statistics and mission casualties

module_triggers: (1 place)
*reset the commander as the player when back to the map

P.S: Search (cc) would be more easier to find the changes in files.


Credits:
rubik - Originator
fisheye - Some codes from autoloot(the structure of the menu for selecting commander)
oolonglgx - Suggestions

Screenshots (from older version of my mod, for your information):









 

rubik

Squire
Best answers
0
Keedo420 said:
I will definitely be adding this to my mod. :mrgreen:
When some NPC was selected as the commander, the player will do as a NPC. The most importance is that the player is belongs to the ally side at the moment actuality, not the player's side.

If you used the Troop Ratio Bar, you will need to do some changes there.

Part of original code from the source of Troop Ratio Bar:
        (try_for_agents, ":cur_agent"),
          (agent_is_human, ":cur_agent"),
          (agent_is_alive, ":cur_agent"),
          (agent_get_party_id, ":agent_party", ":cur_agent"),
          (try_begin),
            (eq, ":agent_party", "p_main_party"),
            (val_add, ":player_count", 1),
          (else_try),
            (agent_is_ally, ":cur_agent"),
            (val_add, ":ally_count", 1),
          (else_try),
            (val_add, ":enemy_count", 1),
          (try_end),
        (try_end),
Changes:
        (try_for_agents, ":cur_agent"),
          (agent_is_human, ":cur_agent"),
          (agent_is_alive, ":cur_agent"),
          (agent_get_party_id, ":agent_party", ":cur_agent"),
          (agent_get_troop_id, ":agent_troop_id", ":cur_agent"),
          (try_begin),
            (eq, ":agent_party", "p_main_party"),
            (val_add, ":player_count", 1),
          (else_try),
            (agent_is_ally, ":cur_agent"),
              (try_begin),
                (eq, ":agent_troop_id", "trp_player"),
                (val_add, ":player_count", 1),
              (else_try),
                (val_add, ":ally_count", 1),
              (try_end),

          (else_try),
            (val_add, ":enemy_count", 1),
          (try_end),
        (try_end),
 

jik

Knight
Best answers
0
This is a great idea, especially if you add injuries to your mod.  Can you also decide which NPCs fight?  Can you (in perfect health) stay out of the fight?
 

Keedo420

Knight at Arms
Best answers
0
I am actually using the troop ratio bar, so that little extra code is good to know. I was planning to modify the troop ratio bar though so that it only shows up if the player learns the Sixth Sense ability (which I have yet to implement).
 

Kleidophoros

Marquis
M&BWBVC
Best answers
0
jik said:
This is a great idea, especially if you add injuries to your mod.  Can you also decide which NPCs fight?  Can you (in perfect health) stay out of the fight?
i have been playing Everyone Can be Leader mod of rubik for some time so yes you do get to choose which NPC to fight with and yes you can stay out of the fight even when you are not injured. too bad when you choose an NPC your character doesnt enter the fight. maybe a way to let the AI control your character when you control another NPC?
 

Corvus

Master Knight
M&B
Best answers
0
Wow, this looks fantastic.
And Cleidophoros: the screenies show that when rubik chose to play as rolf, rubik spawned next to him as an npc character... so I guess you char is controlled by the AI.
 

MISHO

Banned
Best answers
0
Well i have 2 things to say! one is, can someone post a tutorial where to put these things so i can use them (like a tutorial) because im using it for my mod!
And the second is a suggestion i have to ask the coder of this thing! so please say who it is from rubik and the other guys!
 

MartinF

Squire
Best answers
0
Mate, read the opening post....

The kit was made by rubik:

This feature is from my MOD - Everyone Can Be The Leader. 
and
Credits:
rubik - Originator
fisheye - Some codes from autoloot(the structure of the menu for selecting commander)
oolonglgx - Suggestions
He lists the number of changes and in which files they were made, so if you want to implement it in your own mod. Get his source files, go through them by searching for 'cc', as he mentions, and then change your own files to reflect those changes.

P.S: Search (cc) would be more easier to find the changes in files.
The explanation is not going to get much better than that I think... :smile:

Rubik, btw, this is a really cool kit. I haven't tried it out yet but it defo makes the game better, especially since the auto resolver is so pathetically incapable.

Now THAT would be a worthy project as well, creating a better auto-resolver than the one in module_scripts! Anyone? :smile:
 

MISHO

Banned
Best answers
0
Damn! i am stupid :smile:
Sorry for wasting your time, but anyway i already found out whos it is :smile:
 

Kleidophoros

Marquis
M&BWBVC
Best answers
0
Corvus said:
Wow, this looks fantastic.
And Cleidophoros: the screenies show that when rubik chose to play as rolf, rubik spawned next to him as an npc character... so I guess you char is controlled by the AI.
hmm i didnt see my character controlled by AI. weird. but maybe i was just injured?
 

Keedo420

Knight at Arms
Best answers
0
Well I finally got around to adding this to my mod. In addition to the modifications to the troop ratio bar, I also had to modify the change commander menu to accomodate the new hireable companions in my mod (such as the tavern keepers) that aren't between companions_begin and companions_end. Other than that it works like a charm! Thanks again for making the source available!  :mrgreen: And I did see myself controlled by the AI once I switched. That was fun.
 

Oldschool

Sergeant at Arms
Best answers
0
This is really cool.  Thanks for sharing it.

When I tested it out, I joined a battle in progress and noticed that I was in control of my allies as well as my own party.  Any pointers as to how to change that back to the default behavior?  I would rather not be in charge of my allies until I become marshal.

(Although it was kind of fun leading 100 hardened Vaegirs as level one Ymira on the back of a swaybacked mule.)  :lol:
 

Dudro

Knight at Arms
Best answers
0
Do you think you could do me a favour and for the source codes, just get the things you need to add, rather than the whole thing so I'm not forced to overwrite all my changes to get this awesome tool into my mod, you know?
 

HokieBT

Grandmaster Knight
M&BWB
Best answers
0
I just integrated this into the Star Wars mod and it will be included in the next release, thanks!

FYI - some mods (like mine) use the firearms skill, so I had to add wpt_firearms to a few places in mission_templates, so you may want to include that by default in the future.

Dudro - the easiest way to integrate this is to download a program that compares two text files (like CompareIt or Notepad++) and then compare this code to the original module system.  It will show you the exact places that were modified and then you just have to cut-n-paste it into your mod.  This is what I did and it was very easy.
 

Dudro

Knight at Arms
Best answers
0
Somethin' else now, did I add this improperly, or is anybody else experiencing problems where you end up becoming the NPC if you do 2 fights in a row or get knocked out playing as him.