The 3rd Age

Build anywhere mod (buildmod)

Build anywhere mod (buildmod)

Let's you build anywhere in skirmish

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

Horde Mount/Dismount Ability

Avatar of Rob38

Rob38

Category: Code
Level: Expert
Created: Wednesday December 19, 2007 - 14:55
Updated: Saturday June 27, 2009 - 18:18
Views: 12781
Summary: Giving hordes the ability to toggle between horse and foot.

Rating

Staff says

4.8

Members say

4.0

Average

4.3/5.0

11 votes

Page 1 2 3 4 5 6 7
1. Ok, first thing to do is have your unit and horde work properly while on foot. You want to have this all set up so things don't get messy later on :)

2. Right now, let's just focus on the unit object. I'll go over the horde later to avoid confusion. First, set up the animations and model conditions for the mounted part of your unit. Remember, list all your mounted animations before the foot animations.
              
Code

DefaultModelConditionState
        Model                 = ru_hdguard
        Skeleton             = CHHW_CG_U_SKL
End

ModelConditionState    = MOUNTED
        Model                 = ru_hdguardhrse
        Skeleton             = CHHW_MW_M_SKL
End


3. Next, we need to add several animations to the object. This is what we use during the special power behavior (explained later on).

NOTE: There is a problem with the animations for the horde. Please look at page 7 of the tutorial for further explanation.

              
Code

; --- Mounting/Dismounting    
AnimationState     = MOUNTED UNPACKING USER_6 ;PREPARING SPECIAL_POWER_3
    Animation     = RousingSpeech
    AnimationName     = #(MODEL)_M_IRFA
    AnimationMode     = ONCE
    AnimationBlendTime = 5        
    ; AnimationSpeedFactorRange = 0.76 0.76
    End     
End

AnimationState     = MOUNTED PACKING ;SPECIAL_POWER_3
    Animation     = RousingSpeech
    AnimationName     = #(MODEL)_M_IRFA
    AnimationMode     = ONCE
    AnimationBlendTime = 5        
    ; AnimationSpeedFactorRange = 0.76 0.76
    End    
End

; --- Mounting/Dismounting
AnimationState     = UNPACKING USER_6 ;PREPARING SPECIAL_POWER_3
    Animation        = SPCC
    AnimationName        = #(MODEL)_U_SPCC
    AnimationMode        = ONCE
;;;AnimationBlendTime    = 5
    ; AnimationSpeedFactorRange = 0.6 0.6
    End
End

AnimationState         = PACKING ;SPECIAL_POWER_3
    Animation        = SPCC
    AnimationName        = #(MODEL)_U_SPCC
    AnimationMode        = ONCE
;;;AnimationBlendTime    = 5
    ; AnimationSpeedFactorRange = 0.6 0.6
    End
End

4. Now that all your animations and models are set up, create three new upgrades for your weaponset, armorset, and locomotor.
              
Code

WeaponSet
    Conditions = PLAYER_UPGRADE
    Weapon = PRIMARY HelmDefenderSwordMounted
    AutoChooseSources = PRIMARY FROM_PLAYER FROM_SCRIPT FROM_AI
End

ArmorSet
    Conditions = PLAYER_UPGRADE
    Armor = HelmDefenderArmorMounted
    DamageFX = NormalDamageFX
End

LocomotorSet
    Locomotor = NormalHorseHordeMemberLocomotor
    Condition = SET_NORMAL_UPGRADED
    Speed = NORMAL_CAVALRY_FAST_MEMBER_SPEED
End

5. Now we set up all the crushing status on the unit
              
Code
CrusherLevel             = 0            //Can I crush anything?
    MountedCrusherLevel         = 1     //Crush    level when mounted.
    CrushableLevel             = 0        
    MountedCrushableLevel          = 3 //Crusable level when    mounted.
    CrushWeapon             = HeroCrush
    CrushRevengeWeapon = HelmDefenderCrushRevenge

    MinCrushVelocityPercent     = 62 ;50
    CrushDecelerationPercent = 10 ;30
    
    CrushKnockback             = 40
    CrushZFactor             = 1.0

6. Have 4 upgrades set aside for your unit. They don't have to be new upgrades, but to make this tutorial more clear, I'll create new ones.               
Code
Upgrade Upgrade_HelmDefenderMount
    Type = OBJECT
End

Upgrade Upgrade_HelmDefenderDisMount
    Type = OBJECT
End

Upgrade Upgrade_MountAI
    Type = OBJECT
End

Upgrade Upgrade_DisMountAI
    Type = OBJECT
End


7. Make a new special power for your unit.
              
Code
SpecialPower SpecialAbilityHelmDefenderMount
    Enum = SPECIAL_SHIELD_BUBBLE
    ReloadTime = 3000 ; in milliseconds
End

8. Now make 4 new commandbuttons. The two SPECIAL_POWER ones are going to be used by the human player while the two OBJECT_UPGRADE
ones will be used by the AI (reason explained at end of tutorial).               
Code


CommandButton Command_HelmDefenderMount
    Command        = SPECIAL_POWER
    SpecialPower        = SpecialAbilityHelmDefenderMount
    Options = OK_FOR_MULTI_SELECT OK_FOR_MULTI_EXECUTE ON_GROUND_ONLY
    TextLabel = MAP:HelmDefenderMount
    ButtonImage = HelmDefenderMountButtonImage
    ButtonBorderType = ACTION
    DescriptLabel = MAP:ToolTipHelmDefenderMount2
    InPalantir = Yes
    UnitSpecificSound = HelmDefenderVoiceMountMS
