Last Hit Victim

Discussion in 'Skript' started by CRAFTBLAST111, Jul 11, 2018.

  1. I'm doing a modality called Knockback PvP and as you know it's a battle in the sky and when you shoot the player you score points.
    I require your help for the code of a record of the last hit given by the attacker so that the death message can customize it something like this "%player% has been pushed to the vacuum by %attacker%"
    and that the attacker will give him murder points and the victim will give him a point of death

    Sorry for my english
    this was translated with google translator
     
  2. Code (Text):
    on death of player:
        attacker is a player
        remove 10 from {points::%victim} #removes  points from victim
        add 10 to {points::%attacker%} #adds points to attacker
        broadcast "%victim% has been killed by %attacker%!"
     
    #2 Efnilite, Jul 11, 2018
    Last edited: Jul 11, 2018
  3. won't help since he asks for last hit, for last hit do this:
    on damage of player:
    attacker is a player
    set {attacked::%victim%} to attacker
    on death of player:
    if {attacked::%victim%} is set:
    set {_uuid} to uuid of {attacked::%victim%}
    remove 10 from {points::%uuid of victim%}
    add 10 to {points::%{_uuid}%}
     
  4. You probably want to add some sort of deletion from the attacked variable after it's been used / after a delay (like 10 seconds) after the attack happened
     
    • Agree Agree x 1
  5. But I want that when one player hits the other and I throw it to the void, I will give points to the attacker and remove points from the victim and a message will appear "%player% has been pushed to the void by%attacker%"
     
  6. Then use my code and replace %player% with %victim% in the message.
     
  7. I tried your method but it does not work
    2018-07-11_15.59.06.png
     
  8. Can you send your full code in code tags please?
     
  9. @TPGamesNL he tried mine
    Maybe try
    Code (Text):
    on death of player:
        if attacker is a player:
            if attacker is set:
                set {_att} to name of attacker
                remove 10 from {points::%victim%}
                add 10 to {points::%attacker%}
                broadcast "%victim% has been killed by %{_att}%"
            else:
                broadcast "%victim% died"
                remove 10 from {points::%victim%}
                add 10 to {points::%attacker%}
    This sends 'player died' if the attacker is <none>
     
    #9 Efnilite, Jul 12, 2018
    Last edited: Jul 13, 2018
  10. The reason I asked them to send it was because it said attacker was not set even though a condition before that resulted in the fact that attacker is a player.
     
  11. Ah ok, yeah i dont get why that didnt work
     
  12. on death of player:
    attacker is a player
    remove 10 from {points::%victim} #removes points from victim
    add 10 to {points::%attacker%} #adds points to attacker
    broadcast "%victim% has been killed by %attacker%!"
     
  13. on death:
    if attacker is a player:
    if victim is a player:
    remove 10 from {points.%victim%}
    add 10 to {points.%attacker%}
    broadcast "&b%attacker% has been killed by %victim%"

    command /points:
    trigger:
    message "&aYour points: &6%{points.%player%}%"
     
  14. not working this code
     
  15. Try adding
    Code (Text):
    attacker is set
    just after on death of a player (with spaces/tab ofcourse)
     
  16. Try this post of mine, this removes the problem of getting a attacker of <none>