Announcement

Collapse
No announcement yet.

LastCountAmmoIssue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    LastCountAmmoIssue

    Please Help and apologies in advance if this problem has been covered before!

    I have recently taken up unreal engine, no previous experience within the field of programming so please I apologies if my terminologies or phrasing in confusing or incorrect.
    I have created a simple firing system using a ammo count or source of a whole value of 1, the ball that must be fired is 0.05 of this value subtracted. However my last shot does not appear in the testing window but the value is subtracted from the whole count, say if the whole count is 0.05 there should be a single shot left and there is but when the function is carried out only the value is subtracted to 0 but the shot does not appear.
    Any help would be greatly appreciated

    Click image for larger version

Name:	uploadproblemShooting.PNG
Views:	1
Size:	395.5 KB
ID:	1221043

    #2
    Hi JCKnight,

    I have commented on the picture here:
    Click image for larger version

Name:	TextToProblem.PNG
Views:	1
Size:	402.8 KB
ID:	1128759

    As far as I see the problem is that you first check if the player has enough ammo, then reduces ammo, then checks again without having shot. (Problem being that you reduce the ammo and checks again, even though you have already made sure that the player was allowed, before having called the functionality)
    You have to remove the last check, and maybe move the reduction of ammo until after the player has shot, since you then are sure that the functionality has worked, and you already have checked once if the player could shoot.

    Also I would recommend to use an integer (whole number without decimals) for example 1, 5 & 9 instead of a float (with decimals) for example 2.43, 5.34 & 54.22.
    The reason for this is because it makes the math simpler, and a tiny bit faster for the computer.

    An example of how I would setup the blueprint:
    Click image for larger version

Name:	problemWithAm.PNG
Views:	1
Size:	97.3 KB
ID:	1128760
    Last edited by Otixum; 05-29-2017, 05:23 PM.

    Comment

    Working...
    X