Ensuring Projectile Hits Player

Discussion in 'Plugin Development' started by MrlolDestructo, Sep 18, 2013.

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

    MrlolDestructo

    Hey,

    I do not know if this is possible AT ALL, but is it possible to ensure that a projectile hits a player? Is it possible to edit its course or something? I'm trying to shoot a projectile that the player cannot dodge. I have the fireball and I have the player, but I don't know what else to do from here. Thanks for reading this, and thanks if you can help. :)

    ~ MrlolDestructo
     
  2. Offline

    mydeblob

    MrlolDestructo
    Not sure if this is the effect you are going for, but this will work. Make a event handler of playerinteract with the item you want (bow, or whatever else you want), and when a player uses it get the nearest player in the world (Remember to do a null check!) Get the location of the nearest player if there is one and spawn an entity there. If you need code just let me know.
     
  3. Offline

    The_Doctor_123

    So you want a homing arrow? Might actually more complicated than you think. For ever arrow shot, create a repeating task that sets the velocity relative to the nearest player. And also detect if blocks are too near so you can dodge them. The math would certainly be complicated.. and resource intensive.
     
  4. Offline

    MrlolDestructo

    Hmm yeah I thought about that, but I'm hoping for the effect. I know I could even do p.damage();, but I really want to try to get the effect. I might do this or figure out something else if it's not possible, thanks though. :)

    I don't even know if it's possible, so I figured the answer would be complicated. I'm fine with it hitting blocks I think, especially if it gets resource intensive there (Which I bet it would be), but I think the velocity thing might work. :) Thanks for the idea, I'll try it out when I can.
     
  5. Offline

    james137137

    What I would do is run some bukkit task that run every 1-10 ticks that changes the velocity of the projectile to the player. at least the chance of hitting the player would be very high (not 100% tho)
     
Thread Status:
Not open for further replies.

Share This Page