Jump to content


Photo

BFME 2 Guide: Converting normal powers into Create A Hero Powers


  • Please log in to reply
3 replies to this topic

#1 Solinx

Solinx

    .

  • Undead
  • 3,101 posts
  • Location:The Netherlands
  • Projects:Real Life
  • Division:Revora
  • Job:Retired Leader / Manager

Posted 22 September 2006 - 05:12 PM

Link to oposite guide: BFME 2 Guide: Converting Create A Hero power to normal power

15 Jan 2007: Updated for RotWK

Note: This guide was tested with BFME 2 patch 1.04. With patch 1.05 of the official game, the leadership system was changed. The effects haven't been tested yet.
This doesn't apply to RotWK v1.0 as the expansion is based on patch 1.04 of the original game.


-----------------------------------------------------------------

Written by Solinx for The 3rd Age community
====================================

ok, the previous guide was to change CaH power into a Normal power, useable for normal heroes. This time it's about changing a normal power into a CaH power.

Written with ini files from Battle for Middle Earth 2 patch 1.04


--- Important! ---

First off, I'll tell you that not all powers will be so easy to port as the example I am going to use.

The following two power types are thougher to convert:

- Weapon toggle
- Special weapons/attacks

Sadly these two include many abilities. It quite likely possible to convert the weapontoggle, but I'm not entirely sure if the second is possible (without removing other abilities that is). When I know more, this guide will be updated.

Stealth is also a bit different, but that one requires only a small addition and will be covert in this guide.


--- Assumptions ---

I've assumed that you...
...have read the beginner tutorials, which explain the basics of modding.
...have some knowledge about how normal powers work. (Useful, but not really required if you follow the steps.)
...know how to change strings on buttons.


--- Requirements: ---

Ok, now you know that, let's start with the guide. As I said, I'm keeping this simple. We will start by converting the 'Outlaw Leadership' of Eomer into a level 1 'Men of the West' CaH power.
After we've done that, we'll change it into a 3rd level power, that can only be selected after getting the standard level 1 CaH leadership.

The files you need to copy code from are:

...\data\ini\commandbutton.ini
...\data\ini\specialpower.ini
...\data\ini\object\goodfaction\units\men\eomer.ini

You will need to add code to:

...\data\ini\commandbutton.ini
...\data\ini\object\createahero\createaheropowers.inc
...\data\ini\createaherospecialpowers.ini
...\data\ini\createaheroupgrades.inc
...\data\ini\attributemodifier.ini

Optional, in case of a stealth power:

...\data\ini\object\createahero\createahero.ini

Weapon toggles and special powers/attacks require some additional coding in other files. Perhaps I will make an advanced guide on them when I know more about them.


--- Lets get started ---

Before we do anything, we need to know what kind of power we are working with.

Open Eomer.ini and search for "PASSIVE OUTLAW LEADERSHIP".
In our case, the name is a dead giveaway, but other powers aren't always that predictable.

You will find the following code:
;;; PASSIVE OUTLAW LEADERSHIP;;;
	Behavior = UnpauseSpecialPowerUpgrade ModuleTag_TheodenLeadership2
		SpecialPowerTemplate = SpecialAbilityFakeLeadership2
		TriggeredBy = Upgrade_EomerOutlawLeader
	End
	Behavior = SpecialPowerModule ModuleTag_TheodenLeadershipUpdate2
		SpecialPowerTemplate	  = SpecialAbilityFakeLeadership2
		UpdateModuleStartsAttack  = No
		StartsPaused = Yes
	End	
	Behavior = AttributeModifierAuraUpdate ModuleTag_Leadership2
		StartsActive	= No;If no, requires upgrade to turn on.
		BonusName		= EomerPassiveOutlawLeadership
		TriggeredBy		= Upgrade_EomerOutlawLeader
		RefreshDelay	= 2000
		Range			= 200
		AllowSelf		= Yes
		ObjectFilter	= ANY +CAVALRY +INFANTRY -STRUCTURE -BASE_FOUNDATION -DOZER
	End

As you can see, this is a plain aura ability. It generates cash for each kill.


--- Copying the core of the ability ---

Copy the code from Eomer.ini and open createaheropowers.inc
Scroll to the bottom of that file and paste the code you copied from Eomer.ini into createaheropowers.inc

