Author Topic: [Kit] Custom Commander kit. Control the NPCs to fight in battles instead of the player  (Read 12982 times)

0 Members and 1 Guest are viewing this topic.

rubik

  • Squire
  • *
    • View Profile
  • Faction: Vaegir
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):
(click to show/hide)

« Last Edit: July 17, 2012, 03:24:37 PM by Caba`drin »

Keedo420

  • Knight at Arms
  • *
  • All glory to the Hypnotoad!!
    • View Profile
    • All glory to the Hypnotoad!
  • Faction: Bandit
I will definitely be adding this to my mod. :mrgreen:

rubik

  • Squire
  • *
    • View Profile
  • Faction: Vaegir
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:
Quote
        (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:
Quote
        (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),
« Last Edit: February 10, 2009, 09:50:30 PM by rubik »

jik

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

bravesirknight

  • Knight
  • *
    • View Profile
  • Faction: Vaegir
Really nice feature for mods. :D

Keedo420

  • Knight at Arms
  • *
  • All glory to the Hypnotoad!!
    • View Profile
    • All glory to the Hypnotoad!
  • Faction: Bandit
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).

The Real Slate

  • Master Knight
  • *
  • When you conquer fear of death, you start to live.
    • Steam - therealslate
    • View Profile
    • Insanity's Finest Discord
  • Faction: Neutral
  • MP nick: Sir Slate
  • M&BWBWF&S
I like that....too bad I cant test it out cuz im not at home for the time being  :(

fisheye

  • Back in Black
  • Grandmaster Knight
  • *
    • View Profile
  • Faction: Neutral
Awesome!  :D

Kleidophoros

  • Marquis
  • *
    • View Profile
  • Faction: Rhodok
  • MP nick: CoR_Kleid_of_Veluca
  • M&BWBVC
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?
See this? This is my boomstick!

Corvus

  • A lovestruck Romeo
  • Master Knight
  • *
    • View Profile
  • Faction: Neutral
  • M&B
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.
Gculk: I'm a crazy gay Satanistic Nazi who is interested in S&M. How about you?
Eino: I'm Catholic  :lol:
Leprechaun: What's the difference? :P
Buxton: Nazi's don't fiddle with kids, only minorities
Like rising moons on the eve of harvest!

MISHO

  • Knight at Arms
  • *
  • Permanently Banned
  • Im the one whos gonna beat your ass, hows it goin?
    • View Profile
  • Faction: Neutral
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
  • *
  • Down Under
    • View Profile
  • Faction: Neutral
Mate, read the opening post....

The kit was made by rubik:

Quote
This feature is from my MOD - Everyone Can Be The Leader. 
and
Quote
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.

Quote
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... :)

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? :)

MISHO

  • Knight at Arms
  • *
  • Permanently Banned
  • Im the one whos gonna beat your ass, hows it goin?
    • View Profile
  • Faction: Neutral
Damn! i am stupid :)
Sorry for wasting your time, but anyway i already found out whos it is :)

oolonglgx

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Neutral
Great work! :)

Kleidophoros

  • Marquis
  • *
    • View Profile
  • Faction: Rhodok
  • MP nick: CoR_Kleid_of_Veluca
  • M&BWBVC
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?
See this? This is my boomstick!