Player in combat?

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

  1. Hazard

    Joined:
    Apr 18, 2015
    Messages:
    394
    Likes Received:
    84
  2. Salvation

    Salvation First Bot Author

    Joined:
    Aug 7, 2013
    Messages:
    264
    Likes Received:
    67
    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
     
  3. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    2,963
    Likes Received:
    874
    I use:
    if player has target || player is targetted
     
  4. Hazard

    Joined:
    Apr 18, 2015
    Messages:
    394
    Likes Received:
    84
    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?
     
  5. Eagles13

    Eagles13 The only thing Alpha about me is my bots

    Joined:
    Sep 22, 2014
    Messages:
    617
    Likes Received:
    180
    If the player isn't targeting anything, but something is targeting the player, this method will fail.
     
  6. Salvation

    Salvation First Bot Author

    Joined:
    Aug 7, 2013
    Messages:
    264
    Likes Received:
    67
    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
     
  7. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    2,963
    Likes Received:
    874
    the downfall of vague pseudocode aye
     
  8. Ozzy

    Joined:
    Nov 5, 2014
    Messages:
    504
    Likes Received:
    159
    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...