"This invocation calls a function that has the 'decides' effect, which is not allowed by its context."

Hello there!
I’ve created a variable called var SongDuration : int = 0 in my code & now I’m trying to get a random int of the variable with SongDuration = GetRandomInt(MinDuration, MaxDuration), but for some reason it’s showing me an error that says:
“This invocation calls a function that has the ‘decides’ effect, which is not allowed by its context.”

Does anybody know why it shows me that error?
Greetings!

1 Like

what are the min/max duration variables? are they integers?

You need to use set to assign a value to SongDuration. Try this: set SongDuration = GetRandomInt(MinDuration, MaxDuration)

The <decides> effect creates a failable context. As such, you need to use square brackets and handle success/failure.

However, the function GetRandomInt does NOT have the <decides> effect, so we can’t really help because of missing information. Share the full code if you can’t figure it out.

I highly recommend everyone here read the UEFN/Verse documentation, sorry for being blunt but this is pretty basic stuff - you need to learn to walk before you can run. The part of the docs specific to this is here - Failure - but this is a reference page, it might not make much sense as-is.

Yeah, they’re integers

You seem to understand a lot about Verse, can you help me with this post?