Checkpoint device event does not work when the checkpoint is in an array?

Hello! I am a verse newbie and so far I am really enjoying it! However, I ran into an issue regarding the checkpoint device and the FirstActivationPerAgentEvent signal.

In this practice project, I am attempting to create a leveling system for Deathruns. I created 3 arrays for checkpoints, easy medium and hard onces. The idea is to have each checkpoint give points depending on the difficulty when they are first activated, hence the “FirstActivationPerAgentEvent” signal. However, I get the following error:

" Unknown member FirstActivationPerAgentEvent in []player_checkpoint_device.(3506)"

The error is called on the line with “EasyCheckpoint.FirstActivationPerAgentEvent.Subscribe(EasyTask)”. Does anyone know how I could fix this or what I did wrong here?

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

checkpoint_device := class(creative_device):

@editable var EasyPoint : int = 1
@editable var MediumPoint : int = 2
@editable var HardPoint : int = 3
@editable var LevelMultiplier : int = 12
@editable var EasyCheckpoint : []player_checkpoint_device = array{}
@editable var MediumCheckpoint : []player_checkpoint_device = array{}
@editable var HardCheckpoint : []player_checkpoint_device = array{}
@editable var CheckpointHudDevice : hud_message_device = hud_message_device{}
@editable var LevelHudDevice : hud_message_device = hud_message_device{}
@editable var ExpHudDevice : hud_message_device = hud_message_device{}
@editable var NotiHudDevice : hud_message_device = hud_message_device{}

var Checkpoint : int = 0
var LevelScore : int = 0
var ExpScore : int = 0

CheckpointMessage<localizes>(CheckpointText : string): message = "{CheckpointText}"
LevelMessage<localizes>(LevelText : string): message = "{LevelText}"
ExpMessage<localizes>(ExpText : string): message = "{ExpText}"
NotiMessage<localizes>(NotiText : string): message = "{NotiText}"

EasyTask(Agent: agent): void=
    set Checkpoint += 1
    set ExpScore += EasyPoint
    CheckpointHudDevice.SetText(CheckpointMessage("Checkpoint: {Checkpoint}"))
    ExpHudDevice.SetText(ExpMessage("EXP: {ExpScore}/{LevelMultiplier * LevelScore}"))
    if (LevelScore = 0 and ExpScore >= (LevelMultiplier * LevelScore)):
        set ExpScore = 0
        set LevelScore += 1
        LevelHudDevice.SetText(LevelMessage("Level: {LevelScore}"))
        ExpHudDevice.SetText(ExpMessage("EXP: {ExpScore}/{LevelMultiplier * LevelScore}"))
        NotiHudDevice.SetText(NotiMessage("You Are Now Level {LevelScore}!"))
    else if (ExpScore >= (LevelMultiplier * LevelScore)):
        set ExpScore = 0
        set LevelScore += 1
        LevelHudDevice.SetText(LevelMessage("Level: {LevelScore}"))
        ExpHudDevice.SetText(ExpMessage("EXP: {ExpScore}/{LevelMultiplier * LevelScore}"))
        NotiHudDevice.SetText(NotiMessage("You Are Now Level {LevelScore}!"))


OnBegin<override>()<suspends>:void=
    EasyCheckpoint.FirstActivationPerAgentEvent.Subscribe(EasyTask)
1 Like

Looks like you need to iterate the array (and learn what an array is while you’re at it).

Here is the code:

    OnBegin<override>()<suspends>:void=
        for. EasyCheckpointElement : EasyCheckpoint
        do. EasyCheckpointElement.FirstActivationPerAgentEvent.Subscribe(EasyTask)
2 Likes

Ohh okay I see what I was doing wrong, I was treating the checkpoint as if I was connecting one device instead of an array of them. I appreciate the help!

Yeah maybe I am moving a little too fast with the learning progress :joy: One step at a time huh!

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