1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

RPG Mob's behavior

Discussion in 'Skript' started by Turb032, Jan 28, 2021.

Thread Status:
Not open for further replies.
  1. Turb032

    Turb032 Active Member

    Joined:
    Jan 16, 2020
    Messages:
    109
    Likes Received:
    0
    Hi guys, i'm tryna make RPG mobs: When i hit a mob (zombie) it will check if the player is near or far from the damaged mob. When it checks that, if the attacker is in an area of 5 blocks around victim, it'll be the same thing (the mob hits the attacker) but, if the player is 5 blocks far from the victim, the mob's target will be cleared.
    Let me know if you did understand it, Thank you!
    Code (Text):
    1. on entity target:
    2.     if event-entity is zombie:
    3.         cancel event
    4.  
    5. on damage:
    6.     if victim = zombie:
    7.         if attacker = player:
    8.             if victim is alive:
    9.                 loop 1000 times:
    10.                     loop all entities in radius 5 around victim:
    11.                         if attacker is loop-entity:
    12.                             set victim's target to attacker
    13.                         if attacker isn't loop-entity:
    14.                             clear victim's target
    --- Double Post Merged, Jan 31, 2021, Original Post Date: Jan 28, 2021 ---
    anyone?
     
  2. Marc

    Marc Active Member

    Joined:
    Nov 27, 2020
    Messages:
    94
    Likes Received:
    0
    What is the error it gives?
     
  3. Turb032

    Turb032 Active Member

    Joined:
    Jan 16, 2020
    Messages:
    109
    Likes Received:
    0
    No errors
     
Thread Status:
Not open for further replies.

Share This Page

Loading...