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 If "region was"...

Discussion in 'Skript' started by PatoFrango, Aug 4, 2017.

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

    PatoFrango Active Member

    Joined:
    Jul 12, 2017
    Messages:
    240
    Likes Received:
    14
    Hello,

    I would like to know if there is a condition that, instead of being
    Code (Skript):
    1. if "%region at player%" contains "regionname":
    It calculates the region in which the player was before, like 1 tick ago, like
    Code (Skript):
    1. if "%region at player%" contained "regionname":
    Thank you for your time.

     
  2. Best Answer:
    Post #10 by ShaneBee, Aug 4, 2017
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    the region that the player was in 1 tick ago is most likely the same region theyre still currently in
     
  4. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    No. I mean after the player leaves that region, calculate the region which the player was in.
     
  5. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
  6. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    Still no.

    Code (Skript):
    1. on region exit:
    2.     wait 1 tick
    3.     if "%last entered region%" contains "regionname":
    4.         effects
    That's what I'm trying to do. If I just put "on region exit" and then the effects, it will execute those effects in whatever region I leave. I want to execute the effects when the player leaves that and only that specific region.
     
  7. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    what
     
  8. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    When you say effects, what do you mean? Like, just run some code after it, or execute some particle effects at the location, or apply some potion effects?
     
  9. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    Run code.
     
  10. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    i dont understand why on region exit wont work?
    Code (Skript):
    1. on region exit:
    2.     set {_last_entered_region} to region
    3.     wait 1 tick
    4.     #do stuff
     
  11. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    Okies;
    So, when you use some events, those events have special expression build into them; for example:
    • events that deal with locations can use %event-location%
    • events that deal with items can use %event-item%
    • and events that deal with regions can use %region%
    The wording for these special expressions is important, and a lot of the time there is no documentation about what expressions you're able to use in what events.

    So, for your example, I could make a region called "test" with WorldGuard and use the following code:
    Code (Skript):
    1.  
    2. on region exit:
    3.     "%region%" contains "test"
    4.     message "%region%"
    5.  
    If it works, you'll notice that the %region% expression returns "regionName in world world", which is why we need to use the contains condition when dealing with WorldGuard regions.
     
    • Useful Useful x 1
  12. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    Oh, now I see how dumb I can be. I was using %region at player% instead of just %region%. Thank you!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...