Welcome to the "Extended Version"
This part of the guide is based on something I wanted to have in my mod, so if you find a reference to something in the code or in my desciptions, that isn't part of the game.. it's most certainly part of my Otherland-Mod.
As long as it isn't vital to this guide I'm not gonna describe it further.
Here is what I planned to do:
There is a lvl 10 CaHPower ("BlessedOfValinor", something like the "Gandalf the White" Power in BFME).
Since it is passive it doesn't
realy need a Commandbutton in the CaH Palantir.
CaHs might buy this power during creation in the CaH Powerselectionscreen (thereby filling one of their Plantir Commandbuttonslots).
But the same power should also be available at the fortress (at an increased price).
- this "FortressUpgrade" shall only be shown once the CaH reaches lvl 10.
- and only, if he didn't choose the Power during Creation
- the FortressUpgrade shall be hidden, once it is purchased.
To do this we need to edit the following files:
- createaheroupgrades.inc
- commandbutton.ini
- commandset.ini
- experiencelevels_createahero.inc
- createahero.ini
- weapons.ini
- ObjectCreationList.ini
- createaheroobjects.inc
- isengardfortress.ini <= this one is just an example.. you will have to edit every fortress that you want to be able to grant the Upgrade to your CaH
- lotr.str
And here is what I did:
2.1. createaheroupgrades.incInstead of just one upgrade like in the Basic Version, I've created 3
- One to unpause the power ("Upgrade_CreateAHeroBlessedOfValinor")
This one can be bought at the Fortress for 10000 or at CaH Creation for 2000 - One to unlock the second commandset of the Fortress ("Upgrade_CreateAHeroBlessedOfValinorEnabler")
- One to hinder the unlocking of the second commandset ("Upgrade_CreateAHeroBlessedOfValinorForbidden")
Upgrade Upgrade_CreateAHeroBlessedOfValinorEnabler
Type = PLAYER
End
Upgrade Upgrade_CreateAHeroBlessedOfValinorForbidden
Type = PLAYER
End
Upgrade Upgrade_CreateAHeroBlessedOfValinor
Type = PLAYER
BuildCost = 10000
BuildTime = 320000
UpgradeFX = FX_DwarvenFortressUpgrade
ResearchSound = UpgradeDwarfFortressStonework
End
2.2. commandbutton.iniI made 2 new commandbuttons
The first is for the Fortress, this one enables the Player to purchase the upgrade that unpauses the passive power at his fortress.
The second is the button for the passive power, and the button that the player sees in the CaH Creation Screen.
CommandButton Command_PurchaseUpgradeBlessedOfValinor Command = PLAYER_UPGRADE Upgrade = Upgrade_CreateAHeroBlessedOfValinor ButtonImage = SBGood_Sunflare Options = CANCELABLE ;HIDE_WHILE_DISABLED ButtonBorderType = UPGRADE TextLabel = CONTROLBAR:SpecialAbilityCAH_BlessedOfValinor DescriptLabel = CONTROLBAR:ToolTipSpecialAbilityCAH_BlessedOfValinor Radial = Yes InPalantir = NoEndCommandButton Command_CreateAHero_BlessedOfValinor Command = SPECIAL_POWER SpecialPower = SpecialAbilityCreateAHeroBlessedOfValinor TextLabel = CONTROLBAR:SpecialAbilityCAH_BlessedOfValinor ButtonImage = SBGood_Sunflare ;HSElrondRestoration ButtonBorderType = ACTION DescriptLabel = CONTROLBAR:ToolTipSpecialAbilityCAH_BlessedOfValinor InPalantir = Yes AutoAbility = No Options = NONPRESSABLE CreateAHeroUIAllowableUpgrades = Upgrade_CreateAHero_ClassIstariWizardFire Upgrade_CreateAHero_ClassIstariWizardLightning Upgrade_CreateAHero_ClassIstariWizardMagic Upgrade_CreateAHero_ClassIstariWizardPoison CreateAHeroUIMinimumLevel = 10 CreateAHeroUIPrerequisiteButtonName = None CreateAHeroUICostIfSelected = 2000End
2.3. commandset.iniYou need to create a second commandset for EVERY fortress you want to be ably to purchase the new upgrade in.
Here is the IsengarFortress commandset .. both the original.. and the "blessed"
CommandSet IsengardFortressCommandSet InitialVisible = 6 //Main menu can select heroes, upgrades sub menus, or build a porter. 1 = Command_ConstructIsengardPorter; 2 = Command_ConstructIsengardBerserkerHorde 2 = Command_SelectRevivablesIsengardFortress 3 = Command_SelectUpgradesIsengardFortress 4 = Command_IsengardWizardsTowerLightningStrike 6 = Command_Sell //Improvements 7 = Command_PurchaseUpgradeIsengardFortressMurderOfCrows 8 = Command_PurchaseUpgradeIsengardFortressBurningForges 9 = Command_PurchaseUpgradeIsengardFortressExcavations 10 = Command_PurchaseUpgradeIsengardFortressOrcfireMunitions 11 = Command_PurchaseUpgradeIsengardFortressIronPlating 12 = Command_PurchaseUpgradeIsengardFortressWizardsTower 13 = Command_SpecialAbilityMurderOfCrows 14 = Command_RadialBack //Heroes 16 = Command_RingHeroReviveSlot 17 = Command_CreateAHeroReviveSlot // Note we also need an extra slot for the Create A Hero 18 = Command_GenericReviveSlot1 19 = Command_GenericReviveSlot2 20 = Command_GenericReviveSlot3 21 = Command_GenericReviveSlot4 22 = Command_GenericReviveSlot5 23 = Command_GenericReviveSlot6 24 = Command_GenericReviveSlot7 25 = Command_RadialBackEndCommandSet IsengardFortressCommandSetBlessed InitialVisible = 6 //Main menu can select heroes, upgrades sub menus, or build a porter. 1 = Command_ConstructIsengardPorter; 2 = Command_ConstructIsengardBerserkerHorde 2 = Command_SelectRevivablesIsengardFortress 3 = Command_SelectUpgradesIsengardFortress 4 = Command_IsengardWizardsTowerLightningStrike 5 = Command_PurchaseUpgradeBlessedOfValinor 6 = Command_Sell //Improvements 7 = Command_PurchaseUpgradeIsengardFortressMurderOfCrows 8 = Command_PurchaseUpgradeIsengardFortressBurningForges 9 = Command_PurchaseUpgradeIsengardFortressExcavations 10 = Command_PurchaseUpgradeIsengardFortressOrcfireMunitions 11 = Command_PurchaseUpgradeIsengardFortressIronPlating 12 = Command_PurchaseUpgradeIsengardFortressWizardsTower 13 = Command_SpecialAbilityMurderOfCrows 14 = Command_RadialBack //Heroes 16 = Command_RingHeroReviveSlot 17 = Command_CreateAHeroReviveSlot 18 = Command_GenericReviveSlot1 19 = Command_GenericReviveSlot2 20 = Command_GenericReviveSlot3 21 = Command_GenericReviveSlot4 22 = Command_GenericReviveSlot5 23 = Command_GenericReviveSlot6 24 = Command_GenericReviveSlot7 25 = Command_RadialBackEnd
The only change is, that I added 5 = Command_PurchaseUpgradeBlessedOfValinor to the Blessed Commandset. Make sure that the "InitialVisible = " Value matches the number of buttons in the Main Menu
And another thing, some Fortresses don't have a "free" button between the Main Menu and the next layer (upgrades, reviveables). In that case you will have to squeeze the "Command_PurchaseUpgradeBlessedOfValinor" into the Blessed Commandset anyway. and increment every button after it by 1 .. (also You will have to create new Command_SelectRevivables* and Command_SelectUpgrades* Buttons to reflect those changes...
Sounds complicated?
Lets take a look at the Arnor Fortresscode:
CommandSet ArnorFortressCommandSet InitialVisible = 6 //Main Menu 1 = Command_ConstructArnorPorter 2 = Command_SelectRevivablesArnorFortress 3 = Command_SelectUpgradesArnorFortress 4 = Command_FireWeaponArnorFortressBoilingOil 5 = Command_SpecialAbilityIvoryTowerVision 6 = Command_Sell //Upgrades Menu 7 = Command_PurchaseUpgradeArnorFortressBanners 8 = Command_PurchaseUpgradeArnorFortressHouseOfHealing 9 = Command_PurchaseUpgradeArnorFortressFlamingMunitions 10 = Command_PurchaseUpgradeArnorFortressBoilingOil 11 = Command_PurchaseUpgradeArnorFortressNumenorStonework 12 = Command_PurchaseUpgradeArnorFortressIvoryTower 13 = Command_RadialBack //Hero Menu 14 = Command_RingHeroReviveSlot 15 = Command_CreateAHeroReviveSlot // Note we also need an extra slot for the Create A Hero 16 = Command_GenericReviveSlot1 //Revives any hero. keep them UNIQUE within the same commandset! 17 = Command_GenericReviveSlot2 18 = Command_GenericReviveSlot3 19 = Command_GenericReviveSlot4 20 = Command_GenericReviveSlot5 21 = Command_GenericReviveSlot6 22 = Command_GenericReviveSlot7 23 = Command_RadialBack End
As you can see, the Main Menu ends with 6 .. and the next layer starts with 7 .. no room there .. So
in the Blessed Version
CommandSet ArnorFortressCommandSet2 InitialVisible = 7 //Main Menu 1 = Command_ConstructArnorPorter 2 = Command_SelectRevivablesArnorFortressBlessed 3 = Command_SelectUpgradesArnorFortressBlessed 4 = Command_FireWeaponArnorFortressBoilingOil 5 = Command_SpecialAbilityIvoryTowerVision 6 = Command_Sell 7 = Command_PurchaseUpgradeBlessedOfValinor //Upgrades Menu 8 = Command_PurchaseUpgradeArnorFortressBanners 9 = Command_PurchaseUpgradeArnorFortressHouseOfHealing 10 = Command_PurchaseUpgradeArnorFortressFlamingMunitions 11 = Command_PurchaseUpgradeArnorFortressBoilingOil 12 = Command_PurchaseUpgradeArnorFortressNumenorStonework 13 = Command_PurchaseUpgradeArnorFortressIvoryTower 14 = Command_RadialBack //Hero Menu 15 = Command_RingHeroReviveSlot 16 = Command_CreateAHeroReviveSlot 17 = Command_GenericReviveSlot1 18 = Command_GenericReviveSlot2 19 = Command_GenericReviveSlot3 20 = Command_GenericReviveSlot4 21 = Command_GenericReviveSlot5 22 = Command_GenericReviveSlot6 23 = Command_GenericReviveSlot7 24 = Command_RadialBack End
the Main Menu ends with 7 and the next layer starts with 8 (and every following button is increased by 1 as well)
Also we have to increase the "InitialVisible" from 6 to 7 .. since now there are 7 Buttons in the Main Menu
And to top it all off, we have introduced two new Buttons
Command_SelectRevivablesArnorFortressBlessed and Command_SelectUpgradesArnorFortressBlessed
Let me show you, how they differ from the original ones. One example should suffice.
Lets take a look at the Command_SelectRevivablesArnorFortress and Command_SelectRevivablesArnorFortressBlessed Buttons
CommandButton Command_SelectRevivablesArnorFortress
Command = PUSH_VISIBLE_COMMAND_RANGE
TextLabel = CONTROLBAR:SelectRevivablesArnorFortress
ButtonImage = UCCommon_GoodHeroes
ButtonBorderType = SYSTEM
DescriptLabel = CONTROLBAR:ToolTipCommandSelectRevivablesArnorFortress
Radial = Yes
CommandRangeStart = 13 //Starts its counting at 0, so command button 8 is 7
CommandRangeCount = 14
End
CommandButton Command_SelectRevivablesArnorFortressBlessed
Command = PUSH_VISIBLE_COMMAND_RANGE
TextLabel = CONTROLBAR:SelectRevivablesArnorFortress
ButtonImage = UCCommon_GoodHeroes
ButtonBorderType = SYSTEM
DescriptLabel = CONTROLBAR:ToolTipCommandSelectRevivablesArnorFortress
Radial = Yes
CommandRangeStart = 14 //Starts its counting at 0, so command button 8 is 7
CommandRangeCount = 14
End
As you can see, all I've changed was to increase the CommandRangeStart by the same amount, that we increased the Buttonnumbers in the Blessed Commandset.. "1"
Now we need to tell the fortresses.. that there are some new Commandsets in town
2.4. isengardfortress.iniEvery fortress that you mad a new commandset for needs to be edited like the isengard fortress
CommandSet = IsengardFortressCommandSet Behavior = CommandSetUpgrade ModuleTag_IsengardFortressBlessedCommandSet TriggeredBy = Upgrade_CreateAHeroBlessedOfValinorEnabler ConflictsWith = Upgrade_CreateAHeroBlessedOfValinorForbidden Upgrade_CreateAHeroBlessedOfValinor CommandSet = IsengardFortressCommandSetBlessed End Behavior = CommandSetUpgrade ModuleTag_IsengardFortressCommandSet TriggeredBy = Upgrade_CreateAHeroBlessedOfValinor Upgrade_CreateAHeroBlessedOfValinorForbidden RequiresAllTriggers = No CommandSet = IsengardFortressCommandSet End
With these changes the comandset will refresh for the first time, as soon as the Upgrade_CreateAHeroBlessedOfValinorEnabler is granted (at level 10) As long as the Upgrade_CreateAHeroBlessedOfValinorForbidden or Upgrade_CreateAHeroBlessedOfValinor aren't in place yet.
As soon as the Upgrade_CreateAHeroBlessedOfValinor is purchased from the fortress, the commandset is returned to it's original state.. effectively hiding the upgrade Button again.
2.5. experiencelevels_createahero.incjust like in the basic version. Here the it's the OCL_BlessedHack that grants the Fortressupgradeenabler
ExperienceLevel CreateAHeroLevel10 TargetNames = CreateAHero RequiredExperience = CREATE_A_HERO_LVL10_EXP_NEEDED ExperienceAward = CREATE_A_HERO_LVL10_EXP_AWARD LevelUpOCL = OCL_BlessedHack Rank = 10 AttributeModifiers = HeroLevelUpDamage9; Upgrades = CreateAHero_Dummy_not_used_reset_in_code_at_runtime SelectionDecal Texture = decal_hero_good Style = SHADOW_ALPHA_DECAL OpacityMin = 50% OpacityMax = 100% MinRadius = 40 ;16 MaxRadius = 200 ;16 MaxSelectedUnits = 40 ;1 EndEnd
2.6. createahero.iniNow this little piece of code makes sure, that the Fortressupgradeoption won't be shown, if the Hero has already purchased the upgrade during CaH Creation.
It will only work if the BlessedOfValinor Power bought during CaH Creation is obtained at the same level as the Upgradeenabler in the experiencelevels_createahero.inc
All in all it just fires a weapon, once the Upgrade_CreateAHeroBlessedOfValinor is obtained.
Behavior = DamageFieldUpdate ModuleTag_BlessedHackWeapon
RequiredUpgrade = Upgrade_CreateAHeroBlessedOfValinor
ForbiddenUpgrade = Upgrade_CreateAHeroBlessedOfValinorForbidden
FireWeaponNugget
WeaponName = BlessedWindWeapon
FireDelay = 0
OneShot = Yes
End
End
2.7. weapons.iniNo to define the BlessedWindWeapon
Weapon BlessedWindWeapon
RadiusDamageAffects = ENEMIES NEUTRALS
DelayBetweenShots = 0
ClipSize = 0
WeaponOCLNugget
WeaponOCLName = OCL_UnBlessedHack
RequiredUpgradeNames = Upgrade_CreateAHeroBlessedOfValinor
End
End
2.8. ObjectCreationList.iniMaybe you noticed, that I used 2 different OCLs
One of those creates the Upgrade_CreateAHeroBlessedOfValinorEnabler, while the other creates Upgrade_CreateAHeroBlessedOfValinorForbidden.
As you can see I added the
ObjectCreationList OCL_BlessedHack ; The egg is going to die (hatch) immediately, and play the FXLists, then wait, then do the Finish below CreateObject ObjectNames = BlessedEgg Count = 1 Disposition = LIKE_EXISTING End CreateObject ObjectNames = GlorfindelStarlightObject End EndObjectCreationList OCL_UnBlessedHack ; The egg is going to die (hatch) immediately, and play the FXLists, then wait, then do the Finish below CreateObject ObjectNames = UnBlessedEgg Count = 1 Disposition = LIKE_EXISTING EndEnd
2.9. createaheroobjects.inc, lotr.strThe following is alomst the same as in the basic version. I'm just gonna give you the codes without much comment.
I'll leave the lotr.str stuff out, since everybody should know what to do there, after reading the basic version
createaheroobjects.inc
Object BlessedEgg Draw = W3DScriptedModelDraw ModuleTag_DrawBlessedEgg DefaultModelConditionState Model = None End End Body = ActiveBody ModuleTag_02BlessedHack MaxHealth = 10000 End Behavior = GrantUpgradeCreate ModuleTag_BlessedEggUpgradegranter UpgradeToGrant = Upgrade_CreateAHeroBlessedOfValinorEnabler End Behavior = LifetimeUpdate ModuleTag_HatchTriggerBlessedEgg MinLifetime = 50.0 MaxLifetime = 50.0 End Behavior = SlowDeathBehavior ModuleTag_HatchProcessBlessedEgg DestructionDelay = 3000 FX = INITIAL FX_BlessedLight EndEndObject UnBlessedEgg Draw = W3DScriptedModelDraw ModuleTag_DrawUnBlessedEgg DefaultModelConditionState Model = None End End Body = ActiveBody ModuleTag_02UnBlessedHack MaxHealth = 10000 End Behavior = GrantUpgradeCreate ModuleTag_UnBlessedEggUpgradegranter UpgradeToGrant = Upgrade_CreateAHeroBlessedOfValinorForbidden End Behavior = LifetimeUpdate ModuleTag_HatchTriggerUnBlessedEgg MinLifetime = 50.0 MaxLifetime = 50.0 EndEnd
3.0. Powercode for BlessedOfValinor in createaheropowers.incJust to give you an idea what this was all about, the Blessed of Valinor Power
It's just configured for the Wizards right now, the other CaHs will be added soon
//-------------------------------------------------------------------------- // ===== Blessed of Valinor//-------------------------------------------------------------------------- Behavior = UnpauseSpecialPowerUpgrade ModuleTag_CreateAHeroBlessedOfValinorEnabler SpecialPowerTemplate = SpecialAbilityCreateAHeroBlessedOfValinor TriggeredBy = Upgrade_CreateAHeroBlessedOfValinor ;RequiresAllTriggers = NoEndBehavior = SpecialPowerModule ModuleTag_CreateAHeroBlessedOfValinorStarter SpecialPowerTemplate = SpecialAbilityCreateAHeroBlessedOfValinor UpdateModuleStartsAttack = Yes StartsPaused = YesEndBehavior = AttributeModifierAuraUpdate ModuleTag_CreateAHeroBlessedOfValinorFireUpdate // TODO figure out how to do this as a one time thing StartsActive = No ;If no, requires upgrade to turn on. TriggeredBy = Upgrade_CreateAHeroBlessedOfValinor ConflictsWith = Upgrade_CreateAHero_ClassIstariWizardMagic Upgrade_CreateAHero_ClassIstariWizardPoison Upgrade_CreateAHero_ClassIstariWizardLightning BonusName = BlessedOfValinorFire RefreshDelay = 0 Range = 0 AllowSelf = YesEndBehavior = AttributeModifierAuraUpdate ModuleTag_CreateAHeroBlessedOfValinorLightningUpdate // TODO figure out how to do this as a one time thing StartsActive = No ;If no, requires upgrade to turn on. TriggeredBy = Upgrade_CreateAHeroBlessedOfValinor ConflictsWith = Upgrade_CreateAHero_ClassIstariWizardMagic Upgrade_CreateAHero_ClassIstariWizardFire Upgrade_CreateAHero_ClassIstariWizardPoison BonusName = BlessedOfValinorLightning RefreshDelay = 0 Range = 0 AllowSelf = YesEndBehavior = AttributeModifierAuraUpdate ModuleTag_CreateAHeroBlessedOfValinorMagicUpdate // TODO figure out how to do this as a one time thing StartsActive = No ;If no, requires upgrade to turn on. TriggeredBy = Upgrade_CreateAHeroBlessedOfValinor ConflictsWith = Upgrade_CreateAHero_ClassIstariWizardPoison Upgrade_CreateAHero_ClassIstariWizardFire Upgrade_CreateAHero_ClassIstariWizardLightning BonusName = BlessedOfValinorMagic RefreshDelay = 0 Range = 0 AllowSelf = YesEndBehavior = AttributeModifierAuraUpdate ModuleTag_CreateAHeroBlessedOfValinorPoisonUpdate // TODO figure out how to do this as a one time thing StartsActive = No ;If no, requires upgrade to turn on. TriggeredBy = Upgrade_CreateAHeroBlessedOfValinor ConflictsWith = Upgrade_CreateAHero_ClassIstariWizardMagic Upgrade_CreateAHero_ClassIstariWizardFire Upgrade_CreateAHero_ClassIstariWizardLightning BonusName = BlessedOfValinorPoison RefreshDelay = 0 Range = 0 AllowSelf = YesEnd
you don't even need to use Lua for this. You can use the GrantUpgradeCreate Behavior. I find it easier to keep all the necessary code in one place
Ah thanks!
I didn't know about that one.
gonna try it tomorrow and include it if it works.
It works.. would be great, if I could use the removeupgrade behavior as well.
Sadly I couldn't get it to work, in a way so that a removed "Upgrade_CreateAHeroBlessedOfValinorEnabler" hides the FortressUpgradebutton again.
That way I could reduce the commandset.ini troubles, because I would only need one commandset.. and no fortresscodeediting would be necessary..
Ànybody else knows a way?
Edited by Imladhrim, 07 February 2007 - 01:37 PM.