The 3rd Age

Age of the Firstborn

Age of the Firstborn

A mod that adds two new factions, new CaH-Class, new maps and more

Button for The 3rd AgeButton for The Dwarf HoldsButton for The Elven AllianceButton for Helm's Deep Last HopeButton for GothmogtheOrcButton for BFME+Button for The Four AgesButton for HDR HeadquartersButton for Middle Earth CenterButton for Project Perfect Mod

Become an affiliate!

   

Quick Lists

Top Rated Popular New Updated Last Comments Users

Register and log in to move these advertisements down

Create A Hero AI

Tutorial for Battle for Middle-earth II BFME 2, Battle for Middle-earth II: Rise of the Witch-king ROTWK

Avatar of kazenokoeki

kazenokoeki

Category: Code
Level: Beginner
Created: Saturday December 4, 2010 - 14:35
Updated: Monday March 7, 2022 - 16:48
Views: 6928
Summary: AI for every create a hero power in BFME 2

Rating

Staff says

2.0

Members say

-

Average

2.0/5.0

1 vote

Hey you there,
this is a little INC file that have the "Behavior = AISpecialPowerUpdate", wich is the one that make units to use their power or abillities it is at the bottom of the page in downloads, just use final big to open INI.big and add the file at this direcction " data\ini\object\createahero " and then go to data\ini\object\createahero\createahero.ini and add this

              
Code

#include "createaheroaispecialpower.inc"


under

              
Code

//*******************************************************************************************
//CREATE A HEREO Special Powers
//*******************************************************************************************
#include "CreateAHeroPowers.inc"


and it will see like

              
Code

//*******************************************************************************************
//CREATE A HEREO Special Powers
//*******************************************************************************************
#include "CreateAHeroPowers.inc"
#include "createaheroaispecialpower.inc"


and that's it, now the enemy create a hero will use all of his/her powers to figth you and make the battle more exciting. Now, if you want normal heros use their powers too, find its commandset and copy the command you want it to use, and also copy a similar create a hero power in createaheroaispecialpower.inc and just paste it on the hero file and replace the CAH command with the normal hero command. like this

let's say you want theoden use HeroicCharge, look for it
              
Code

Behavior = AISpecialPowerUpdate HeroicChargeAI
CommandButtonName = Command_SpecialAbilityCreateAHeroHeroicCharge
SpecialPowerAIType = AI_SPECIAL_POWER_CHARGE
End

and just replace "Command_SpecialAbilityCreateAHeroHeroicCharge" with theoden command for HeroicCharge "Command_SpecialAbilityTheodenGloriousCharge"

              
Code

Behavior = AISpecialPowerUpdate HeroicChargeAI
CommandButtonName = Command_SpecialAbilityTheodenGloriousCharge
SpecialPowerAIType = AI_SPECIAL_POWER_CHARGE
End


you can also change the module tag (HeroicChargeAI) if there is any other behavior with the same module tag name.


If you want more information about AI coding, there are two very good articles about it,
one is "In-depth AI Coding" by Sulherokhh for experts, and "AI Coding tutorial" cahik_ for intermediate.


Thank you and enjoy it!

Links / Downloads

 HitsAdded
CreateAHeroAISpecialPower.inc974December 4, 2010 - 15:23

Go to top

 

"One site to rule them all, one site to find them,
one site to host them all, and on the network bind them."

 
6:46:06