Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. object DTAIGetTarget(object oCreature, int iCondition = 1)
  2. {
  3. object oTarget = OBJECT_INVALID; //Yet to be determined target
  4. if(iCondition == 1) //Get the closest target
  5. {
  6. //if condition passed is 1 it will do this
  7. return oTarget;
  8. }
  9. else if(iCondition == 2) //Get the strongest (highest level) target
  10. {
  11. //If condition is 2 it will do this
  12. //BUT before I accept this value I check 2 other conditions.
  13. //If these conditions are not met I alternate to the 1st condition
  14.  
  15. //If this is not the first round, and the target is out of range
  16. //we get the closest target
  17. if(DTGetCurrentRound() != 1 &&
  18. GetDistanceBetween(oCreature, oTarget) > DTGetBaseAttackRange(oCreature))
  19. { DTAIGetTarget(oCreature, 1); }
  20. return oTarget;
  21. }
  22. else if(iCondition == 3) //Get the weakest target (lowest HP)
  23. {
  24. //3rd condition, will do similar check as condition 1
  25. return oTarget;
  26. }
  27. return OBJECT_INVALID;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement