On Damage not recognized.

  • 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.

JackTYM

Member
Sep 10, 2020
1
0
0
16
I recently starting learning Skript just to have some fun coding some small plugins. Recently I wanted to replicate a video I saw where when you hit a mob, it duplicates. The only problem is, when I do on damage: it says it "Cant understand this condition: 'on damage' (MobDupe.sk line 10: on damage:')" so is there any way I can fix this? heres my code.
Code:
variables:

        {mobs} = 2
        {stop} = 0

command /mobdupe:
        trigger:
                set {stop} to 0
                while {stop} = 0:
                        on damage:
                                victim is a mob:
                                        send "%victim% was hit by %attacker%"

(The last line was just for testing in the future I will code the rest)
 
You cannot use an event inside of a command trigger. Instead, set a variable (eg: {stop::%player%} ) and check if that is true on damage.

Code:
command /mobdupe:
  trigger:
    set {stop::%player%} to 1

on damage:
  if {stop::%attacker%} is 1:
    if victim is a mob:
      send "%victim% was hit by %attacker%" to attacker
 
Status
Not open for further replies.