Conditional Button incorrectly returns item count of over 2.1 billion.

Summary

I am working on a tutorial video with code that involves checking the item count of a player. In the middle of recording I came across a weird bug, where the entire game freezes, crashes, and boots me to the main menu.

Please select what you are reporting on:

Unreal Editor for Fortnite

What Type of Bug are you experiencing?

Verse

Steps to Reproduce

@editable ConditionalButton : conditional_button = conditional_button{}

** later in your code **

Count := ConditionalButton.GetItemCount(Agent, 0)

if(Button = 4, Count >= 0):
for(I := 0…Count-1):
ItemGranter.GrantItem(Agent)
ItemRemover.Remove(Agent)

Expected Result

The expected result is that the loop will iterate through equal to the number of items inside the players inventory and exchange it for another item.

Observed Result

The result of this function being called is that the game freezes up, crashes, and returns me to main menu.

Platform(s)

PC - Windows 11 Version 23H2.
UEFN - Version 32.00

Island Code

No island code, this is a blank project.

Additional Notes

After a good while of adjusting things (making sure there were no logic errors), I created a dummy device explicitly so I could see the item count, I suspected that there was a verse overflow happening which is what caused the repeated crashes. The only code in this device was a button, a conditional button, and a function that printed the item count when the button was pressed. Even with my inventory being completely empty (and then again with items) it returned an item count of 2.1 billion (or 2,147, 483,647 to be exact). I have literally no idea why this is occurring, I have restarted the game, editor, and my PC several times.

depending on what item and what island settings are on it will show inf items

The items I experienced this was malachite, and copper. And, the island settings are default.

check you dont have inf building resources on that will change the outcome

infinite resources is the right answer

still never understood why it comes under building resources same as gold ? but i think its just a generic resources and i think they should have separated the two imo so building resources is just for building materials and then a setting for all other resources. Has been a issue before tbh and you need to find little work arounds.

this has been a bug for a very long time, Epic seems to have no desire to change this as it’s been reported probably at least 10 to 15 times in the last year alone.

2 Likes

@Flak

Is it possible to get the team to make a new infinity setting in the island settings ?

I think the main thing is to separate building material resources from every other type of resource.

This has been something that trips people up anyways in verse as its not a standard thing to think inf budling mats would be connected to resources like gold/copper ect and this would go along way to help with not only ease of use but less memory usage as people wouldn’t need to use devices to find a way to make it work if they cannot have inf building materials on due to resources ie gold ect being inf but having to ensure players have mats all the time aswell

It would probably be helpful just to separate just those 2 things into 2 separate lists and at a push Gold as a 3 separate resource called currency

well mentioned it what more can ya do but i do feel the guys pain as before i knew this i spent ages working it out then Twin told me in the Discord

@GraemeBB @AtAshTag, thank you for your help. I really appreciate your guidance. I am excited to finish making my video. And, about the ridiculously large numerical output with inf building materials, even if Epic has absolutely no desire to rework this it would be nice at the very minimum to simply change the return to say “inf” rather than 2.1 billion. Had I read “inf” I would’ve definitely gone and snooped around the island settings.

Either way, im really glad you were able to help me out. Cheers :clinking_glasses:

1 Like