Expressions for "on death"

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Deacon

Member
Apr 17, 2017
12
0
1
33
Hi there,

I have a skript set up for 1v1s, that when one person dies, it teleports the person who killed them to the spot they were BEFORE the duel, so they don't stay in the arena.

(example: player 1 duels player 2, it saves the location of both players as {lastlocation.%player%}, then when player 2 dies, it teleports player 1 to {lastlocation.%player%}.

there is also a custom death message when one player dies, which broadcasts in chat to everyone. When that happens, this is the message:

<none> beat Player2 in a duel.

and then when it's supposed to teleport the one who killed Player2, it doesn't. I'm assuming the expressions I'm using are incorrect, so what are the expressions?

The skript:

Code:
on death of player:   
    broadcast "{@prefix} &e%attacker% &7beat &e%victim% &7in a duel."
    clear victim's inventory
    clear attacker's inventory
    teleport victim to {lastlocation.%victim%}
    heal victim
    teleport attacker to {lastlocation.%attacker%}
    heal attacker
 
Hi there,

I have a skript set up for 1v1s, that when one person dies, it teleports the person who killed them to the spot they were BEFORE the duel, so they don't stay in the arena.

(example: player 1 duels player 2, it saves the location of both players as {lastlocation.%player%}, then when player 2 dies, it teleports player 1 to {lastlocation.%player%}.

there is also a custom death message when one player dies, which broadcasts in chat to everyone. When that happens, this is the message:

<none> beat Player2 in a duel.

and then when it's supposed to teleport the one who killed Player2, it doesn't. I'm assuming the expressions I'm using are incorrect, so what are the expressions?

The skript:

Code:
on death of player:  
    broadcast "{@prefix} &e%attacker% &7beat &e%victim% &7in a duel."
    clear victim's inventory
    clear attacker's inventory
    teleport victim to {lastlocation.%victim%}
    heal victim
    teleport attacker to {lastlocation.%attacker%}
    heal attacker
The expressions are fine, but the attacker expression is only set when they die by another player. If they die of fall damage, fire or anything else, the attacker expression won't be set (so it returns `<none>`). To check if this is the problem, add a debug message for `damage cause`, e.g. `broadcast "cause: %damage cause%"`.
 
Status
Not open for further replies.