# disabling bots when theres a certain amount of players?

**URL:** <https://forums.unrealengine.com/t/disabling-bots-when-theres-a-certain-amount-of-players/1135876>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [April 21, 2023, 3:22pm UTC](https://forums.unrealengine.com/t/disabling-bots-when-theres-a-certain-amount-of-players/1135876 "2023-04-21T15:22:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LawDawe](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lawdawe/32/683995_2.png) [@LawDawe](https://forums.unrealengine.com/u/LawDawe)\
**Post date:** [April 21, 2023, 3:22pm UTC](https://forums.unrealengine.com/t/disabling-bots-when-theres-a-certain-amount-of-players/1135876/1 "2023-04-21T15:22:02Z")

</div>

Hi,

im using guard\_spawner\_devices, and i have a playermap, and a @editables storing the Guard spawners

basically i want to disable guardspawners when there are more than real players

i want to use an if statement like

total players = amount of players  
if total players = 3 or more disable guardspawner  
elif total players = 4 or more disable guardspawner2  
elif total players = 5 or more disable guardspawner3  
elif total players = 6 or more disable guardspawner4  
else guardspawner, guardspawner2, guardspawner3, guardspawner4 = enable

not sure how to actually code this, having a hard time going from python3 to verse  
a better way is probably a for or while loop to do it,

only want it for 4 bots  
gone with 4 separate if statements keeps it as individual events which i kind of like.  
not if below is correct or what im missing  
my attempt so far at this:

@editable  
var Guards : []guard\_spawner\_device = array{}

var TotalPlayers : PlayerMap.Length

if (TotalPlayers := \>3):  
Guards[0].disable()  
else: Guards[0].enable()

if (TotalPlayers := \>4):  
Guards[2].disable()  
else: Guards[2].enable()

if (TotalPlayers := \>5):  
Guards[3].disable()  
else: Guards[3].enable()

if (TotalPlayers := \>6):  
Guards[4].disable()  
else: Guards[4].enable()

---

<div class="post-metadata">

**Author:** ![LawDawe](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lawdawe/32/683995_2.png) [@LawDawe](https://forums.unrealengine.com/u/LawDawe)\
**Post date:** [April 22, 2023, 2:43am UTC](https://forums.unrealengine.com/t/disabling-bots-when-theres-a-certain-amount-of-players/1135876/2 "2023-04-22T02:43:20Z")

</div>

Hi People,

for some reason i couldnt target specific devices in the @editables array,  
can for loop through it but couldnt choose a specific device tried a bunch of different ways but couldnt get it to work,

i did get it to work if i labeled each device in its own @editable.  
the below code got it to work, but its the long way, if someone can reply a better coded way.

below code works:  
\\\\\\\\\\\\\\\\\\\\\\\\\\\//////////////////////////////////////////////////

> ```
> @editable
> var Guards0 : []guard_spawner_device = array{}
> @editable
> var Guards1 : []guard_spawner_device = array{}
> @editable
> var Guards2 : []guard_spawner_device = array{}
> @editable
> var Guards3 : []guard_spawner_device = array{}
> 
> BotBalance() : void=
> AmountPlayers := GetPlayspace().GetPlayers()
> var TotalPlayers : int = PlayerMap.Length
>     
> for (Guard0 : Guards0):
> if (TotalPlayers > 3):
> Guard0.Disable()
> else Guard0.Enable()
>     
> for (Guard1 : Guards1):
> if (TotalPlayers > 4):
> Guard1.Disable()
> else Guard1.Enable()
>     
> for (Guard2 : Guards2):
> if (TotalPlayers > 5):
> Guard2.Disable()
> else Guard2.Enable()
>     
> for (Guard3 : Guards3):
> if (TotalPlayers > 6):
> Guard3.Disable()
> else Guard3.Enable()
> 
> ```
