Solved Smoke | Soundless Explosion

Discussion in 'Plugin Development' started by KyllianGamer, May 21, 2018.

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

    KyllianGamer

    Hello, i am working on a project with different types of grenades. But my question... Now im making a smoke grenade i already got everything except the explosion that is soundless and does no damage! Can somebody help me how you do that?
     
  2. Offline

    KarimAKL

    @KyllianGamer Sorry for the late reply, my friend called me and i wanted to test if this worked before answering you so i wasn't able to answer you before now. :/ Anyway, here you go:
    Little explosion (Fireball size):
    Code:Java
    1.  
    2. player.getWorld().playEffect(location, Effect.EXPLOSION_LARGE, 0);
    3.  

    Big explosion (TNT size(maybe a little bigger))
    Code:Java
    1.  
    2. player.getWorld().playEffect(location, Effect.EXPLOSION_HUGE, 0);
    3.  

    If you just want the lille explosion effect(particle) this should make one little particle fly to some random(i think it's random) direction:
    Code:Java
    1.  
    2. player.getWorld().playEffect(location, Effect.EXPLOSION, 0);
    3.  

    Hope that helps you.
     
  3. Offline

    KyllianGamer

    @KarimAKL Okay thank you very much. Im a little bit sick ATM so i cant try it... But i will do it in the evening.
     
  4. Offline

    KarimAKL

    @KyllianGamer Okay, hope you get better. :)
    EDIT: If this works for you then remember to change the title prefix to solved. :p
     
    Last edited: May 22, 2018
  5. Offline

    KyllianGamer

    @KarimAKL Okay yes it works! Im already a little bit better... Thanks you care about :D But 1 more question.. So in my other grenades the dropped items (grenades) despawn by them selves cause of the explosion... This one doens't how do i make him despawn?
    And I also want to make those fake explosions are going after eachother... Now im just copy pasting them but is there not a way to make a loop? I already tried but then my variables like the position are not going with it and i dont know how to get those values back in the loop...
     
    Last edited: May 22, 2018
  6. Offline

    KarimAKL

    @KyllianGamer Good to know that it works and that you already are a bit better. :) About your first question, i don't really understand what you mean, do you mean items on the ground doesn't get blown up(removed) or what? If you mean items don't get blown up then i don't know if there is any easier way but maybe try and remove items on the ground within a specified radius of the explosion. About your second question, i'm still trying to learn myself so i don't know what to do about this, maybe someone else can answer this question for you.
     
  7. Offline

    KyllianGamer

    @KarimAKL About the first thing: So my plugin is made tou have grenades and those are FIREWORK_CHARGES you have to right click them to throw them, there will be a grenade removed from your stack and he wil be naturelly throwed away teh after 1/4 of a second there will be a explosion... But because the smoke grenade is not a real explosion just a effect the dropped FIREWORK_CHARGE will not despawn. And you also can't pick it up because i made it like that :D
    And about the second thing, no problem i will just copy paste them (I may not move too fast and let the others fix all my problems). Thank you very much for all you're help today :D
     
  8. Offline

    KarimAKL

    @KyllianGamer About the first thing, you could remove the firework charge right after the explosion, try removing all firework charges within a radius of 1 at the location of the explosion. (which i guess is at the location of the dropped firework charge) I can't think of anything other than that right now. About the second thing, as long as that works for now, though you'll probably find a better way later. Also, you can probably speed up the time it takes to copy and paste them but i'm not sure because i don't know how you are doing it. :p
    EDIT: You could also just remove 1 firework charge within a radius of 1 or if possible remove the exact one that blew up if you can target that with your code.
     
    Last edited: May 22, 2018
  9. Offline

    KyllianGamer

    @KarimAKL Yeah... Thats the problem i dont know how you remove a entity... I already have been searching on the internet for 1 and a half hour but i cant find it... The only thing i found was people that are removing some drops out from people that died...

    EDIT: NVM! I found it!
     
    Last edited: May 22, 2018
  10. Offline

    KarimAKL

    @KyllianGamer Good, anything else you need help with? If not then remember to change the title prefix to solved. :)
     
Thread Status:
Not open for further replies.

Share This Page