edited April 2014 in ORK Scripting
hi!



In real-time battle, if the enemy is damage in the base attack, I want to turn off the behavior of the enemy AI, but I do not know how to invoke the event it was in when damage.



Can I set how?



I want to give (knock back) rigidity to the enemy to damage during.



Enemy is to become moved by AI Hunt of the damage in the problem now.



And I have made the animation in all Mechanim.
Post edited by gamingislove on
  • edited March 2014
    I'm trying to teach Mechanim damage motion in the Script below.
    Because it will also fight each other AI future, I want to give a Script common to all of Combatants.
    Combatants have multiple damage motion.
    Input angle of motion of attack by (360 °), has been in MotionBlending Mechanim damage motion.

    I'm thinking about in the script below, Please Can you tell me 2 questions point bellow Script?
    //part of [■■■Question Point1 and 2]

    ----------------------

    using UnityEngine;
    using System.Collections;
    using ORKFramework;
    using ORKFramework.Behaviours;

    public class EnemyAnimationController : MonoBehaviour {

    CombatantComponent combatantComponent;
    CharacterController MyCharacterController;
    Animator MyAnimator;
    NavMeshAgent MyNaviMeshAgent;

    GameObject PlayerObj = ORK.Game.GetPlayer();
    int PlayerGroupObjCombatantsNum = ORK.Game.Combatants.GetFactionGroups(0).Count;


    void Start () {
    CombatantComponent combatantComponent = gameObject.GetComponent<CombatantComponent>();
    MyAnimator = GetComponent<Animator>();
    MyCharacterController = GetComponent<CharacterController>();
    MyNaviMeshAgent = GetComponent<NavMeshAgent>();
    }

    void Update () {
    /// On Damage
    //■■■Question Point1!!!
    bool Damaged = combatantComponent.combatant.Actions.onDamage??? // <- Step1.... I want to Get On Damaged Status From ORK.Game.xxx here
    if(Damaged)
    DamageMotionHandling();
    }



    public void DamageMotionHandling()
    {

    // Get the objects Animator Component on the side damage
    //■■■Question Point2!!!
    GameObject CurrentTagettingCombatantsObject = combatantComponent.combatant.GameObject.GetComponent<MoveAIComponent>.TargetObject; // Step2...Not Work
    Animator CurrentTagettingCombatantsObjectAnimator = CurrentTagetingCombatantsObject.GetComponent<Animator>();

    // AtkAngle is Side of Damage Objects.
    // GameUser and Enemy have Swiping Angle when Attack.
    float TargetsAttackAngle = CurrentTagettingCombatantsObjectAnimator.GetFloat("AtkAngle") ;


    // Set Targets Attacked Angle
    MyAnimator.SetFloat("DamagedAtkAngle" , TargetsAttackAngle);
    MyAnimator.SetTrigger("SmallDamage");

    if(MyAnimator.GetCurrentAnimatorStateInfo(0).IsName ("SmallDamage"))
    {
    MyAnimator.applyRootMotion = true;
    }
    else
    MyAnimator.applyRootMotion = false;
    }
    }
    Post edited by joeee19 on
  • There is no on damage flag or something like that, so it would be a lot easier if you'd use ORK's event system to do this.
    After the calculate step, you can simply push the enemy back with a Change Position or one of the rigidbody steps.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited April 2014
    I see. Thank you.
    I have understand the Flag of Damage.
    I'll try to Push RigidBody Add Force.


    Can I get what if it does for Question Point2?
    I want to get Attack Angle of attack at the time of the Current Target Combatants (Attack Angle is random Float Variables from AI Attack on Enemy Combatants or user swipe angle on Player Combatants.).

    When viewed from the Combatants Game Object, I want to get in own script the Game Object of the person regardless of Player / Enemy, has become the Current Target.

    I want to set its own script to prefab of Combatants.
    Post edited by joeee19 on
  • First, you can get the move AI component of a combatant by directly calling combatant.MoveAI.

    Now, the target object of the move AI is currently not available to the outside, so you'd have to do a small change in the gameplay code and set it to public.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited April 2014
    Get it. Thank you.

    I changed the way of thinking in the Target own script's float variable by way of the [Objectable Variable].
    Because it is likely troubled by being overwritten when an update of ORK If you change the game play code.

    I found that the ORK can Get this code [Objectable Variable].

    float DamagedAngle = GetComponent<ObjectVariablesComponent>().GetHandler().GetFloat("DamagedAngle");


    I want to Send to Animator of Attack Target's GameObject the value of this Objectable Variable.
    But I can not get the GameObject AttackTargetObject of the Enemy.
    (Ai Controlled Combatant in Player's fuction)

    It is a question in the event of attackNoCalculation battle tutorial .
    After the Attack animation , to the Actor = Target,
    Is there a way to set the value of the Object Variable to Add Parameter of SendMessage or > Call Function - Menu -> Event -> Event Setting -> Add Function Step?
    (An attempt was made to set in the GUI , Add parameter menu's float parameter is manual input value only ...?)


    Or when viewed from the Enemy Combatant, Is there a good way to Get the attack the nearest target ?


    if(MyCombatant.combatant.IsPlayerControlled()){
    //TargetCombatant = ORK.Game.Combatants.GetNearest(MyCombatant.combatant,true,Range.Battle,Consider.Yes,Consider.No,Consider.Ignore); //<- OK
    }
    else{
    //TargetCombatant = ORK.Game.Combatants.GetNearest(MyCombatant.combatant,true,Range.Battle,Consider.No,Consider.No,Consider.Ignore); //<- Not Work.
    }

    Debug.Log ("TargetCombatant=" + TargetCombatant.GameObject.name);

    Animator TargetAnimator = TargetCombatant.GameObject.GetComponent<Animator>();
    TargetAnimator.SetFloat ("DamagedAngle",AtkAngle);




    and this was error to...(T_T)

    CombatantHandler combatantHandler = GetComponent(typeof(CombatantHandler)) as CombatantHandler; //<- compile error ....
    TargetCombatant = combatantHandler.GetNearest(MyCombatant.combatant,true,Range.Battle,Consider.Yes,Consider.No,Consider.Ignore);





    Post edited by joeee19 on
  • Oh...I founded!

    Combatant MyCurrentTarget = MyCombatant.combatant.Actions.AIAction.GetNearestTarget();

    Thank you!
Sign In or Register to comment.