how to make a fake explosion that only damages enemies

  • 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 community!

    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!

Apr 16, 2023
2
0
1
I have a right click ability on an item that creates an explosion at the players location, and I have it insta killing all entities in the explosion radius but how do i make it not kill me
[doublepost=1681667312,1681667175][/doublepost]
Code:
on join:
    set {%player%.hyperion} to 0

on right click:
    if player's held item is iron sword named "&dHyperion":
        if {%player%.hyperion} is 0:
            push player forward at speed 2.5
            set {%player%.hyperion} to 1
            create a safe explosion of force 2 at player
            kill entities in radius 4 around player
            wait 0.1 seconds
            set {%player%.hyperion} to 0
        else:
            send "&7This is on cooldown!"
         
on damage:
    if attacker is holding iron sword:
        if name of attacker's tool contains "Hyperion":
            kill attacked player
 
Last edited:
Add a check for if the victim is the attacker. If so, cancel event.
 
There are a few bad things going on with your scripts, first of all: this is bad variable formatting
Code:
{%player%.hyperion}

never use a variable/expression as the beginning of a variable name unless you know what you're doing
dont use . in variables, use lists
dont use players themselves as indexes, use their uuids.

Code:
{%player%.hyperion} -> {hyperion::%uuid of player%}
 
There are a few bad things going on with your scripts, first of all: this is bad variable formatting
Code:
{%player%.hyperion}

never use a variable/expression as the beginning of a variable name unless you know what you're doing
dont use . in variables, use lists
dont use players themselves as indexes, use their uuids.

Code:
{%player%.hyperion} -> {hyperion::%uuid of player%}
This post wasn't about the rest of their code. It was about the explosion. That's irrelevant to the post, and is pretty unhelpful when you offer criticism for code without explaining why.

Also, there's no reason to avoid using . in variables. It's like most other characters, and treated basically as an alphanumeric. I'm sure what you were trying to get at, though, is that you should be using :: in place of . when your goal is a list, since that allows you to iterate through the values of said list easier.

One more thing is you went with the assumption that this user has not enabled the boolean in the config that automatically replaces all instances of %player% in variable names with their UUID which might not be correct.

Hope this helped.
 
This post wasn't about the rest of their code. It was about the explosion. That's irrelevant to the post, and is pretty unhelpful when you offer criticism for code without explaining why.

Also, there's no reason to avoid using . in variables. It's like most other characters, and treated basically as an alphanumeric. I'm sure what you were trying to get at, though, is that you should be using :: in place of . when your goal is a list, since that allows you to iterate through the values of said list easier.

One more thing is you went with the assumption that this user has not enabled the boolean in the config that automatically replaces all instances of %player% in variable names with their UUID which might not be correct.

Hope this helped.
ok so, lists are better because if you want to delete all values under that name, you can, you wont need to loop all offline players and delete variables with . in them hoping that you remember all of them or eventually looking into the variable file.
I understand what you mean but these are basic skript concept, I'm aware that I haven't helped them with their question but just because it's not relevant it shouldn't be ignored.