Jump to content

Detecting when the player lands on the ground Skript


Recommended Posts

Posted (edited)

Hi! I'm trying to detect when the player lands, (like the title suggests).

If it helps, I'm pushing the player in the air, and then pushing them back down to make an explosion when they land.

on offhand switch:
  if {Bakugo} contains player:
    cancel event
    if {BakugoMoveset} contains 2:
      if {BakugoExplode2} is true:
        send action bar "<##FF5700>&lBlast Down on cooldown!" to player
      else:
        set {BakugoExplode2} to true
        push player up with speed 0.5
        wait 0.3 second
        push player up with speed -1
        # (Right here is where I wanna wait for the player to land and detect when they do so)
        create an explosion of force 4 at {Bakugo}
        push player up with speed 1
        wait 6 seconds
        send action bar "<##FF5700>&lBlast Down Ready!" to player
        set {BakugoExplode2} to false

Anything helps! Thanks!

Edited by Krusade
Link to comment
Share on other sites

Moved to Skript category. The Help category is for general help, Skript forum for Skript help and so on. 

rose city STICKER

RosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaR

i code, animate, develop, UI design, learn, and adapt, as well as make servers, of course

💐Joined Minehut sometime in 2014
💐VIP sometime in 2018
💐Legend in January 2021
💐Helper on 4/11/2021
💐♥ (Retired) on 5/17/2021
💐 Moderator on 8/18/2023

Link to comment
Share on other sites

  • 4 weeks later...

Unfortunately, there isn't (to my knowledge) an event that helps with this. You could check for on damage, and see if the damage type is fall, but that requires the fall distance to be large enough to trigger that event. You could also use a while loop, and check if the player's on the ground every tick (by checking if the block under the player isn't air), but that can take a toll on memory usage, and while loops are generally discouraged if you don't have a way to break it other than that. I suppose you could also use the player move event, but the amount of times that gets triggered isn't great, and sometimes it's a bit tricky to check for the exact movements you're looking for.

In short, I think while loops would be your best bet. Maybe someone who knows more Skript than I could better answer your question, but I figure it works well enough for now. Just make sure you check if the player's still online inside the loop, and definitely make sure to add a wait in there. Let me know if this helps.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...