The 3rd Age

BfME 1½ Mod

BfME 1½ Mod

A mod that makes BfME2 as it should have been with the building plot system from BfME1!

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

extended map.ini coding

Avatar of -SilverBane-

-SilverBane-

Category: Code
Level: Intermediate
Created: Thursday May 28, 2015 - 16:08
Updated: Sunday May 31, 2015 - 10:20
Views: 6572
Summary: A tutorial for those who want to make heavily customized maps, but modders might find tricks too!

Rating

Staff says

-

Members say

-

Average

-

0 votes

Page 1 2 3 4 5 6 7 8
5==================================================================================================

You've came this far! :D
On this page I will show you how I've created one of the powers of my hero Lightning in my map Keep Defence.

I will pick the Heartseeker ability, wich is a very powerful melee strike, similar to backstab.

You first need to code the ability in the unit;
Add this INSIDE of your unit/hero:




OBJECT CODE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;-------------------------------------------------------------

              
Code

AddModule
Behavior = UnpauseSpecialPowerUpgrade ModuleTag_attackenable
    SpecialPowerTemplate = SpecialAbilitySwordStab ;heartseeker special power
    TriggeredBy             = Upgrade_LurtzLeadership ;this is an upgrade that the unit is given when reaches a certain level
End
End


AddModule
Behavior = SpecialPowerModule ModuleTag_attackstarter
    SpecialPowerTemplate     = SpecialAbilitySwordStab ;heartseeker special power
    UpdateModuleStartsAttack = Yes
    StartsPaused             = Yes
    InitiateSound             = HeroHaradrimVoiceAttack ;my hero is a haradrim, so i want him to play this sound when ordered to use ability
End
End


AddModule
Behavior = WeaponFireSpecialAbilityUpdate ModuleTag_attackupdate
    SpecialPowerTemplate = SpecialAbilitySwordStab ;heartseeker special power
    UnpackTime             = 1500 ;time before it fires
    PackTime             = 2000     ;time after it fires
    AwardXPForTriggering = 0
    StartAbilityRange     = CREATE_A_HERO_ASSASSIN_DO_POWER_RANGE
    ApproachRequiresLOS     = Yes
    SpecialWeapon         = Lightning'sSwordHit ;heartseeker weapon
    WhichSpecialWeapon     = 5 ; this one sets SPECIAL_WEAPON_FIVE model condition in W3D Draw module, so you can have an animation for this ability

    LoseStealthOnTrigger = Yes
    PreTriggerUnstealthTime = 2100
End
End

CommandSet = LightningCommandSet






As you can see, the first module tells the game wich upgrade "unlocks" the ability. The special power, as you will see below, is bound to this module after and will be used for commandbuttons. This module is sometimes optional if you do not want your ability to have a requirment.(ex: certain level)

The second module tells the game if the module is already active (StartsPaused = No) or not (StartsPaused = Yes). If it starts paused, you need the module above to trigger it's unlock.

The third module is the ability itself, one of the most important lines along SpecialPowerTemplate are SpecialWeapon(this one tells the game wich weapon to fire when using ability) and WichSpecialPower(tells wich animation/model condition to use in w3d Draw module)
On SpecialWeapon = Lightning'sSwordHit, replace "Lightning'sSwordHit" with your own weapon if you want.



SPECIAL POWER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
---------------------------------------------------------------



Now, lets define the special power:
WARNING!!! THE SPECIAL POWER MUST BE DEFINED ABOVE THE OBJECT IN MAP.INI OR ELSE IT CAUSES BUGS OR CRASHES!!! Do NOT define it INSIDE the object, but above all other things related to that object (including commandbuttons!!!)
              
Code


SpecialPower SpecialAbilitySwordStab
    Enum                        = SPECIAL_AT_VISIBLE_OBJECT ;hardcoded token
    ReloadTime                    = 200000 ; in milisecs - so the reload time is 200s
    PreventActivationConditions    = HIDDEN ; this one shouldn't be here for you, it is needed as my hero haves a different spell wich makes him invisbile, and I don't want him to be able to use heartseeker when he's invisible
End




Basically, you can create your own specialpower by replacing "SpecialAbilitySwordStab" with your spell name, just make sure if you have multiple special powers on your object, they DO NOT USE THE SAME ENUM
Also sometimes some enums will not work, so if you click on your power and nothing happens, this might be one cause. If happens, try changing the enum to something else (search on specialpower.ini)


