Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- object DTAIGetTarget(object oCreature, int iCondition = 1)
- {
- object oTarget = OBJECT_INVALID; //Yet to be determined target
- if(iCondition == 1) //Get the closest target
- {
- //if condition passed is 1 it will do this
- return oTarget;
- }
- else if(iCondition == 2) //Get the strongest (highest level) target
- {
- //If condition is 2 it will do this
- //BUT before I accept this value I check 2 other conditions.
- //If these conditions are not met I alternate to the 1st condition
- //If this is not the first round, and the target is out of range
- //we get the closest target
- if(DTGetCurrentRound() != 1 &&
- GetDistanceBetween(oCreature, oTarget) > DTGetBaseAttackRange(oCreature))
- { DTAIGetTarget(oCreature, 1); }
- return oTarget;
- }
- else if(iCondition == 3) //Get the weakest target (lowest HP)
- {
- //3rd condition, will do similar check as condition 1
- return oTarget;
- }
- return OBJECT_INVALID;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement