UScript question: setting team spawn locations

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Plaguelord

Unreal/Deus Ex mapper
Chimeric's supposed to be THE spot for UScript gurus, so I'll get the ball rolling here...

I've coded a little mutator in UScript which basically forces all team games to become Humans vs. Bots (REALLY fun at a Lan parties). I use the ModifyPlayer function to change a player's team depending on whether he's human or bot... human = blue team, bot = red team.

There's only one little problem, it's that when players want to change teams, they respawn in their new team but their spawn point is still in their previous team. So you can basically change from Blue to Red, and spawn in the Blue team's base as a Red guy.

Here's my code for bots:

if ((Other.IsA('Bot')) && (Other.PlayerReplicationInfo.Team != 0))
{
Level.Game.ChangeTeam(Other, 0);

// The following lines don't work...!!!
StartSpot = Level.Game.FindPlayerStart(Other, 0);

if (StartSpot != None)
Other.SetLocation(StartSpot.Location);
}


Any help would be appreciated.... thanks!
 

mr.s-d

CHiMERiC Moderator
Aug 30, 2001
65
0
0
UK
www.unrealscript.com
If you look in the TeamGameInfo class, there's a bool variable bSpawnInTeamArea which when set to True forces player's to only spawn at PlayerStart's with the same team number as them.
 

Plaguelord

Unreal/Deus Ex mapper
Ok, how do I set that value to True? I get compiler errors when I type "bSpawnInTeamArea = True;" ... I run into the same problem when I want to set bBalanceTeams to False, because Balance Teams overrides my mutator for some reason...

if you could help me with this that'd be great.
 

TaoPaiPai

Commisaire Van Loc
Jun 13, 2000
1,626
0
0
Matnik
Visit site
Originally posted by Plaguelord
Ok, how do I set that value to True? I get compiler errors when I type "bSpawnInTeamArea = True;" ... I run into the same problem when I want to set bBalanceTeams to False, because Balance Teams overrides my mutator for some reason...

if you could help me with this that'd be great.
I think you have to put these in the defaultProperties section,at the end of the script ,withou semicolon at the end.

BTW I Hope your mutator will be out soon,I want to play that :)
 

Plaguelord

Unreal/Deus Ex mapper
Ok, I got it to work!! I guess I just got a little impatient with UScript, hehe.... uh. I actually used the PreBeginPlay() function as opposed to defaultproperties, so now it overrides Balance Teams, and even overrides Force Balance Teams for multiplayer games...

Once I test it with another human, I'll release it on my website Industrial Deconstruction (maybe as early as today)...