Player in combat?

Discussion in 'Developer Support' started by Hazard, Jun 29, 2015.

  1. 1: check if local player health bar is showing, if not, return false
    2: get all npcs
    3: filter the npcs to only npcs that interact with the local player
    4: filter the npcs based on attack options (if it cannot be attacked, it’s probably a follower)
    5: return true if 1 or more npcs remain
     
  2. I use:
    if player has target || player is targetted
     
  3. How about Player#getTarget().getTarget() == Players.getLocal() ?

    (Just a thought)

    If the players' target's target is the player then they are in combat with eachother, right?
     
  4. If the player isn't targeting anything, but something is targeting the player, this method will fail.
     
  5. I read this as: player is following another player, player is trading another player, player is trading an npc, player is banking, player has a pet cat
     
  6. the downfall of vague pseudocode aye
     
  7. I use a query to check if any attackable NPC's within a reasonable range have the local player as their target.
     

Share This Page

Loading...