Jump to content

New Enemy Units - Implementing new AI Behavior


kexx456

Recommended Posts

Hello beautiful people!

 

I'm need of assistance. For the past months, I've been working on a new enemy unit, and I'm really close to release. I had, up until X2, zero knowledge about coding, modeling, rigging, nothing. I've been self-learning from various guides and tutorials, from several mods reading up on their code, reverse-engineering aspects here and there, and I've come really far. I've been able to not only add in a new mesh to the Archon bones, but texture them, create a corpse, create an autopsy, with self image, an item, abilities for that item, and a new ability for the enemy unit itself.

 

Now comes the hard part, perhaps the hardest. Trying to implement this new ability into the unit's AI Behavior. I've checked several "new enemy" mods out there, Muton Centurion, RiftKeeper, Venator, several Advent troops, trying to understand it, but the language is really complicated. I think I've hit a roadblock.

 

It's just one ability, and I'd like it to be the alien's priority, regardless of any condition. It's an AoE blast-radius attack.

 

Please, anyone who can help, how do I go about implementing this new behavior?

Link to comment
Share on other sites

  • 1 month later...

Hello everyone,

 

I'm still having trouble trying to implement the AI. I've had a little help, but still can't get the ability to work. Here's what the AI code looks like. Can anyone help me spot what the issues might be?

;A configuration File
;---------------------------------------------------------------------------------------
;  FILE:    XComAI.ini
;  AUTHOR:  Hydrorox  --  8/22/2016
;  PURPOSE: Adding the AI for Valkyries.
;---------------------------------------------------------------------------------------
; well put this file in the config folder and change ShockField to the ability name in all the places in this file.
[XComGame.XGAIBehavior]
;Ideal Range defaults change to your heart desire
+DefaultIdealRange=10.0f

[XComGame.X2AIBTBehaviorTree]
;ROOT BEHAVIOR
+Behaviors=(BehaviorName="Valkyrie::CharacterRoot", NodeType=Selector, Child[0]=TryJob, Child[1]=GenericGreenMovement, Child[2]=ValkyrieRedAlert, Child[3]=GenericAlertHandler)
+Behaviors=(BehaviorName=ValkyrieRedAlert, NodeType=Sequence, Child[0]=IsRedAlert, Child[1]=ValkyrieRedAbilitySelector)
+Behaviors=(BehaviorName=ValkyrieRedAbilitySelector, NodeType=Selector, Child[0]=MimicBeaconBehavior, Child[1]=ValkyrieRedFirstAction, Child[2]=ValkyrieRedLastAction)

+Behaviors=(BehaviorName=HasMultipleValkyriePoopTargets, NodeType=StatCondition, Param[0]=AbilityTargetUnitCount-ValkyriePoop, Param[1]=">=", Param[2]=2)
+Behaviors=(BehaviorName=HasAnyValkyriePoopTargets, NodeType=StatCondition, Param[0]=AbilityTargetUnitCount-ValkyriePoop, Param[1]=">=", Param[2]=1)
+Behaviors=(BehaviorName=TryValkyriePoopOnMultipleTargets, NodeType=Sequence, Child[0]=IsAbilityAvailable-ValkyriePoop, Child[1]=HasMultipleValkyriePoopTargets, Child[2]=SelectAbility-ValkyriePoop)
+Behaviors=(BehaviorName=TryValkyriePoopOnAnyTarget, NodeType=Sequence, Child[0]=IsAbilityAvailable-ValkyriePoop, Child[1]=HasAnyValkyriePoopTargets, Child[2]=SelectAbility-ValkyriePoop)
+Behaviors=(BehaviorName=TryMoveForValkyriePoop, NodeType=Sequence, Child[0]=SafeToMove, Child[1]=IsAbilityReady-ValkyriePoop, Child[2]=NotLastActionPoint, Child[3]=MoveStandardIfFirstAbility-ValkyriePoop)

;First Action
+Behaviors=(BehaviorName=ValkyrieRedFirstAction, NodeType=Sequence, Child[0]=NotLastActionPoint, Child[1]=ValkyrieRedFirstActionSelector)
+Behaviors=(BehaviorName=ValkyrieRedFirstActionSelector, NodeType=Selector, \\
    Child[0]=TryValkyriePoopOnMultipleTargets, \\
    Child[1]=TryMoveForValkyriePoop, \\
    Child[2]=TryFrenziedMoveAndAttack, \\
    Child[3]=TryMoveThenBlazingPinions, \\
    Child[4]=TryStandardMelee, \\
    Child[5]=DoIfFlankedMove, \\
    Child[6]=SelectMoveStandard, \\
    Child[7]=TryShootOrReloadOrOverwatch, \\
    Child[8]=HuntEnemyWithCover)
    
;Last Action    
+Behaviors=(BehaviorName=ValkyrieRedLastAction, NodeType=Sequence, Child[0]=IsLastActionPoint, Child[1]=ValkyrieRedLastActionSelector)
+Behaviors=(BehaviorName=ValkyrieRedLastActionSelector, NodeType=Selector, \\
    Child[0]=TryValkyriePoopOnAnyTarget, \\
    Child[1]=TryFrenziedAttack, \\
    Child[2]=TryBlazingPinions, \\
    Child[3]=TryStandardMelee, \\
    Child[4]=TryShootOrReloadOrOverwatch, \\
    Child[5]=HuntEnemy, \\
    Child[6]=SelectMoveStandard)

;Melee Action    
+Behaviors=(BehaviorName=TryFrenziedAttack, NodeType=Sequence, Child[0]=AffectedByEffect-FrenzyEffect, Child[1]=TryStandardMelee)
+Behaviors=(BehaviorName=TryFrenziedMoveAndAttack, NodeType=Sequence, Child[0]=AffectedByEffect-FrenzyEffect, Child[1]=TryAttackOrDashAndAttack)
+Behaviors=(BehaviorName=TryAttackOrDashAndAttack, NodeType=Selector, Child[0]=TryStandardMelee, Child[1]=TryStandardMeleeDashFANATICUnsafe)

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...