[Supporting] Spawning bots in SND
-
sorry for opening a forum post and i feel dumb asking this because it's probably common sense and i tried a bunch of work arounds but i'm trying to see, how do you only spawn 2 bots via gsc in SND and not make it spawn 2 more every round?
i tried multiple ways. heres one example of a check I tried to do:
botCount = 0; foreach (player in level.players) { if (isDefined(player.pers["isBot"]) && player.pers["isBot"]) { botCount++; } } if (botClient < 2) { level thread handleBot(); } -
sorry for opening a forum post and i feel dumb asking this because it's probably common sense and i tried a bunch of work arounds but i'm trying to see, how do you only spawn 2 bots via gsc in SND and not make it spawn 2 more every round?
i tried multiple ways. heres one example of a check I tried to do:
botCount = 0; foreach (player in level.players) { if (isDefined(player.pers["isBot"]) && player.pers["isBot"]) { botCount++; } } if (botClient < 2) { level thread handleBot(); }mikey another method could be using a DVAR since they don't reset like normal variables.
level.botsSpawned = getDvarIntDefault( "botsSpawned", 0 ); if( !level.botsSpawned ) { setDvar( "botsSpawned", 1 ); level.botsSpawned = getDvarIntDefault( "botsSpawned", 0 ); thread handleBot(); }but then the DVAR would need to be reset at the end of the game
level waittill( "game_ended" ); setDvar( "botsSpawned", 0 ); -
mikey another method could be using a DVAR since they don't reset like normal variables.
level.botsSpawned = getDvarIntDefault( "botsSpawned", 0 ); if( !level.botsSpawned ) { setDvar( "botsSpawned", 1 ); level.botsSpawned = getDvarIntDefault( "botsSpawned", 0 ); thread handleBot(); }but then the DVAR would need to be reset at the end of the game
level waittill( "game_ended" ); setDvar( "botsSpawned", 0 );Cahz does game_ended get called on SND round switch or actual endgame? and also, how would i set after endgame if the GSC resets every round? a for loop?
-
Cahz does game_ended get called on SND round switch or actual endgame? and also, how would i set after endgame if the GSC resets every round? a for loop?
mikey Consider:
level waittill("game_ended");Followed by a check to see if it was the last round:
waslastround() -
you can do a check for last round? if so, this helps so much. thank you!
-
This post is deleted!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login