We can't use an exact copy of the power, because we need to make sure it's unique.

After my changes, the code looks like this:
;;; PASSIVE OUTLAW LEADERSHIP;;;
	Behavior = UnpauseSpecialPowerUpgrade ModuleTag_CaHOutlawLeadershipEnabler
		SpecialPowerTemplate = SpecialAbilityCaHFakeLeadership2
		TriggeredBy = Upgrade_CaHOutlawLeader
	End
	Behavior = SpecialPowerModule ModuleTag_CaHOutlawLeadershipUpdate
		SpecialPowerTemplate	  = SpecialAbilityCaHFakeLeadership2
		UpdateModuleStartsAttack  = No
		StartsPaused = Yes
	End	
	Behavior = AttributeModifierAuraUpdate ModuleTag_CaHOutlawLeadership
		StartsActive	= No;If no, requires upgrade to turn on.
		BonusName		= EomerPassiveOutlawLeadership
		TriggeredBy		= Upgrade_CaHOutlawLeader
		RefreshDelay	= 2000
		Range			= 200
		AllowSelf		= Yes
		ObjectFilter	= ANY +CAVALRY +INFANTRY -STRUCTURE -BASE_FOUNDATION -DOZER
	End
If you compare the two code blocks, you will notice that I changed the ModuleTag, SpecialPowerTemplate and the TriggeredBy values.
In case you want the aura to have different attributes modifiers, you naturally can create your own. But that is outside the scope of this guide.


--- The upgrade ---

Simple stuff first. We created a new upgrade, named "Upgrade_CaHOutlawLeader". There is no such upgrade defined yet, so we need to do that.

Open createaheroupgrades.inc and add the following code:
Upgrade Upgrade_CaHOutlawLeader
  Type			  = OBJECT
End
This identifies Upgrade_CaHOutlawLeader as an upgrade for the CaH object.

That's it for the upgrade.


--- The SpecialPowerTemplate ---

Just as simple, open createaherospecialpowers.ini and add the following code:
;------------------------------------------------------------------------------
; For the CaH version of Eomer's passive leadership abilities
SpecialPower SpecialAbilityCaHFakeLeadership2
  Enum				= SPECIAL_FAKE_LEADERSHIP_BUTTON
  ReloadTime		  = 1; in milliseconds
End
Now we've also defined the special power.

Note: When adding a lot of powers to one CaH class, try not to use the same Enum. The game won't allow normal objects to have any Enum twice in all their abilities. CaH may be different, but it is unlikely.


--- CommandButton.ini ---

The next step is to open up CommandButton.ini and find this code:
CommandButton Command_RohanEomerOutlawLeadership
  Command				 = SPECIAL_POWER
  SpecialPower			= SpecialAbilityFakeLeadership2
  Options		  = NONPRESSABLE
  TextLabel			   = CONTROLBAR:OutlawLeadership
  ButtonImage			 = UCCommon_Pillage
  RadiusCursorType		= TrainingRadiusCursor
  ButtonBorderType		= ACTION
  DescriptLabel		   = CONTROLBAR:ToolTipOutlawLeadership
  InPalantir		  = Yes
End

Copy it and paste it at the bottom of the file.
Just copying isn't enough. For a start, all buttons must have an unique name. Change it into Command_CreateAHero_HotW_OutlawLeadership.
The specialpower name is used to link the button to the bits of code in the object. Clearly it needs to be the same as in createaheropowers.inc.
You'll also need to change the TextLabel and DescriptLabel, I've made the assumption you know how to do that.

So far, this has been similar to duplicating a normal power. Now we come at the new code that is only used for the CaH. For now, just use this code:
	CreateAHeroUIAllowableUpgrades		= Upgrade_CreateAHero_ClassHeroOfTheWest
	CreateAHeroUIMinimumLevel			= 1
	CreateAHeroUIPrerequisiteButtonName	= None