Now, let's find the commandbutton for this:






COMMAND BUTTON;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-------------------------------------------------



The commandbutton MUST BE DEFINED ABOVE OBJECT AND COMMANDSET BUT BELOW SPECIALPOWER



              
Code


MappedImage BCFarm
;Texture = BuildingRadialButtons_076.tga
Texture = HeroUI_004.tga
TextureWidth = 256
TextureHeight = 256
Coords = Left:192 Top:128 Right:256 Bottom:192
Status = NONE
End


CommandButton Command_PorterConstructMenFarm ; evil hack with button image, see above
    Command                    = SPECIAL_POWER
    SpecialPower            = SpecialAbilitySwordStab
    Options                    = NEED_TARGET_ENEMY_OBJECT
Object = NONE
    TextLabel                = CONTROLBAR:SwordHit
    DescriptLabel            = CONTROLBAR:ToolTipSwordHit
    ButtonImage                = BCFarm
    InvalidCursorName        = GenericInvalid
    CursorName                = EvilAbilityObj
    ButtonBorderType        = ACTION
    InPalantir                = Yes
    AutoAbility                = Yes
Radial = No
DisableOnModelCondition = WEAPONSET_TOGGLE_1 HIDDEN HERO
End


Well, you might say, why do we use a farm commandbutton?? We should rather use a button with a sword pic!
I have picked this commandbutton because it's not used in my map (no porters), and I have replaced the farm pic with a sword pick, check last page for more info. So, for now, ignore the MappedImage code.

Command    = SPECIAL_POWER ;--- this one defines wich kind of commandbutton is this one. If you change to SPELL_BOOK but its in an unit's commandset, it won't work

SpecialPower = SpecialAbilitySwordStab ;--- this tells the game wich power activates this button

Options    = NEED_TARGET_ENEMY_OBJECT ;--- so it's not a click and voila power, you need a target. Find more options looking through commandbutton.ini

Object = NONE ;----this one must not always be here, but since this commandbutton was constructing a building before, we need to tell the game its no building anymore, or else we see the power costing 300$


TextLabel    = CONTROLBAR:SwordHit
DescriptLabel    = CONTROLBAR:ToolTipSwordHit ;--- these ones are related to map.str and set the text you see when you put mouse over commandbutton on palantir

InvalidCursorName        = GenericInvalid ;--- what cursor to use when you're not with mouse over an enemy unit
CursorName            = EvilAbilityObj ;--- what cursor to use when you're with mouse over an enemy unit;; the other cursor used for this is Bombard, wich is the blue one

ButtonBorderType        = ACTION ;--- make sure it's action on a special power
InPalantir        = Yes ; --- if this is set to No, then you won't see your power on palantir
Radial = No ; if this is Yes, you will see your power on map too, not just on palantir, just like the Construct_GondorFighterHorde commandbutton, wich shows on map aswell from barracks. If "InPalantir" and "Radial" are both set to No, then your commandbutton won't appear anywhere
DisableOnModelCondition = WEAPONSET_TOGGLE_1 HIDDEN HERO ;--- the following conditons restrict this button to be available - I don't want to use this power when another power is working to prevent double damage with this weapon

COMMANDSET;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-----------------------------------------------
MUST BE DEFINED ABOVE OBJECT BUT BELOW COMMANDBUTTON AND SPECIAL POWERS!


              
Code

CommandSet LightningCommandSet
1 = Command_ToggleStance
2 = Command_CreateAHero_CM_ToggleWeapon
3 = Command_SpecialAbilityPhialOfGaladriel
4 = Command_PorterConstructMenFarm ; this is heartseeker
5 = Command_SpellBookEnshroudingMist
6 = Command_FiresOfDoom
End



Pretty simple to create, you can have more than 6 commandbuttons in a commandset but they won't show in palantir (check last page for more info). Number 4 is our commandbutton, the others are my other spells.


WEAPON;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-----------------------------------------------
Remember this code: "SpecialWeapon         = Lightning'sSwordHit" from 3rd module in the object above? It's time to define the weapon.

              
Code


