Solved Fireball's ground state

  • 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 community!

    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.

sandor_1234

Active Member
Jan 26, 2017
165
5
0
If i use this code:
code_language.skript:
command /test:
    trigger:
        make player shoot a fireball at speed 1
        while ground state of the last shot fireball is false:
            broadcast "&1Fireball is still in the air"
            wait 1 second
This will just keep saying "&1Fireball is still in the air" when the ground state is false.
The problem is when i use this code it should stop the while loop when the fireball hits the ground but it doesn't:
https://i.gyazo.com/72861c48da7f132a713cb831dbb19b39.mp4
@LimeGlass
 
That's because fireballs don't ever have a "ground state", you're not thinking of it correctly. The ground state is for things that are actually physically on the ground, like things that have a collision box and walk around and stuff, or have gravity that makes them stop when they hit blocks. I don't think entities that aren't affected by gravity and/or never rest on the ground can have their ground state be true. You'll instead want to check if the entity exists, or some other method to check if it has exploded (compare its position to where it was 1 second ago, use SkStuff to check its Spigots.ticksLived tag, "is alive", etc.)
 
That's because fireballs don't ever have a "ground state", you're not thinking of it correctly. The ground state is for things that are actually physically on the ground, like things that have a collision box and walk around and stuff, or have gravity that makes them stop when they hit blocks. I don't think entities that aren't affected by gravity and/or never rest on the ground can have their ground state be true. You'll instead want to check if the entity exists, or some other method to check if it has exploded (compare its position to where it was 1 second ago, use SkStuff to check its Spigots.ticksLived tag, "is alive", etc.)
I already thought like this but limeglass told me on the old forums to use his expression "Ground State" for checking if a fireball still exist.
Also the thing you mentioned above also didn't work: https://forums.skunity.com/threads/skdragon-drawdot-doesnt-disappear.514/
:emoji_frowning:
Thanks for your help
 
You're saying you already tried everything I suggested in 5 minutes and none of it worked?
 
In that one you were still checking if it's on the ground, which I don't think is correct.
 
Later in the topic some one said i should try using the is alive expression which i did but also didn't work
 
Just check for the explode event and see if the event-entity was a fireball
 
And what to do after that? How to make the on explode event stop the loop in an efficient way
code_language.skript:
let player shoot fireball at speed 1
set metadata "Custom" of shot fireball to "true"
while metadata "Custom" of shot fireball is set:
    #do stuff
on explode:
    if metadata "Custom" of event-entity is set:
        clear metadata "Custom" of event-entity
That might work if you have RandomSK or Skellett, if not, just use variables.
 
Status
Not open for further replies.