The combined result of the button will be:
CommandButton Command_CreateAHero_HotW_OutlawLeadership
  Command				 = SPECIAL_POWER
  SpecialPower			= SpecialAbilityCaHFakeLeadership2
  Options		  = NONPRESSABLE
  TextLabel			   = CONTROLBAR:CreateAHeroOutlawLeadership
  ButtonImage			 = UCCommon_Pillage
  RadiusCursorType		= TrainingRadiusCursor
  ButtonBorderType		= ACTION
  DescriptLabel		   = CONTROLBAR:ToolTipCreateAHeroOutlawLeadership
  InPalantir		  = Yes

  CreateAHeroUIAllowableUpgrades	= Upgrade_CreateAHero_ClassHeroOfTheWest
  CreateAHeroUIMinimumLevel		= 1
  CreateAHeroUIPrerequisiteButtonName	= None
End
That's it. You now have changed this simple leadership from a normal power to a level 1 HotW power. No need to do anything with experience ini's, since the last three lines of code, together with hardcoded stuff, make sure your CaH gets this power when he should.

UPDATE:
With the release of RotWK, the commandbuttons of the CaH's have a 4th line: The costs of the power.

Add the following line to the bottom, just above the 'end' of course, of each commandbutton:

CreateAHeroUICostIfSelected = 500
You can replace 500 with the costs you find appropiate for the power, or you can use one of the variables that EA used with their powers. You can find the values of these variables in ...data\ini\gamedata.ini



--- Making a chain with the normal level 1 CaH leadership ---

With the three unique lines from the CommandButton.ini, we can also make a chain of abilities, like the dwarven Battlerage, which has 4 levels.

To make our new CaH an upgrade of the normal level 1 CaH leadership, we need to change the three lines into this:
CreateAHeroUIAllowableUpgrades	= Upgrade_CreateAHero_ClassHeroOfTheWest
  CreateAHeroUIMinimumLevel		= 3
  CreateAHeroUIPrerequisiteButtonName	= Command_CreateAHeroLeadership

As you can see, the first line stayed the same. It selects the main classes that are allowed to get this ability. You can add more than one class.
These are the possible inputs:
* Upgrade_CreateAHero_ClassArcher
* Upgrade_CreateAHero_ClassHeroOfTheWest
* Upgrade_CreateAHero_ClassIstariWizard
* Upgrade_CreateAHero_ClassDwarf
* Upgrade_CreateAHero_ClassCorruptedMan
* Upgrade_CreateAHero_ClassServantsOfSauron

It's pretty obvious which classes are which. :lol:

The second line sets the minimum level that must be attained before you can select the power in the CaH creation menu.
Normal inputs are 1, 3, 7 or 10
It's quite likely that other inputs also work, but I never tried them.

The last line is the button name of the ability that our own ability is going to succeed.
If you search for "Command_CreateAHeroLeadership" in commandbutton.ini, you will find that this is the name of the normal level 1 CaH leadership.
When you create a chain of abilities, make sure that the level progression is possible.
First the abilities with the lowest minimum level requirement, then upward.
Also make sure that the chain isn't broken half way, because a class isn't allowed to get the middle ability.


--- Making our leadership an upgrade instead of a replacement ---

Ok. With this code our outlaw leadership succeeds the standard leadership. However, the effect of the normal leadership will vanish as soon as the hero gets our ability.
To make our leadership a true upgrade, instead of a replacement, we need to modify attributemodifier.ini

Open the attributemodifier.ini.
Next we need to search for EomerPassiveOutlawLeadership. That will find you:
ModifierList EomerPassiveOutlawLeadership
	Category = WEAPON
	Modifier = BOUNTY_PERCENTAGE 100.0%	// Percentage of victim bounty value to build granted to slaying member's player.
	Duration = 2500						// lasts for 2.5 seconds
End
Copy and paste this code to the bottom of the file.

The standard level 1 CaH leadership is in fact a generic leadership. Search for GenericHeroLeadership and you will find:
ModifierList GenericHeroLeadership
	Category					= LEADERSHIP
	Modifier					= EXPERIENCE 200%
	Modifier					= ARMOR 50%
	Modifier					= DAMAGE_MULT 150%		// Multiplicitive.  Damage multiplied by this, will compound in multiple bonuses
	Duration					= 3000
	FX							= FX_GenericLeadership
	ReplaceInCategoryIfLongest	= Yes
	IgnoreIfAnticategoryActive	= Yes
End
Now we need to combine these two leaderships to create a new leadership.

