x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Reloading small amounts - calculating ammo remainders

Basically I'm trying to manage ammo in a reload function, using variables for MaxMagAmmo, MaxBackpackAmmo, CurrentMagAmmo, and CurrentBackpackAmmo. I've also created a function that'll return the current fired ammo from the clip so I can do partial reloads.

My issue is when I start to run low on Ammo. I started with the blueprint below, which worked fine except that I always get the clip fully loaded even if I don't have a full clips worth in the backpack (because of the circled node).

alt text

So then I thought I should use some compare ints, and do a few more calculations before setting any values:

alt text

And that almost works - the backpack gets set correctly but the mag doesn't. For example, in a 20 round mag, with 20 rounds in the backpack, I fire off 8 rounds. So I have 12/20. Reload, I get 20/12 (correct). I fire off 7 rounds, I'm at 13/12.Reload again and I SHOULD be at 20/5. Instead, I'm at 18/5 (magammo incorrectly reduced by 2).

I feel like I'm waaay overcomplicating this. Is there a simpler way to run these checks with these variables?

Product Version: UE 4.16
Tags:
refill.png (129.3 kB)
refill2.png (198.1 kB)
more ▼

asked Jul 29 '17 at 09:06 PM in Using UE4

avatar image

kgkraeer
26 1 1 4

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Quick update on this for anyone looking for a simple, stable ammo counter using BPs - the blueprint demo'd here in the first third or so of the video worked perfectly for me:

https://www.youtube.com/watch?v=bXQHFS2bPb8&t=15s

more ▼

answered Aug 05 '17 at 04:12 PM

avatar image

kgkraeer
26 1 1 4

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question