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.

Solved Looping all fox named "Forest Fox" and displaying how many there are

Discussion in 'Skript' started by BlackVen4m, Nov 9, 2021.

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

    BlackVen4m New Member

    Joined:
    Jul 19, 2021
    Messages:
    7
    Likes Received:
    0
    Hello!
    I don't know if it's possible, what I want is a command where the command I wrote will send a mesage showing how many foxes there are with the name "&cForest Fox" in the 200 block radius of player.

    Code (Text):
    1. command /enfox <text>:
    2.     trigger:
    3.         if player is op:
    4.             if arg 1 is "ext":
    5.                 spawn a fox at location of player
    6.                 set the display name of the spawned fox to "&cForest Fox"
    7.             if arg 1 is "list":
    8.                 loop all entities in radius 200 around player:
    9.                     if loop-entity is fox named "&cForest Fox":
    10.                         message "&afound!"
    11.                     else:
    12.                         message "&cfailed!"
    13.  
     
  2. yea rite

    yea rite Active Member

    Joined:
    Jul 11, 2021
    Messages:
    82
    Likes Received:
    8
    This should work, but if not idk

    Code (Text):
    1. command /enfox <text>:
    2.   trigger:
    3.     if player is op:
    4.       if arg 1 is "ext":
    5.         summon fox at location of player
    6.         set display name of last spawned entity to "Forest Fox"
    7.       if arg 1 is "list":
    8.         loop all entities in radius of 200 around player:
    9.           if display name of loop-entity is "Forest Fox":
    10.             if loop-entity is fox:
    11.               add 1 to {forestfoxes}
    12.               wait 1 ticks
    13.               send "%{forestfoxes}% forest foxes within 200 blocks!" to player
    14.               wait 1 tick
    15.               set {forestfoxes} to 0
     
  3. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    143
    Likes Received:
    5
    Code (Text):
    1. command /enfox <text>:
    2.     permission: op
    3.     trigger:
    4.         if arg-1 is "ext":
    5.             spawn fox at location of player
    6.             set display name of last spawned entity to "Forest Fox"
    7.         else if arg-1 is "list":
    8.             set {_} to size of (all foxes in radius 200 of player where [name of input is "Forest Fox"])
    9.             send "%{_}% forest foxes are within 200 blocks of you!"
    10.         else:
    11.             send "&cInvalid arguments!"
     
  4. BlackVen4m

    BlackVen4m New Member

    Joined:
    Jul 19, 2021
    Messages:
    7
    Likes Received:
    0

    Tsym it works! Hope you have a great day, and thanks for your help again! :emoji_grinning:
     
  5. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    143
    Likes Received:
    5
    Mark the post as solved. And you're welcome!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...