1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Player in combat?

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

  1. Hazard

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

    Salvation First Bot Author

    Joined:
    Aug 7, 2013
    Messages:
    262
    Likes Received:
    68
    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:
    3,198
    Likes Received:
    1,041
    I use:
    if player has target || player is targetted
     
  4. Hazard

    Joined:
    Apr 18, 2015
    Messages:
    408
    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:
    618
    Likes Received:
    186
    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:
    262
    Likes Received:
    68
    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:
    3,198
    Likes Received:
    1,041
    the downfall of vague pseudocode aye
     
  8. Ozzy

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