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

I am having an issue trying to run following codes. Im not sure which part of the context that this is being used in is causing the error.

error message is This invocation calls a function that has the ‘decides’ effect, which is not allowed by its context. The ‘decides’ effect indicates that the invocation calls a function that might fail, and so must occur in a failure context that will handle the failure. Some examples of failure contexts are the condition clause of an ‘if’, the left operand of ‘or’, or the clause of the ‘logic’ macro.

and my using codes :

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

See Create Your Own Device Using Verse for how to create a verse device.

A Verse-authored creative device that can be placed in a level

my_first_device := class(creative_device):

OnBegin<override>()<suspends> : void =

    PotionDamageAmount : float = 20.0
    PotionHealAmount : float = 10.0
    var PlayerHealth : float = 100.0

    PlayerStatusText : string = "Player health now "
    var EffectOnPlayerText: string = "damaged"

    set PlayerHealth = PlayerHealth - PotionDamageAmount
    Print("The Player was {EffectOnPlayerText + ToString(PotionDamageAmount)}")
    Print("{PlayerStatusText + ToString(PlayerHealth)}")

    set PlayerHealth = PlayerHealth + PotionHealAmount
    set EffectOnPlayerText = "healed"
    Print("The Player was {EffectOnPlayerText + ToString(PotionHealAmount)}")
    Print("{PlayerStatusText + ToString(PlayerHealth)}")

Which line is giving you trouble ? Everything works fine on my end for some reason

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.