Weapon Lightning'sSwordHit
    LeechRangeWeapon = Yes
    AttackRange = CREATE_A_HERO_ASSASSIN_RANGE
    MeleeWeapon = Yes
    FireFX = FX_GandalfSwordHit
    DelayBetweenShots = CREATE_A_HERO_ASSASSIN_DELAYBETWEENSHOTS             // time between shots, msec
    PreAttackDelay = CREATE_A_HERO_ASSASSIN_PREATTACKDELAY     // 400 is sword swing delay time before contact with target.
    PreAttackType = PER_SHOT // Do the delay each time we attack a new target

    FiringDuration = CREATE_A_HERO_ASSASSIN_FIRINGDURATION     // Duration of the sword swing




    DamageNugget // A basic Nugget that just does damage
        Damage                    = 500
        Radius                    = 0.0
        DelayTime                = 0
        DamageType                = MAGIC
        DamageFXType            = REFLECTED
        DeathType                = EXPLODED
    End




    DamageNugget // A basic Nugget that just does damage
        Damage                    = 3000
        Radius                    = 0.0
        DelayTime                = 200
        DamageType                = HERO
        DamageFXType            = MAGIC
        DeathType                = EXPLODED
    End




MetaImpactNugget ; A Nugget that throws things back with force
        KillObjectFilter            = INSTANT_DEATH_ON_METAIMPACT_OBJFILTER
        SpecialObjectFilter            = SPELL_UNDERMINE_AFFECTS_OBJECT_FILTER
ShockWaveAmount = 110.0
ShockWaveRadius = 1.0
ShockWaveTaperOff = 1
ShockWaveZMult = 1.20
End


End



As you can see, it deals 6000 damage (wich is huge!), half MAGIC, half HERO, wich means it harms pretty much anything. It will also knock back enemies and kill siege machines/builders in one hit (because of the knockback effect)
Not much to say about this, you need to check weapon.ini to learn how to make your own weapons.

EXPERIENCE LEVEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-----------------------------------------------



              
Code



ExperienceLevel    GothmogLevel5
    TargetNames                    = MordorGothmog
    RequiredExperience            = GOTHMOG_LVL5_EXP_NEEDED
    ExperienceAward                = GOTHMOG_LVL5_EXP_AWARD    
    AttributeModifiers            = HeroLevelUpDamage4
    Rank                        = 5
    LevelUpFx                    = FX:LightningLevelUpFX
    Upgrades                = Upgrade_LurtzLeadership
    SelectionDecal
        Texture                    = decal_hero_evil
        Style                    = SHADOW_ALPHA_DECAL
        OpacityMin                = 50%    
        OpacityMax                = 100%
        MinRadius                = 40
        MaxRadius                = 200
        MaxSelectedUnits        = 40
    End    
END    



