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

**URL:** <https://forums.unrealengine.com/t/this-invocation-calls-a-function-that-has-the-decides-effect-which-is-not-allowed-by-its-context/1158167>\
**Category:** Programming & Scripting\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [May 7, 2023, 10:31pm UTC](https://forums.unrealengine.com/t/this-invocation-calls-a-function-that-has-the-decides-effect-which-is-not-allowed-by-its-context/1158167 "2023-05-07T22:31:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![realTreqy](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/realtreqy/32/1113815_2.png) [@realTreqy](https://forums.unrealengine.com/u/realTreqy)\
**Post date:** [May 7, 2023, 10:31pm UTC](https://forums.unrealengine.com/t/this-invocation-calls-a-function-that-has-the-decides-effect-which-is-not-allowed-by-its-context/1158167/1 "2023-05-07T22:31:08Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Twin01](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/twin01/32/1077777_2.png) [@Twin01](https://forums.unrealengine.com/u/Twin01)\
**Post date:** [May 8, 2023, 12:27am UTC](https://forums.unrealengine.com/t/this-invocation-calls-a-function-that-has-the-decides-effect-which-is-not-allowed-by-its-context/1158167/2 "2023-05-08T00:27:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TritonSailor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TritonSailor](https://forums.unrealengine.com/u/TritonSailor)\
**Post date:** [May 8, 2023, 2:41am UTC](https://forums.unrealengine.com/t/this-invocation-calls-a-function-that-has-the-decides-effect-which-is-not-allowed-by-its-context/1158167/3 "2023-05-08T02:41:11Z")

</div>

> [@realTreqy](#):
>
> SongDuration = GetRandomInt(MinDuration, MaxDuration)

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

---

<div class="post-metadata">

**Author:** ![CosmicDanAU](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/cosmicdanau/32/642728_2.png) [@CosmicDanAU](https://forums.unrealengine.com/u/CosmicDanAU)\
**Post date:** [May 8, 2023, 3:27am UTC](https://forums.unrealengine.com/t/this-invocation-calls-a-function-that-has-the-decides-effect-which-is-not-allowed-by-its-context/1158167/4 "2023-05-08T03:27:41Z")

</div>

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](https://dev.epicgames.com/documentation/en-us/uefn/failure-in-verse) - but this is a reference page, it might not make much sense as-is.

---

<div class="post-metadata">

**Author:** ![realTreqy](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/realtreqy/32/1113815_2.png) [@realTreqy](https://forums.unrealengine.com/u/realTreqy)\
**Post date:** [May 8, 2023, 4:58am UTC](https://forums.unrealengine.com/t/this-invocation-calls-a-function-that-has-the-decides-effect-which-is-not-allowed-by-its-context/1158167/5 "2023-05-08T04:58:58Z")

</div>

Yeah, they’re integers

---

<div class="post-metadata">

**Author:** ![Galinha](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/galinha/32/881673_2.png) [@Galinha](https://forums.unrealengine.com/u/Galinha)\
**Post date:** [January 15, 2024, 8:26am UTC](https://forums.unrealengine.com/t/this-invocation-calls-a-function-that-has-the-decides-effect-which-is-not-allowed-by-its-context/1158167/6 "2024-01-15T08:26:39Z")

</div>

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

> [@This function parameter expects a value of type fort\_character, but this argument is an incompatible value of type tuple().](https://forums.unrealengine.com/t/this-function-parameter-expects-a-value-of-type-fort-character-but-this-argument-is-an-incompatible-value-of-type-tuple/1616158):
>
> How do I resolve this error within my script? I’m not able to get the loop to start. using { /Fortnite.com/Characters } using { /Fortnite.com/Devices } using { /Fortnite.com/Game } using { /Fortnite.com/UI } using { /Verse.org/Simulation } using { /Verse.org/Colors } using { /UnrealEngine.com/Temporary/SpatialMath } using { /UnrealEngine.com/Temporary/Diagnostics } effect\_neon := class(creative\_device): @editable VFXSpark: vfx\_spawner\_device = vfx\_spawner\_device{} @editable PlayerSpaw…
