The 3rd Age

Realms of the Elf-Lords

Realms of the Elf-Lords

Realms of the Elf-Lords is a mod for The Rise of the Witch-King, by Lord Firkraag.

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: 12656
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
Now that the unit is all set up, we now work on the horde. It is similar to the unit in many ways but there are several differences.

1. Set up the weaponset and locomotor upgrade. No armor one is needed for the horde.               
Code
WeaponSet
    Conditions = PLAYER_UPGRADE
    Weapon = PRIMARY NormalMeleeHordeRangefinderHD
    AutoChooseSources = PRIMARY FROM_PLAYER FROM_SCRIPT FROM_AI
End

LocomotorSet
    Locomotor = NormalCavalryHordeLocomotor
    Condition = SET_NORMAL_UPGRADED
    Speed = NORMAL_CAVALRY_FAST_HORDE_SPEED
End

2. Next, add all the crushing information to the horde. The crush weapons are not needed in the horde.
              
Code

    CrusherLevel             = 0            //Can I crush anything?
    MountedCrusherLevel         = 1     //Crush    level when mounted.
    CrushableLevel             = 0        
    MountedCrushableLevel          = 2 //Crusable level when    mounted.
    MinCrushVelocityPercent = 62% // Has to be moving at at least 25% of full speed.
    CrushDecelerationPercent = 15% // Lose 10 percent (100/5 horde members) of max velocity when crushing.
    CrushKnockback = 40 // how hard we knock back crushed units.
    CrushZFactor = 1.0 // How much we knock upwards.

3. For the horde contain, use the horse one and not the regular one.               
Code
Behavior = HorseHordeContain ModuleTag_HordeContain    
        ObjectStatusOfContained =
        InitialPayload = HelmDefender 4
        Slots = 4
        PassengerFilter = NONE +INFANTRY ;          ShowPips = No
        ThisFormationIsTheMainFormation = Yes    
        RandomOffset=X:5 Y:5
        MeleeBehavior = Amoeba
        End

        // Banner Carrier info        
    BannerCarriersAllowed    = HelmDefenderBanner            // types of units that are allowed as banner carriers
    BannerCarrierPosition    = UnitType:HelmDefenderBanner Pos:X:50.0 Y:-12.5                
    RankInfo = RankNumber:1 UnitType:HelmDefender Position:X:0 Y:0    Position:X:0 Y:25    Position:X:0 Y:-25 Position:X:0 Y:-50
        
        RanksToReleaseWhenAttacking = 1

        MeleeAttackLeashDistance = 25
        BackUpMinDelayTime        = 1        
        BackUpMaxDelayTime        = 3000        
        BackUpMinDistance        = 1            
        BackUpMaxDistance        = 3            
        BackupPercentage        = 80%        
    End

4. Add the AI Update Behavior to the horde. You Need to have the script function in the horde for it to all work.
              
Code
Behavior = HordeAIUpdate ModuleTag_HordeAIUpdate
    AutoAcquireEnemiesWhenIdle = Yes ATTACK_BUILDINGS
    MoodAttackCheckRate = 500
    MaxCowerTime         = 5000
    MinCowerTime         = 3000
AILuaEventsList    = HelmDefenderFunctions;InfantryFunctions
AttackPriority    = AttackPriority_Infantry
End




5. Copy and paste all the behaviors posted above for the unit into the horde.
              
Code
Behavior = SpecialPowerModule ModuleTag_MountSpecialStarter
    UpdateModuleStartsAttack    = Yes
    SpecialPowerTemplate        = SpecialAbilityHelmDefenderMount
    StartsPaused            = No
    SetModelCondition        = ModelConditionState:USER_6
    SetModelConditionTime        = 0.1
    End

Behavior = ModelConditionSpecialAbilityUpdate ModuleTag_MountSpecialUpdate
    SpecialPowerTemplate = SpecialAbilityHelmDefenderMount
    UnpackTime        = 500 ;100        
    PreparationTime        = 1
    PersistentPrepTime    = 0
    PackTime        = 2000
    AwardXPForTriggering = 0
    MustFinishAbility    = Yes
    WhichSpecialPower     = 3
    ; BusyForDuration    = 1000
    ; StopUnitBeforeActivating = Yes
End

Behavior = ModelConditionUpgrade ModuleTag_MountModelCondition
    TriggeredBy = Upgrade_HelmDefenderMount
    AddConditionFlags = MOUNTED
End

Behavior = ObjectCreationUpgrade ModuleTag_RemoveUpgrades1
    TriggeredBy = Upgrade_HelmDefenderDisMount    
    RemoveUpgrade = Upgrade_HelmDefenderMount
End

Behavior = ObjectCreationUpgrade ModuleTag_RemoveUpgrades2
    TriggeredBy = Upgrade_HelmDefenderMount
    RemoveUpgrade = Upgrade_HelmDefenderDisMount
End

Behavior = LocomotorSetUpgrade ModuleTag_LocomotorMount
    TriggeredBy = Upgrade_HelmDefenderMount
End

Behavior = WeaponSetUpgrade MountWeapon
    TriggeredBy     = Upgrade_HelmDefenderMount
    WeaponCondition         = PLAYER_UPGRADE
End

Behavior = ArmorUpgrade ModuleTag_MountArmor
    TriggeredBy         = Upgrade_HelmDefenderMount
    ArmorSetFlag         = PLAYER_UPGRADE
End

Behavior = CommandSetUpgrade ModuleTag_CommandSetSwitch
    TriggeredBy        = Upgrade_HelmDefenderMount
    ConflictsWith        = Upgrade_HelmDefenderDisMount
    CommandSet        = HelmDefenderDismountCommandSet
End

Behavior = CommandSetUpgrade ModuleTag_CommandSetSwitch2
    TriggeredBy    = Upgrade_HelmDefenderDisMount
    ConflictsWith    = Upgrade_HelmDefenderMount
    CommandSet    = HelmDefenderCommandSet
End


6. The AI part for the horde is a little bit different than the unit. You do not need the SpecialEnemySenseUpdate behavior and for the behavior DoCommandMount, you do not need the upgrade Upgrade_MountAI.
              
Code
Behavior = DoCommandUpgrade Module_DoCommandMount
    TriggeredBy = Upgrade_ObjectLevel1 Upgrade_ObjectUnderAIControl
    RequiresAllTriggers = Yes
    GetUpgradeCommandButtonName = Command_HelmDefenderMountAI
End

Behavior = DoCommandUpgrade Module_DoCommandDismount
    TriggeredBy = Upgrade_ObjectUnderAIControl Upgrade_DisMountAI
    RequiresAllTriggers = Yes
    GetUpgradeCommandButtonName = Command_HelmDefenderDisMountAI
End

That should do it for the horde. Now onto the banner carrier unit.

Links / Downloads

 HitsAdded
In-Depth AI Coding2062December 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."

 
13:02:59