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
AshwinTheGammer

[C#]Sniper Script. Whats wrong in it?

Question

I have this script from @MadWolfGames. He made this script in Unity 2018, when I imported it into my Unity 4.7.2f1 then I got some error so I fixed it. But then after its not working. Neither scope texture is drawing nor player can reload even  ammo = 0. Ammo goes in -(negative) whenever I try to shoot after 0 bullets it doesnot reload. Below is code here: I hope you understand. He'd already done lot for me and now I don't want him to disturb. That's all!

 

Please login or register to see this code.

 

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Well then dont mention me, lol.

 

So. Have you set everything up in the Inspector? Did you start the demo scene, that I've included? Can you do a screentshot for me showing the script in Inspector and Console?

And make an video if you can.

 

Why did you change the void Fire() to IEnumerator?

Share this post


Link to post
Share on other sites

  • 0

To fix ammo going into negative amounts youll have to check the ammo before actually shooting so change this

Please login or register to see this code.

to this

Please login or register to see this code.


also youre setting isReloading after actually beginning to reload so change this

this wont however fix your reloading bug i think

Please login or register to see this code. Edited by cheezy

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.


×
×
  • Create New...