UEFN Tracker device Bug?

hello !
I’m making a system to choose between murder, murderer and innocent, but it seems like I never get around to giving the gun to the sheriff… I’ve been asking this for days and no one helps me…

using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Fortnite.com/UI }
using { /Verse.org/Simulation }
using { /Verse.org/Random }
using { /Verse.org/Assets }
using { /Verse.org/Colors }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/UI }

SeleccionRol := class(creative_device):

    var PlayerMap : [player]SeleccionAsesino = map{}

    @editable var MinimoAleatorio : int = 0
    @editable var MaximoAleatorio : int = 0

    var NumeroAleatorioJugadores : []int = array{}
    var NumeroAleatorioJugadores2 : []int = array{}

    var IndicadorJugadorMurder : int = -1
    var IndicadorJugadorSheriff : int = -1

    @editable  ItemGranterAsesino : item_granter_device = item_granter_device{}
    @editable  ItemGranterSheriff : item_granter_device = item_granter_device{}
    @editable  ItemGranterInocente : item_granter_device = item_granter_device{}

    @editable  TriggerActivador : trigger_device = trigger_device{}

    OnBegin< override>()<suspends>:void=
        Print("Carga el OnBegin a la espera del activador para SeleccionAsesino")
        TriggerActivador.TriggeredEvent.Subscribe(ObtenerJugadores)

    ObtenerJugadores(Agent : ?agent):void=
        GenerarNumeros(GetPlayspace().GetPlayers())
                    
    GenerarNumeros(Players : []player) : void =
        Print("Entro en GenerarNumeros") 
        for(Jugadores : Players):
            set NumeroAleatorioJugadores += array:
                SelectorNumeroAleatorio : int = GetRandomInt(MinimoAleatorio, MaximoAleatorio)

        ElectorMurder(Players)        

    ElectorMurder(Jugadores : []player) : void =
        Print("Entro en la Funcion ElectorMurder")
        var TemporalAleatorio : int = 0
        
        Values := for (X : NumeroAleatorioJugadores): 
    
            if(X >= TemporalAleatorio):
                set IndicadorJugadorMurder += 1
                set TemporalAleatorio = X
                Print("Valor de TemporalAleatorio en ElectorMurder: {TemporalAleatorio}")
                Print("Valor de IndicadorJugadorMurder en ElectorMurder: {IndicadorJugadorMurder}")

        if(IndicadorJugadorMurder <> -1):
            Print("Llego al if que elige al Murder dentro de ElectorMurder")
            if(Player := Jugadores[IndicadorJugadorMurder]):
                Print("Se eligio al murder numero:{IndicadorJugadorMurder}")
                ItemGranterAsesino.GrantItem(Player) 
                ElectorSheriff()

    ElectorSheriff(Jugadores : []player) : void =
        Print("Entro en la Funcion ElectorSHERIFF")  
            
        Print("Vuelvo a generar numeros aleatorios para elegir el sheriff PERO EN OTRA VARIABLE") 

        for(Player : Jugadores):
            set NumeroAleatorioJugadores2 += array:
                SelectorNumeroAleatorio2 : int = GetRandomInt(MinimoAleatorio, MaximoAleatorio)

        var TemporalAleatorio : int = 0
        
        Values := for (Y : NumeroAleatorioJugadores): 
    
            if(Y >= TemporalAleatorio):
                set IndicadorJugadorSheriff += 1
                set TemporalAleatorio = Y
                Print("Valor de TemporalAleatorio en ElectorSheriff: {TemporalAleatorio}")
                Print("Valor de IndicadorJugadorSheriff en ElectorSheriff: {IndicadorJugadorSheriff}")

        if(IndicadorJugadorSheriff <> -1 and IndicadorJugadorSheriff <> IndicadorJugadorMurder):
            Print("Llego al if que elige al Sheriff dentro de ElectorSheriff")
            if(Player := Jugadores[IndicadorJugadorSheriff]):
                Print("Se eligio al Sheriff numero:{IndicadorJugadorSheriff}")
                ItemGranterSheriff.GrantItem(Player)  
                               
        else:
            ElectorSheriff()
                    
                



                
            
   
            


            


1 Like