Since my unit was originally a gothmog (but he doesn't looks like one, I have edited his W3D module), we need to use the object's experience level.
The only thing that you should add is "Upgrades    = Upgrade_LurtzLeadership", others can cause nasty game.dat errors if changed.

In this map I have also changed "LevelUpFx = FX:LightningLevelUpFX". I have defined this FX above the object so now when he levels up he gets a different FX, but I won't talk about fx'ses here.



So basically when your hero reaches level 5 (in this case), it gets the "Upgrade_LurtzLeadership", wich triggers the unlock of the special power.


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Now, I will transfer this ability to another hero, so you can quickly copy-paste it on your map.ini and experiment with it, aswell as to have an overview about it.

We will transfer it to a blackrider (and will replace morgul blade):

Also I have changed the names of weapon and specialpower

;-----------------------------------------------------------------




              
Code



SpecialPower SpecialAbilityNazgulPowerHit
    Enum                        = SPECIAL_AT_VISIBLE_OBJECT
    ReloadTime                    = 60000 ; we set it to 60s so you can test it often
    ;PreventActivationConditions    = HIDDEN ; we won't use this on nazgul, since he doesn't have a stealth power
End



Weapon NazgulPowerHit
    LeechRangeWeapon = Yes
    AttackRange = CREATE_A_HERO_ASSASSIN_RANGE
    MeleeWeapon = Yes
    FireFX = FX_GandalfSwordHit
    DelayBetweenShots = CREATE_A_HERO_ASSASSIN_DELAYBETWEENSHOTS             // time between shots, msec
    PreAttackDelay = CREATE_A_HERO_ASSASSIN_PREATTACKDELAY     // 400 is sword swing delay time before contact with target.
    PreAttackType = PER_SHOT // Do the delay each time we attack a new target

    FiringDuration = CREATE_A_HERO_ASSASSIN_FIRINGDURATION     // Duration of the sword swing




    DamageNugget // A basic Nugget that just does damage
        Damage                    = 500
        Radius                    = 0.0
        DelayTime                = 0
        DamageType                = MAGIC
        DamageFXType            = REFLECTED
        DeathType                = EXPLODED
    End




    DamageNugget // A basic Nugget that just does damage
        Damage                    = 3000
        Radius                    = 0.0
        DelayTime                = 200
        DamageType                = HERO
        DamageFXType            = MAGIC
        DeathType                = EXPLODED
    End




MetaImpactNugget ; A Nugget that throws things back with force
        KillObjectFilter            = INSTANT_DEATH_ON_METAIMPACT_OBJFILTER
        SpecialObjectFilter            = SPELL_UNDERMINE_AFFECTS_OBJECT_FILTER
ShockWaveAmount = 110.0
ShockWaveRadius = 1.0
ShockWaveTaperOff = 1
ShockWaveZMult = 1.20
End


End





MappedImage BCFarm
;Texture = BuildingRadialButtons_076.tga
Texture = HeroUI_004.tga
TextureWidth = 256
TextureHeight = 256
Coords = Left:192 Top:128 Right:256 Bottom:192
Status = NONE
End


CommandButton Command_PorterConstructMenFarm ; evil hack with button image, see above
    Command                    = SPECIAL_POWER
    SpecialPower            = SpecialAbilityNazgulPowerHit
    Options                    = NEED_TARGET_ENEMY_OBJECT
Object = NONE
    TextLabel                = CONTROLBAR:SwordHit ; you will get MISSING in game if you haven't defined these in map.STR
    DescriptLabel            = CONTROLBAR:ToolTipSwordHit
    ButtonImage                = BCFarm
    InvalidCursorName        = GenericInvalid
    CursorName                = EvilAbilityObj
    ButtonBorderType        = ACTION
    InPalantir                = Yes
    AutoAbility                = Yes
Radial = No
;DisableOnModelCondition = MOUNTED ; we don't need for nazgul since it haves mounted attack anim aswell
End

CommandSet EvilMenBlackRiderNewCommandSet
    1    = Command_ToggleStance
    2    = Command_MountHorseBlackRider
    3    = Command_BlackRiderDreadVisage
4 = Command_PorterConstructMenFarm
    5    = Command_SpecialAbilityScreechBlackRider
    12    = Command_CaptureBuilding
    13    = Command_AttackMove
    14    = Command_Stop
End


Object EvilMenBlackRider






;removing the morgulblade_related modules

RemoveModule ModuleTag_BlackRiderMorgulBlade
RemoveModule ModuleTag_BlackRiderMorgulBladeStarter
RemoveModule ModuleTag_BlackRiderMorgulBladeUpdate



;----------------------------------------------NAZGUL POWER HIT------------------------------------
AddModule
Behavior = UnpauseSpecialPowerUpgrade ModuleTag_attackenable
    SpecialPowerTemplate = SpecialAbilityNazgulPowerHit
    TriggeredBy             = Upgrade_BlackRiderDreadVisage ;i use this so it unlocks on level 2 like dread visage
End
End


AddModule
Behavior = SpecialPowerModule ModuleTag_attackstarter
    SpecialPowerTemplate     = SpecialAbilityNazgulPowerHit
    UpdateModuleStartsAttack = Yes
    StartsPaused             = Yes
    InitiateSound             = FellBeastVoiceAttack
End
End


AddModule
Behavior = WeaponFireSpecialAbilityUpdate ModuleTag_attackupdate
    SpecialPowerTemplate = SpecialAbilityNazgulPowerHit
    UnpackTime             = 1500 ;time before it fires
    PackTime             = 2000     ;time after it fires
    AwardXPForTriggering = 0
    StartAbilityRange     = CREATE_A_HERO_ASSASSIN_DO_POWER_RANGE
    ApproachRequiresLOS     = Yes
    SpecialWeapon         = NazgulPowerHit
    WhichSpecialWeapon     = 1 ; we will use the morgul blade attack animation

    LoseStealthOnTrigger = Yes
    PreTriggerUnstealthTime = 2100
End
End

;------------------

CommandSet = EvilMenBlackRiderNewCommandSet

End




There is no experiencelevel here, since Upgrade_BlackRiderDreadVisage is already added in original BlackRider experience level 2.




For now, create an empty map, add a nazgul on it and add this code above in the map.ini. Level up your nazgul to 2 and then try the new spell on units! :)



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."

 
17:40:47