End

CommandButton Command_HelmDefenderDisMount
    Command        = SPECIAL_POWER
    SpecialPower        = SpecialAbilityHelmDefenderMount
    Options = OK_FOR_MULTI_SELECT OK_FOR_MULTI_EXECUTE ON_GROUND_ONLY
    TextLabel = MAP:HelmDefenderDisMount
    ButtonImage = HelmDefenderDisMountButtonImage
    ButtonBorderType = ACTION
    DescriptLabel = MAP:ToolTipHelmDefenderDisMount
    InPalantir = Yes
    UnitSpecificSound = HelmDefenderVoiceDismountMS
End

CommandButton Command_HelmDefenderMountAI
    Command            = OBJECT_UPGRADE
    Options            = OK_FOR_MULTI_SELECT OK_FOR_MULTI_EXECUTE ON_GROUND_ONLY    
    Upgrade            = Upgrade_HelmDefenderMount
    TextLabel     = MAP:HelmDefenderMount
    ButtonImage        = HelmDefenderMountButtonImage
    ButtonBorderType = ACTION
    DescriptLabel = MAP:ToolTipHelmDefenderMount2
    InPalantir = Yes
    UnitSpecificSound = HelmDefenderVoiceMountMS
End

CommandButton Command_HelmDefenderDisMountAI
    Command            = OBJECT_UPGRADE
    Options            = OK_FOR_MULTI_SELECT OK_FOR_MULTI_EXECUTE ON_GROUND_ONLY    
    Upgrade            = Upgrade_HelmDefenderDisMount
    TextLabel     = MAP:HelmDefenderDisMount
    ButtonImage        = HelmDefenderDisMountButtonImage
    ButtonBorderType = ACTION
    DescriptLabel = MAP:ToolTipHelmDefenderDisMount
    InPalantir = Yes
    UnitSpecificSound = HelmDefenderVoiceDismountMS
End

9. Make two seperate commandsets with one being for mount and the other being for foot.
              
Code
CommandSet HelmDefenderCommandSet
    1 = Command_ToggleStance
    2 = Command_HelmDefenderThrowSpear
    3 = Command_HelmDefenderMount
    4 = Command_PurchaseUpgradeRohanBasicTrainingStrongHD
    7 = Command_HelmDefenderThrowSpearAI
    8 = Command_HelmDefenderMountAI
    9 = Command_HelmDefenderDisMountAI
    12 = Command_CaptureBuilding
    13 = Command_AttackMove
    14 = Command_Stop
    16 = Command_SetStanceBattle
    17 = Command_SetStanceAggressive
    18 = Command_SetStanceHoldGround
End

CommandSet HelmDefenderDismountCommandSet
    1 = Command_ToggleStance
    2 = Command_HelmDefenderThrowSpear
    3 = Command_HelmDefenderDisMount
    4 = Command_PurchaseUpgradeRohanBasicTrainingStrongHD
    7 = Command_HelmDefenderThrowSpearAI
    8 = Command_HelmDefenderMountAI
    9 = Command_HelmDefenderDisMountAI
    12 = Command_CaptureBuilding
    13 = Command_AttackMove
    14 = Command_Stop
    16 = Command_SetStanceBattle
    17 = Command_SetStanceAggressive
    18 = Command_SetStanceHoldGround
End

NOTE: If you notice, the AI commands cannot be used or seen by the player. This is exactly what we want.

Links / Downloads

 HitsAdded
In-Depth AI Coding2138December 23, 2007 - 20:00

Comments

Display order: Newest first

Rob38 (Team Chamber Member) - Sunday December 23, 2007 - 21:00

Ugh... ok, Sul, I tried your method and I was able to improve everything except for one thing. The animation will play when it's just an individual unit, but when it's a horde, it refuses to play one. I have tried tons of things but nothing works. I'll update this tutorial after I try some other things out.

EDIT: Yeah, I'm stumped. Unless someone can find a way to get the animation to work for the horde, it looks like we'll have to do without them :( Once I clean up and double check to make sure everything runs correctly, I'll edit and fix up the tutorial.

--------

Re-did the tutorial. If you find a solution to any of the problems on Page 7, please let me know :)

Sulherokhh (Team Chamber Member) - Friday December 21, 2007 - 19:59

Sweet! :) It sure looks perfectly functional, and since you tested it, we now all know it works!! :D

For further ideas on switching commandsets (which are identical, except for the single button that buys upgrades) and the use of specific animations to play for mounting /dismounting (by using a special power instead of an OBJECT_UPGRADE button), refer to 'blackrider_SEE.ini' from S.E.E. The specialpower (and LocomotorUpgrades) would have to be installed in both horde AND hordemember, but the LuaFunctions would only be needed in the horde, just like the CommandSetMonitor) These black riders don't mount horses the usual way, as the normal mount behavior has been reserved for mounting fellbeasts.

Rob38 (Team Chamber Member) - Friday December 21, 2007 - 14:19

Yeah, the commandset is quite an annoyance but I can't find any other solution to the problem :(

JEV3 - Friday December 21, 2007 - 11:50

Pity the commandset is so unfriendly... But to have a horde be able to mount and dismount is worth it.

Rob38 (Team Chamber Member) - Thursday December 20, 2007 - 22:35

Please leave comments :)

EDIT: Fixed an error in article... HorseHordeContain is the behavior you want to use for the horde behavior

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

 
7:57:28