Solved Custom Particle Effects

Discussion in 'Plugin Development' started by BillyBobJoe168, Apr 23, 2014.

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

    BillyBobJoe168

    Hi. I am trying to make yet another kitXD and I would like the player to have movement effects. I have found a good particle effect except for one thing. The effect I found is the ENDER_SIGNAL effect which has purple particles (part I want) but also the breaking of an ender eye (which I do not want) so I thought of making my own custom particle effects. I did some search (rarely does one come across that phraseXD) and found that there is a way to do this while making MODS.
    Code:java
    1. worldObj.spawnParticle("name", posX, posY, posZ, 0.0D, 0.0D, 0.0D);

    This is for mods and if you try to put it in Eclipse with the craftbukkit build path, it doesn't let me do spawnParticle. How would I make a custom particle effect? Maybe something like the nether portal, enderman teleport, or the end portal kind of effect and a specific location that goes away after a certain amount of time?
     
  2. Offline

    DotDash

    If this is made with CraftBukkit and no other modifications, then it's not possible.
     
  3. Offline

    BillyBobJoe168

    Well, I don't need it to only be CraftBukkit. I don't care if I have to use an API (after all, that's what they are made for right? to have more options when making plugins :)). If there is any way to do this I'd be happy to try it out!
     
  4. Offline

    DotDash

    You could use the Spout Api, but then everyone (including you), would have to use the Spout launcher to see the custom effects.
     
  5. Offline

    BillyBobJoe168

    No I don't think I like that ideaXD I'm sure there is a way...How about a nether portal effect? Or an ender chest effect? I can't seem to find it when I bring up the list of all options for Effect. I just want an effect with purple/black particles floating in the air (doesn't matter what animation it is unless it's really badXD) that isn't ENDER_SIGNAL because ENDER_SIGNAL has the ender eye breaking animation and the kit I'm making, Dark Lord, does not fit in with breaking ender eyes...
     
  6. Offline

    Bobit

    There's a few different methods for special effects:

    playsound() (contains a LOT of sounds)
    playeffect() (contains a few basic effects, like smoke)
    spawnentity() (you have to do this for a lot of particles.)


    Go to the api and ctrl-f those. Hence my signature.
    There's also a way to show block-break particles, but I'm not sure how to do that.
     
    BillyBobJoe168 likes this.
  7. Offline

    xTigerRebornx

  8. Offline

    BillyBobJoe168

    Bobit xTigerRebornx Thanks:) I will try these out and hopefully I will find something that looks great!

    Ok I used this and it works GREAT except for one thing. My code is the following:
    Code:java
    1. @EventHandler
    2. public void onDarkLordMove(PlayerMoveEvent e) {
    3. Player p = e.getPlayer();
    4. if (plugin.getPlayers().getString("players."+ p.getName() + ".currentkit").equalsIgnoreCase("darklord")) {
    5. ParticleEffect.PORTAL.display(p.getLocation(), 0.1f, 0.1f, 0.1f, 5, 1000);
    6. }
    7. }

    The problem is that the effect takes about 3 seconds (?) and when you move, it doesn't display the previous effect. Basically what happens is that when you move, it cancels the previous particle effect (which isn't finished) and starts a new one. the only way to show the complete effect is if you move a bit then just stand still. I want to be able to play the effect and while the player moves, keep playing more and more effects without canceling the previous one so it will look like the effect repeating many times as the player moves. Is there a way to do this?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  9. Offline

    BillyBobJoe168

    did some experimenting and found an effect I really like. SOLVED!
     
  10. Offline

    Bobit

    BillyBobJoe168
    What was the problem with that code? I'm interested.
     
  11. Offline

    BillyGalbreath

    Try playing with packets to spawn particles. ProtocolLib has a very extensive particle api.
     
  12. Offline

    BillyBobJoe168

    Well it's kind of hard to explain if you don't know what the effect itself looks likeXD. Anyways I suggest you try it out to get a feel for what the PORTAL effect does (if you want I will post a video for you:)). Well anyways, the effect is basically an animation. There are a bunch of purple particles (number of particles is the last int of the line) that spawn randomly around you and then slowly move toward you kind of like gravity XD. This animation actually takes about 3 seconds to complete and that is where the problem comes in (maybe I just wasn't looking correctly and there is no problem). The particles are supposed to come together but the problem is that I have it in a player move event and so every time the player moves, it plays the animation. To me, it seems that every time it plays the animation, it must cancel the previous one so when the previous effect's purple particles have not yet come together, the effect is stopped so you will always only have purple particles floating randomly around (not so close either but I fixed that problem by changing the 5 to a 1) until you stop, then the animation finishes.

    Anyways, I fixed the problem. I have an effect I like. If you want to see the result, go here. I think it looks pretty cool:) Video not uploaded yet, be patientXD Will edit when uploaded.
    Edit: Video uploaded you can check out the final effect:) Bobit (you were asking about the problem so I tagged you:))

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  13. Offline

    Bobit

    Kewl.
     
Thread Status:
Not open for further replies.

Share This Page