# verse Bounty System help :c

**URL:** <https://forums.unrealengine.com/t/verse-bounty-system-help-c/1279970>\
**Category:** Verse\
**Tags:** coding, fortnite-creative, unreal-editor-for-fortnite, please-help-me, question, fortnite\
**Created:** [September 1, 2023, 5:19pm UTC](https://forums.unrealengine.com/t/verse-bounty-system-help-c/1279970 "2023-09-01T17:19:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoxyLuca](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/noxyluca/32/1197919_2.png) [@NoxyLuca](https://forums.unrealengine.com/u/NoxyLuca)\
**Post date:** [September 1, 2023, 5:19pm UTC](https://forums.unrealengine.com/t/verse-bounty-system-help-c/1279970/1 "2023-09-01T17:19:56Z")

</div>

Hi i have been trying to make a Bounty System. But as u see in the picture i keep getting this wrong. (if u say i have to line it up with the: ‘‘if’’ it gives more errors.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/d/a/fdaf3cab28c588f3ad04789e69578941ea9b7644.png)

---

<div class="post-metadata">

**Author:** ![capen\_r](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/capen_r/32/1145494_2.png) [@capen\_r](https://forums.unrealengine.com/u/capen_r)\
**Post date:** [September 1, 2023, 7:00pm UTC](https://forums.unrealengine.com/t/verse-bounty-system-help-c/1279970/2 "2023-09-01T19:00:01Z")

</div>

Hi @NoxyLuca,

Please post your code instead of a screenshot. This will make it easier for us to try and reproduce your error. I suspect something within your inner `if` might be causing an issue.

---

<div class="post-metadata">

**Author:** ![NoxyLuca](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/noxyluca/32/1197919_2.png) [@NoxyLuca](https://forums.unrealengine.com/u/NoxyLuca)\
**Post date:** [September 1, 2023, 7:04pm UTC](https://forums.unrealengine.com/t/verse-bounty-system-help-c/1279970/3 "2023-09-01T19:04:01Z")

</div>

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

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

bounty\_board\_device := class(creative\_device)

```
@editable Bounty_Reference : player_reference_device = player_reference_device{}
@editable Bounty_Button : button_device = button_device{}

OnBegin<override>()<suspends>:void=
    Bounty_Button.InteractedWithEvent.Subscribe(GetBounty)

GetBounty(Agent : agent):void=
    AllPlayers := GetPlayspace().GetPlayers()
    PlayersNum := AllPlayers.Length

    #loops until it finds a random player index that is not the player who activated the bounty
    loop:
        RandomPlayerIndex := GetRandomInt (0, PlayersNum - 1)
        if:
            Inst_Player := player [Agent]
            Bounty_Player := AllPlayers [RandomPlayerIndex]
            Inst_Player <> Bounty_Player
        then:
            Print("Bounty Found")
            if:
               Bounty_FortChar := Bounty_Player.GetFortCharacter[]
               Bounty_Agent := Bounty_FortChar.GetAgent[]
               then:
                Bounty_Reference.Register(Bounty_Agent)
            break

```

---

<div class="post-metadata">

**Author:** ![robc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@robc](https://forums.unrealengine.com/u/robc)\
**Post date:** [September 1, 2023, 8:24pm UTC](https://forums.unrealengine.com/t/verse-bounty-system-help-c/1279970/4 "2023-09-01T20:24:25Z")

</div>

Does this work?

I didn’t run it, but it doesn’t flag any warnings.

```auto
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Random }

bounty_board_device := class(creative_device):
    @editable Bounty_Reference : player_reference_device = player_reference_device{}
    @editable Bounty_Button : button_device = button_device{}

    OnBegin<override>()<suspends>:void=
        Bounty_Button.InteractedWithEvent.Subscribe(GetBounty)

    GetBounty(Agent : agent):void=
        AllPlayers := GetPlayspace().GetPlayers()
        PlayersNum := AllPlayers.Length

        #loops until it finds a random player index that is not the player who activated the bounty
        loop:
            RandomPlayerIndex := GetRandomInt (0, PlayersNum - 1)
            if:
                Inst_Player := player [Agent]
                Bounty_Player := AllPlayers [RandomPlayerIndex]
                Inst_Player <> Bounty_Player
            then:
                Print("Bounty Found")
                if:
                   Bounty_FortChar := Bounty_Player.GetFortCharacter[]
                   Bounty_Agent := Bounty_FortChar.GetAgent[]
                then:
                    Bounty_Reference.Register(Bounty_Agent)
                break

```

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [October 1, 2023, 8:45pm UTC](https://forums.unrealengine.com/t/verse-bounty-system-help-c/1279970/6 "2023-10-01T20:45:33Z")

</div>

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