Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
Sign in to follow this  
Epic-Shot

Shotgun Script only inserting one shell.

Question

Please login or register to see this code.

is there a way to make this do it 8 times. So it will put 8 Sheels in then play "EndReload" animation?

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

You need to loop the insert bullet animation if a boolean named reloading is true. Then if left click and reloading, then it will set reloading boolean to false and another boolean named stopreload to true. If stopreload is true then it will play endreload/pump animation then it will set endreload to false.

Share this post


Link to post
Share on other sites

  • 0

Boolean wont work because what if he reloads but there's still some rounds left. I'd suggest you to make an integer in shooting script, that calculates amount of bullets wasted. When you press reload this function will be called and you have to pass that integer to this function. So in this script you just have to make for loop that does the animation that integer times.

Share this post


Link to post
Share on other sites
  • 0
  1. Create a temp boolean variable: temp = true;
  2. Create a while loop with temp as param. while(temp){...}
  3. If bulletsLeft == bulletsPerClip then temp = false; return; //play end reload blah blah
  4. else play insertAnim...

Easy...

 

Share this post


Link to post
Share on other sites
  • 0

Yes, youngdeveloper you are correct lol you can also do if(bulletsInClip >= clipSize) reloadStop = true; Haha too lazy to type down whole thing. Sorry :P

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

Yea that will work, but why create another varianble ? You can just use break; command, that will break, stop the loop, or you can use return; command. That will end the function and return nothing. Because if you use booleans, each time it loops you have to check if(bla bla..) that actually takes time and wastes precious processing power.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...