Flamethrower Ideas, Ways to create?

Discussion in 'Spigot Plugin Development' started by Nosma_Stew, Jun 18, 2017.

  1. Hello guys in Crackshot i used to create any weapons i wanted. So this is a flamethrower and i actually want to make it in a plugin. Seems easy for some people but i would love to know what is the best way to make that without causing any problems. Its actually spawning about 20 Flames, those are not fire balls. So this is got me wondering how i could do that. It might be arrows or snowballs with a particle of flames but those are real flames not particles. So i would love to know how i can do those flames and also how i can spawn so many in front of me but randomly like this.
  2. You might want to have a look at particle effects for the cool flame throwing effect, but actually setting fire to the blocks that are aimed at! That's how I'd do it.
  3. Looks like snowballs that have been set on fire to me. The best way to do this would be creating a listener for when a player right clicks with an item (what item you want to be the flame thrower) and a listener for when a projectile hits something.
  4. The point is how does the snowballs are set on fire? because this is not a particle. A flames particle would be different lthan this. But this is like when the ground is on fire, just taking this fire block.
  5. Blaze shots.
  6. And how i get those? blaze shots are in the particles?
  7. I believe so.
    Pretty sure it's called a Small Fireball or something to that effect.
  8. Hmmm i am going to check it in a few minutes, lets say i find this flames. How can i create about 20 arrows to go right in my direction (this is easy) but in my direction go to random targets like in the picture
  9. Math.random() returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0. I have been using Math.random() but there might be some better options (I have not done much searching because this works for me).

    Code (Text):
    for (int count = 0; count < 20; count++) {
                    Vector bulletDirection = player.getEyeLocation().getDirection().multiply(3);
                    bulletDirection.add(new Vector(Math.random(), Math.random(), Math.random()));
                    Arrow bullet = (Arrow) player.getWorld().spawnEntity(player.getEyeLocation(), EntityType.ARROW);
  10. Well this looks good. And then i only have to do is add the blaze shot effect?
  11. No problem! Hope it goes well :D
    • Friendly Friendly x 1
  12. Let me shower and fire up my workspace.
    I have a function that allows you to provide two locations:
    a source location and a target location and it returns a vector.

    You can call this function with different targets to lock onto
    multiple players/objects.
  13. Alright, so it took me longer than expected, but as
    I promised here is the function get a vector of any
    location looking at another location.

    Code (Text):
         * Calculates A Vector Where
         * Location 1 Is Looking Towards
         * Location 2
        public Vector calcDir(Location source, Location target){
            double rad = (Math.toRadians(Math.toDegrees(Math.atan2((source.getZ() - target.getZ()), (source.getX() - target.getX())))+90));
            return new Vector(-Math.sin(rad), 0, Math.cos(rad));
    So, if your goal is to throw fireballs at all nearby players, just
    pass in your location as the first parameter and pass in your
    victims' locations as the target, and you'll get back a Vector
    at which you can now apply to a blaze fireball.
    • Informative Informative x 1
  14. Can't you just use Vector.subtract for this?

    Code (Text):
    Will give you a vector pointing from a source location to a target location. I feel like I must be missing something in all of your complicated maths :\
  15. use crackshotplus to make items invisible
  16. Now I remember why I have that function. It won't work for what
    the OP is trying to do because that works only in 2D space for
    my Agar.io plugin along the x and z planes.
  17. Oh this is really good. So if someone is on the way the flames are returning
    because they found a location to be right?
    I could talk with the developer, this is great idea.
    Oh well :/ the thing is. Let's say I don't use arrows for this one and only a particle in the direction player is looking at. I tried to find many threads about this. I found but doesn't seem to be helping me because everyone was sayong their own things. How can I get the particle to hit a player? I mean I need to get the target of the player is looking an also take this target and damage him and also cancel it when it finds a block or an entity so it won't get through it.
  18. You're going to keep running into this same issue with every weapon you create- you're either stuck using vanilla projectiles for hit detection, or you gotta hunker down and write your own custom projectile code. At which point you could use it for this flamethrower, as well as for any other guns you make.

    Though, for a flamethrower maybe it's enough to just light fires and have the fire damage players without having to really detect what it hits?

    If that's the case this is a little simpler. You could use BlockIterator, give it the Player and it will iterate blocks from the player's location in the direction the player is looking.

    So, for each Block you get from next(), check to see if that block is Air. If it is, look below that block until you find a non-air block. Then change the air block above that solid block to fire. Then go next() again and repeat. It'll make a line of fire on the ground in the direction the player is looking. That's how my flamethrower works, anyway- I don't do anything special to damage players it hits, I just let them burn :D

    If you'd like some pointers making truly custom projectiles, lemme know.

Share This Page