PDA

View Full Version : UScript question: setting team spawn locations


Plaguelord
3rd Sep 2001, 05:31 PM
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
4th Sep 2001, 11:41 AM
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
4th Sep 2001, 09:28 PM
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
5th Sep 2001, 03:33 AM
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
5th Sep 2001, 10:36 AM
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 (http://www.idecon.net) (maybe as early as today)...