Rewarding players in radius who died.

Discussion in 'Community Support' started by Crysillion, Jul 7, 2020.

  1. Crysillion

    Crysillion New Member
    Premium Supporter Supporter

    Joined:
    Apr 23, 2020
    Messages:
    7
    Likes Received:
    1
    I found a lot of topics about boss battles, threat tables, handling a radius, and I learned a lot from what I found.

    But, one thing I didn't find was how to go about handling rewarding a player who was there when the boss spawned, but died.

    If I'm Player A and I attack the boss, I end up on its threat table. Very straight-forward. However, the threat table is lost when I die and end up somewhere else. What if Player B kills the boss? As Player A, because I died, I get nothing, but Player B does.

    So, I'm trying to figure out a way to kinda store the names of players near a boss, perhaps when it spawns, then execute commands based on the players in this list, then empty the list when the boss dies/despawns.

    I feel like this must be possible, but I'm not sure of a good way to handle it. Any insight would be appreciated.
     
    #1
  2. Buguser

    Buguser Active Member
    Supporter

    Joined:
    Oct 11, 2016
    Messages:
    273
    Likes Received:
    63
    Hey, you could set an aura (without any effect as it is just used for a target condition and make sure to set a high duration) on every player which damaged the boss. When the boss dies, you run the skill which handles the rewards @PlayersInWorld or @PlayersOnServer with the hasAura TargetCondtion.

    It would also work with scoreboards or variables, but due the options of the aura mechanic like CancelOnChangeWorld and CancelOnQuit i'd recommend that.

    Im not sure if this will also target players which are dead at the moment when the boss dies, for that you could try to remove the aura from players which received the reward and repeat the skill multiple times.

    Good luck! ;)
     
    #2
    Last edited: Jul 13, 2020
  3. qwerty5

    qwerty5 Member
    Premium Supporter Supporter

    Joined:
    Jul 23, 2015
    Messages:
    96
    Likes Received:
    14
    ^ Clever, give an @OnDamage tag for everyone that hits the mob
    then ~onDeath give loot to all that has the tag (or better yet tp them to boss loc 1st)
    then remove the tag.

    could even only give them the tag after hitting the boss 20+ times by adding 1 to scoreboard
    everytime a player hits the boss, this stops lazy players 1 hitting and waiting for others to finish the job!

    Havent looked into auras yet - is there anything they can do that other mechanics cant?
     
    #3
  4. Buguser

    Buguser Active Member
    Supporter

    Joined:
    Oct 11, 2016
    Messages:
    273
    Likes Received:
    63
    Yes, they have the CancelOnChangeWorld and CancelOnQuit attribute which is pretty useful as it removes the aura when the player disconnects or changes the world. That way the player cant receive the reward in another world with maybe different inventory. If a player with a score or tag disconnects the tag or score wouldn't be removed and depending on the code, bugs could appear.
     
    #4

Share This Page