I suggest this combination:
ModifierList CreateaHero_HotW_PassiveOutlawLeadership
	Category = WEAPON
	Modifier = BOUNTY_PERCENTAGE 100.0%	// Percentage of victim bounty value to build granted to slaying member's player.
	Modifier = EXPERIENCE 200%
	Modifier = ARMOR 50%
	Modifier = DAMAGE_MULT 150%		// Multiplicitive.  Damage multiplied by this, will compound in multiple bonuses
	Duration = 2500						// lasts for 2.5 seconds
	FX	   = FX_GenericLeadership
End
That makes sure the leadership can't replace or be replaced (ie. the leadership bonus stacks with a normal leadership), nor can it be dispelled by another aura.
Also, take notice of the new name. All modifiers should be unique, so don't forget to change the name.

Another combination:
ModifierList CreateaHero_HotW_PassiveOutlawLeadership
	Category					= LEADERSHIP
	Modifier					= EXPERIENCE 200%
	Modifier					= ARMOR 50%
	Modifier					= DAMAGE_MULT 150%		// Multiplicitive.  Damage multiplied by this, will compound in multiple bonuses
	Modifier 					= BOUNTY_PERCENTAGE 100.0%	// Percentage of victim bounty value to build granted to slaying member's player.
	Duration					= 3000
	FX						= FX_GenericLeadership
	ReplaceInCategoryIfLongest	= Yes
	IgnoreIfAnticategoryActive	= Yes
End
Here the upgraded leadership is still replaceable, can replace another or can dispelled by another aura.
It's only difference is the name, the addition of the bounty modifier and the duration.

last thing to do is to change the aura name in our aura module, so open createaheropowers.inc.
Search for ModuleTag_CaHOutlawLeadership, the name of our aura module.
And changing the BonusName into CreateaHero_HotW_PassiveOutlawLeadership.


--- Finished ---

That's it. For the Men of the West CaH class, our new leadership should be listed on the same row as the standard CaH power.
You can only select it at level 3 and when your hero get's it in-game, it will include the effects of the normal leadership in addition to the bounty leadership.


--- Exceptions ---

As I said before, this is a simple example and there are quite a few exceptions to the rule.
(For now) I won't go into weaponsets or abilities based on special weapons. These require additional editing in a few other parts of the CaH files.

For the stealth exception we need to make an additional edit to createahero.ini.

As a start, find "Create-A-Hero Stealth And Camouflage Updates".
All stealth powers come with either a stealth of invisibility module.
As you can see, all these modules are listed in this ini file, instead of in createaheropowers.inc.
The other two behaviours (Enable & Unpause) remain in that file.

You'll also notice that the modules all have RequiredUpgrades and ForbiddenUpgrades.

In the required upgrades you put the class to get the upgrade.
This can only be one class! If you want multiple classes to have the same stealth ability, you will have to make multiple modules.
In addition you also place the same upgrade as named in the createaheropowers.inc.

In the ForbiddenUpgrades, you need to place "Upgrade_CreateAHeroMapMode", this is to prevent your hero from activating his stealth ability in the CaH creation menu.
Also, in case you are making a chain of stealth modes, you can add the upgrade names of all other stealth abilities in the chain here.

Update:
Among the additional parts for stealth abilities, you can also find an additional piece of code for the disguise ability. Some people had troubles modding that ability. Credit to Cahik for solving their problems.


Solinx

Edited by Solinx, 21 January 2007 - 12:11 AM.

Posted Image

"An expert is a man who has made all the mistakes which can be made in a very narrow field." - Niels Bohr


#2 theczar

theczar
  • Members
  • 20 posts

Posted 18 March 2007 - 01:48 AM

idunno why nobody is praising you for this tutorial,but i think its the best one, in this section, we need more tutorials like this,

czar

#3 Solinx

Solinx

    .

  • Undead
  • 3,101 posts
  • Location:The Netherlands
  • Projects:Real Life
  • Division:Revora
  • Job:Retired Leader / Manager

Posted 18 March 2007 - 03:41 AM

Thanks :xd:

Solinx
Posted Image

"An expert is a man who has made all the mistakes which can be made in a very narrow field." - Niels Bohr


#4 Guest_Luke_*

Guest_Luke_*
  • Guests

Posted 17 November 2008 - 08:56 PM

Really good tutorial man!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users