Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

help with gun ammo using ints

Discussion in 'Editor & General Support' started by whycantipickaname, May 24, 2020.

  1. whycantipickaname

    whycantipickaname

    Joined:
    Feb 21, 2020
    Posts:
    14
    so i am trying to make a reload system. i am using unity fps prefab so i have raycast shooting and stuff like that. i was wondering if i could get help with reloading. so basically i was thinking i could do a script where every 7 shots it disables the shooting script for 3 seconds(as if you are reloading) so i need help with making a script that has a default int set to 0 and every LMB click it goes up by one once it gets to 7 it resets and starts the 3 second disable of my shooting script
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,735
    Sounds like a good approach. Maybe you could also make it so if the user presses a certain button or key they can reload before using up their ammo too. It would also be nice for the user to have some kind of indicator of how many bullets they have left.
     
  3. whycantipickaname

    whycantipickaname

    Joined:
    Feb 21, 2020
    Posts:
    14
    i was thinking somthing like that but than i found out how to do the reload and i thought it would be more realistic if the player didnt see there ammo and if they could see it if they reload they lose the bullets in that mag