BatPio edited this page Jan 4, 2017 · 8 revisions

AI Mod

Most of AI script files don't use native functions, it's mean that they could be modified, recompiled and reused as mods.

Preparing UDK project

  1. Copy Development/Src/MMH7AIMod/Classes/* files to Your UDK project.
  2. Edit file [UDK Project]\UDKGame\Config\DefaultEngine.ini in Your UDK project. Add to section [UnrealEd.EditorEngine] entry +EditPackages=MMH7AIMod

MMH7AIMod Classes

Currently MMH7AIMod is proof-of-concept of possibility to modding AI scripts. It consists of few classes that makes possible to inject Your AI classes into game. These files should not change anything in scripts behavior.

  • AIModObjectsBuilder - creates Combat AI and AI Sensors
  • AIModAdventureAiBuilder.uc - modified copy of H7AdventureController, it's used to inject AIModH7AiAdventureMap into game. Don't modify this class, it's only used method is InitAdventureAI.
  • AIModH7AiCombatMap - copy of H7AiCombatMap.
  • AIModH7AiAdventureMap.uc - modified copy of H7AiAdventureMap

Simple/Dumb AI mod example

Let's make simple mod that changes behavior of scripts.

  1. First copy "H7AiSensorGoodTimeToWait.uc" from "MMH7Game" to "MMH7AIMod"
  2. Rename file and class inside to "MyH7AiSensorGoodTimeToWait".
  3. Open file "MyH7AiSensorGoodTimeToWait.uc" and change implementation of "IsGoodTimeToWait" method to `return true;'
  4. Open file "AIModObjectsBuilder.uc" and change mSensors.InsertItem(ACS_GoodTimeToWait, new class 'H7AiSensorGoodTimeToWait' ); to mSensors.InsertItem(ACS_GoodTimeToWait, new class 'MyH7AiSensorGoodTimeToWait' );
  5. Install and run game with mod.

Now enemy creature will always start their round from waiting.

Installing mod

  1. Recompile script using "UnrealFrontend".
  2. Copy "UDKGame\Script\MMH7AIMod.u" to game directory "Might and Magic Heroes VII\MMH7Game\CookedPC"
  3. Open file "[My Documents]\My Games\Might & Magic Heroes VII\MMH7Game\ConfigMMH7Engine.ini". Add to section [Engine.ScriptPackages] entry NativePackages=MMH7AIMod

Running mod

  1. Run game and wait until main menu appears.
  2. Inject mod dll "MMH7ScriptsMod.dll" using "Extreme Injector". You can get "MMH7ScriptsMod.dll" by compiling sub-project "MMH7ScriptsMod" or here
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.