The 3rd Age

Battles of Gondor, the War in the South

Battles of Gondor, the War in the South

Converts BfME2 RotWK to the war in the south, bettween the armys of Gondor and Mordor. 4.0 released.

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
14. Now comes the fun part! First, set up the special behavior modules in your object:
              
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

15. Next, set up three behaviors in the object that look something like this:               
Code
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

16. Now set up three more behaviors triggering the locomotor, armor, and weapon upgrade.               
Code
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

17. Finally, create two CommandSetUpgrade behaviors.
              
Code
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

So what in the world did we just do?! Well, when the player presses the mount commandbutton, it activates the special power modules. The actual special power does nothing. By using the script events, it recognizes when SPECIAL_POWER_THREE is activated and it triggers a function that grants the upgrade Upgrade_HelmDefenderMount. That upgrade triggers all the PLAYER_UPGRADE behaviors to activate and adds the condition flag MOUNT to your object. Now, when the player presses the dismount button, it removes the SPECIAL_POWER_THREE condition and that triggers a function that removes the upgrade Upgrade_HelmDefenderMount and grants the upgrade Upgrade_HelmDefenderDisMount That removes all the PLAYER_UPGRADE the object has and switches the commandset back to the original one.

18. Now that it works for the human player, how about the AI? You need these three behaviors in your unit object:
              
Code
Behavior = SpecialEnemySenseUpdate ModuleTag_DefenderSeesPikemen
    SpecialEnemyFilter = NONE +IsengardPikemanHorde +IsengardPikemanHordePorcupine
    ScanRange = 500
    ScanInterval = 2000
End

Behavior = DoCommandUpgrade Module_DoCommandMount
    TriggeredBy = Upgrade_ObjectLevel1 Upgrade_ObjectUnderAIControl Upgrade_MountAI
    RequiresAllTriggers = Yes
    GetUpgradeCommandButtonName = Command_HelmDefenderMount
End

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

To understand how it all works for the AI, please read Sûlherokhh's AI tutorial provided in the references below. He does an excellent job explaining how it all works.

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:46:07