Aller au contenu

Photo

how to use Combat_GetFlankingBonus.


  • Veuillez vous connecter pour répondre
5 réponses à ce sujet

#1
gordonbrown82

gordonbrown82
  • Members
  • 544 messages
I want to check if an enemy is flanked when it's hit or not and take into account combatmovement. GetFlankingBonus could possibly be used for this i suppose but does it return zero when the player doesn't flank an enemy or something else?

#2
anakin5

anakin5
  • Members
  • 258 messages
If it can help you :

int AT_IsAtFlank(object oTarget)
{
    float fAngle = GetAngleBetweenObjects(oTarget, OBJECT_SELF);
    float fFlankingAngle = GetCreatureProperty(OBJECT_SELF, PROPERTY_ATTRIBUTE_FLANKING_ANGLE);

    /* It is a bioware's patch. */
    if (fFlankingAngle <= 10.0f)
        fFlankingAngle = 60.0f;
    else if (fFlankingAngle > 180.0f)
        fFlankingAngle = 180.0f;

    if ((fAngle >= (180.0f - fFlankingAngle))
    && (fAngle <= (180.0f + fFlankingAngle)))
        return TRUE;

    return FALSE;
}

#3
gordonbrown82

gordonbrown82
  • Members
  • 544 messages
does that code take into account combat movement?

#4
anakin5

anakin5
  • Members
  • 258 messages
What do you mean ?

Being at flank or not is a state so I don't understand what you mean by "take into account combat movement"

#5
gordonbrown82

gordonbrown82
  • Members
  • 544 messages
well i just wanted to make sure that if the player has combat movement and gets an inreased flanking area because of that, the code in your first posts signals that the player is flanking. does the function you've written return 0 if the player is not flanking?

#6
_L_o_B_o_

_L_o_B_o_
  • Members
  • 117 messages

gordonbrown82 wrote...

does the function you've written return 0 if the player is not flanking?


Yes, it does. It returns TRUE if the target object is at flank and FALSE if it isn't =]

Modifié par _L_o_B_o_, 23 juin 2010 - 05:07 .