How to make a Rapid Fire Bow?

Discussion in 'Plugin Development' started by ExTheSea, Oct 30, 2012.

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

    ExTheSea

    Hey guys. As a part of my Plugin I want to make different types of bows. I already made a Shotgun-Bow a Sniper-Bow and a RocketLauncher-Bow. Now I also want to implement a Rapid Fire/MachineGun-Bow.

    Does anyone of you know how the code should be placed cause shooting itself is not a problem for me?
    My biggest problem is where to place the code.

    What I need is some type of event that gets triggered periodically. I know that the RighClickAir-Action is just triggered once when you right click...makes sense.

    Now I thought about making a routine placed in a while-loopwhich shoots an arrow. The Loop should be going on until you release the right mouse button. The loop should also handle the delay as the server would propably start breaking. I should get some type of script made easily as I made one already in Unity (Javascript). It saves the time a bullet/arrow gets shoot and only lets another one shoot if the time is bigger then the saved time + the delay time.
    Now my problems with this attempt are: - Where to stop the while-loop?
    - Where to save the time for every player?​
    I thought maybe about an array/arraylist but is there a more efficient way?​

    So if you know an answer/answers to any of the questions whether you know how to get my attempt with loop to work or whether you know a much easier maybe using an event every help is welcome.

    Cheers,
    ExTheSea
     
  2. Offline

    Tzeentchful

    The whole problem with your idea, is that you can't get when a player clicks and holds down the mouse. You can only get a click down. Also if you where to store the times for the players i would use a HashMap.
     
  3. Offline

    ExTheSea

    Short explanation:

    How to make a rapid fire bow? So it should idealy shoot arrows if you hold the mouse button down.

    Just give me some ideas/sample codes/....

    I posted this cause I realed the text above got longer then I thought it will get.

    Thanks in advance.


    Tzeentchful Yes I realized that too when I searched around. I just thought I maybe missed something.
    I meant some type of array i don't want to use the array.class I would have probably use hashmap.

    I saw other people make rapid fire bow-plugins. Did they all use spout or are the bows not firing when you hold the button down so that you have to rapidly click to rapidly fire?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  4. Offline

    Infamous Jeezy

    I suppose it could be done using a scheduler, although I don't know how smoothly or great it would work with spout.
     
  5. Offline

    ExTheSea

    Ok Thanks for your answers Tzeentchful and Infamous Jeezy. I propably end up making a bow that just don't need to be charged and then I increase the arrows speed more than i would have if I would have managed to make a real rapid fire bow so that it makes more damage.
     
Thread Status:
Not open for further replies.

Share This Page