Author Topic: Better strategy AI on following and besieging for AI lords  (Read 8318 times)

0 Members and 1 Guest are viewing this topic.

rubik

  • Squire
  • *
    • View Profile
  • Faction: Vaegir
Better strategy AI on following and besieging for AI lords
« on: March 06, 2010, 02:46:59 AM »
There is a problem about following and besieging for AI lords. When they see some weak enemy parties nearby, they will interrupt following the marshal or interrupt besieging, and chase these weak enemy parties.

I have written some code to solve this problem.

1. Define slot_party_blind_to_other_parties in module_constants.py. For example:
slot_party_blind_to_other_parties  = 101

2. Open module_scripts.py. 
  2.1 Modify script_game_context_menu_get_buttons like the following.
(click to show/hide)
  2.2. Modify script_game_event_context_menu_button_clicked like the following.
(click to show/hide)

  2.3. Add the following into module_scripts.py.
(click to show/hide)

3. Paste the following into module_simple_triggers.py:

(click to show/hide)


Effect:
1. You can order the lords which are accompanying you to blind to other parties by right click on them and click the 3rd option. This option is a toggle. When enabled, the lord will follow you with blinding to other parties. When disabled, the lord will follow you as normal, he can see other parties and runs toward them or runs away from them. You can click the 4th option make all lords which are accompanying you to blind to other parties, and click the 5th option to make all of them not to blind to other parties.

2. When a lord is following an AI marshal, he blind to other parties except the marshal. When the marshal is sinked into a battle, the lords which are following will cancel the state of blind to other parties, and then join the battle. After the battle is over, the lords will come back to the state of  blind to other parties and continue to follow the marshal wholeheartedly.

3. When a group of AI lords is besieging a castle or town. All of them blind to other parties, they won't attack any enemy parties nearby actively except one of them is attacked by an enemy party.
« Last Edit: March 06, 2010, 06:37:08 AM by rubik »

Cruger

  • Guest
Re: Better strategy AI on following and besieging for AI lords
« Reply #1 on: March 06, 2010, 08:45:57 AM »
This is some really great work. Is it an open source? I might want to use it in my mod.

rubik

  • Squire
  • *
    • View Profile
  • Faction: Vaegir
Re: Better strategy AI on following and besieging for AI lords
« Reply #2 on: March 06, 2010, 11:10:27 AM »
You can use it freely, just remember to give me credit.

LMjai

  • Regular
  • *
    • View Profile
  • Faction: Neutral
Re: Better strategy AI on following and besieging for AI lords
« Reply #3 on: March 11, 2010, 02:36:33 PM »
Can I add this into an already compiled mod? (without having the source)
« Last Edit: March 11, 2010, 04:28:21 PM by LMjai »
~~~~~~~  Don't feed the troll ~~~~~~~
and try not to be the troll yourself...

Twan

  • Sergeant Knight
  • *
    • View Profile
    • SoD Auxiliarii Variant
  • Faction: Neutral
Re: Better strategy AI on following and besieging for AI lords
« Reply #4 on: March 13, 2010, 09:25:26 AM »
It's not easy at all.

If you absolutely want to do so, you would need to
 1. copy native module system
 2. correctly add the new code to native module system and compile
 3. use a text comparator to find what was changed in native text files
 4. copy the changes
 5. replace the good scripts text and add the simple trigger text in the other module
 6. (may work or not ; will also probably break saves)