Best way to determine chance?
I have been using a method of determining chance that basically has an integer that is random and then if that number is higher than the target integer, do something. I want to know if there is a better way of determining chance by percentage. I see the integer percentage node but I am unsure how it works. So if I wanted something to happen 10% of the time, right now I would do random integer between 110 and if the number is equal to 1 let the event happen. Is there another way to achieve this?
(comments are locked)

To determine if something should happen based on percentage: IN C++ :
In Blueprints:
Nice, thank you. I should be able to implement something like this. @Azarus im curious on how the bool ShouldHappen(int percentage); { return (FMath::RandRange(1, 100 / percentage) == 1 ? true : false); } would work because wouldn't there be errors in the code? so lets say in the .h file you have bool ShouldHappen; and in the cpp you structure it that way bool ShouldHappen(int percentage); { return (FMath::RandRange(1, 100 / percentage) == 1 ? true : false); } Im asking because im getting errors and having trouble getting this to work, basically i want a 33 percent chance of a health pickup spawning
(comments are locked)

Is there a better way to determine this because this is broken.. anything over a 50% chance becomes 100%
(comments are locked)

bool ShouldHappen(int Percentage ) { return (FMath::RandRange(1, 100) <= Percentage ? true : false); } This should yield all values from 1 to 100% chance
(comments are locked)

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