Announcement

Collapse
No announcement yet.

Custom Gamemode problems

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Custom Gamemode problems

    Hey guys.

    I've created my own game mod and it works fine, just like I want it. The only problem is that before the game begins the player is set to spectator mope and is then forced to press the fire button to start playing. This is really annoying and I've gone through most of the game mode scripts without finding any reference to this mysterious state.
    So, my question to you is: Is there a way to bypass this phase and let the game start without the player having to press the fire button?

    Thanks in advance

    #2
    Is that not the default starting state? It could be very hard indeed to change, but it may be possible to trick the game into thinking the player has clicked. I don't really know.

    Comment


      #3
      The only mod that does as that, that I can think of is TheBall. Here is the script for the gametype:
      Code:
      class BallGame extends UTGame
      	Config(Game);
      
      simulated event PreBeginPlay()
      {
      	super.PreBeginPlay();
      	Spawn(class'TBStatTracker',,,vect(0,0,0));
      }
      
      function ReduceDamage( out int Damage, pawn injured, Controller instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType )
      {
      	Super(GameInfo).ReduceDamage( Damage, injured, instigatedBy, HitLocation, Momentum, DamageType );
      }
      
      function StartMatch()
      {
      	local Actor A;
      
      	GotoState('MatchInProgress');
      	
      	ForEach AllActors(class'Actor', A)
      		A.MatchStarting();
      
      	StartHumans();
      	bWaitingToStartMatch = false;
      	StartOnlineGame();
      	WorldInfo.NotifyMatchStarted();
      }
      
      function StartHumans()
      {
      	local PlayerController P;
      	
      	foreach WorldInfo.AllControllers(class'PlayerController', P)
      		if (P.Pawn == none && P.CanRestartPlayer())
      			RestartPlayer(P);
      }
      
      auto State PendingMatch
      {
      	function RestartPlayer(Controller aPlayer);
      	function CheckLives();
      	function bool CheckScore(PlayerReplicationInfo Scorer);
      	function ScoreKill(Controller Killer, Controller Other);
      	function ScoreFlag(Controller Scorer, UTCTFFlag theFlag);
      
      	function Timer()
      	{
      		Global.Timer();
      	}
      
      	function BeginState(Name PreviousStateName)
      	{
      		local PlayerController P;
      		
      		foreach WorldInfo.AllControllers(class'PlayerController', P)
      			if (P.PlayerReplicationInfo == none)
      				P.PlayerReplicationInfo.bOnlySpectator = false;
      			
      		bWaitingToStartMatch = true;
      		StartupStage = 0;
      	}
      
      	function EndState(Name NextStateName)
      	{
      	}
      
      Begin:
      	bQuickStart = true;
      	StartMatch();
      }
      
      state MatchInProgress
      {
      	function bool MatchIsInProgress()
      	{
      		return true;
      	}
      
      	function bool ChangeTeam(Controller Other, int Num, bool bNewTeam)
      	{
      		return false;
      	}
      
      	function Timer()
      	{
      		local PlayerController P;
      		
      		foreach WorldInfo.AllControllers(class'PlayerController', P)
      			if (P.Pawn == none)
      				P.ServerRestartPlayer();
      	}
      
      	function BeginState(Name PreviousStateName)
      	{
      		local PlayerReplicationInfo PRI;
      
      		foreach DynamicActors(class'PlayerReplicationInfo', PRI)
      			PRI.StartTime = 0;
      		
      		GameReplicationInfo.ElapsedTime = 0;
      		bWaitingToStartMatch = false;
      	}
      }
      
      function RestartPlayer(Controller NewPlayer)
      {
      	local NavigationPoint startSpot;
      	local int TeamNum, Idx;
      	local array<SequenceObject> Events;
      	local SeqEvent_PlayerSpawned SpawnedEvent;
      	local TBMonkeyController mc;
      	local TBTurretController tc;
      	local TBGoldenStatueManager gsm;
      	
      	if( bRestartLevel && WorldInfo.NetMode!=NM_DedicatedServer && WorldInfo.NetMode!=NM_ListenServer )
      		return;
      	
      	TeamNum = ((NewPlayer.PlayerReplicationInfo == None) || (NewPlayer.PlayerReplicationInfo.Team == None)) ? 255 : NewPlayer.PlayerReplicationInfo.Team.TeamIndex;
      	StartSpot = FindPlayerStart(NewPlayer, TeamNum);
      
      	if (startSpot == None)
      	{
      		if (NewPlayer.StartSpot != None)
      			StartSpot = NewPlayer.StartSpot;
      		else
      			return;
      	}
      	
      	if (NewPlayer.Pawn == None)
      		NewPlayer.Pawn = SpawnDefaultPawnFor(NewPlayer, StartSpot);
      	
      	if (NewPlayer.Pawn == None)
      	{
      		NewPlayer.GotoState('Dead');
      		
      		if ( PlayerController(NewPlayer) != None )
      			PlayerController(NewPlayer).ClientGotoState('Dead','Begin');
      	}
      	else
      	{
      		NewPlayer.Pawn.SetAnchor(startSpot);
      		
      		if ( PlayerController(NewPlayer) != None )
      		{
      			PlayerController(NewPlayer).TimeMargin = -0.1;
      			startSpot.AnchoredPawn = None;
      		}
      		
      		NewPlayer.Pawn.LastStartSpot = PlayerStart(startSpot);
      		NewPlayer.Pawn.LastStartTime = WorldInfo.TimeSeconds;
      		NewPlayer.Possess(NewPlayer.Pawn, false);
      		NewPlayer.Pawn.PlayTeleportEffect(true, true);
      		NewPlayer.ClientSetRotation(NewPlayer.Pawn.Rotation);
      
      		AddDefaultInventory(NewPlayer.Pawn);
      		SetPlayerDefaults(NewPlayer.Pawn);
      
      		if (WorldInfo.GetGameSequence() != None)
      		{
      			WorldInfo.GetGameSequence().FindSeqObjectsByClass(class'SeqEvent_PlayerSpawned',TRUE,Events);
      				
      			for (Idx = 0; Idx < Events.Length; Idx++)
      			{
      				SpawnedEvent = SeqEvent_PlayerSpawned(Events[Idx]);
      				if (SpawnedEvent != None && SpawnedEvent.CheckActivate(NewPlayer,NewPlayer))
      				{
      					SpawnedEvent.SpawnPoint = startSpot;
      					SpawnedEvent.PopulateLinkedVariableValues();
      				}
      			}
      		}
      		
      		foreach DynamicActors(class'TBMonkeyController', mc)
      		{
      			mc.SetPlayerPawn(NewPlayer.Pawn);
      		}
      
      		foreach DynamicActors(class'TBTurretController', tc)
      		{
      			tc.SetPlayerPawn(NewPlayer.Pawn);
      		}
      
      		foreach DynamicActors(class'TBGoldenStatueManager', gsm)
      		{
      			gsm.SetPlayerPawn(NewPlayer.Pawn);
      		}
      	}
      }
      
      function AddDefaultInventory(pawn PlayerPawn)
      {
      	local int i;
      
      	for (i = 0;  i < DefaultInventory.Length;  ++i)
      		if (DefaultInventory[i] != none && PlayerPawn.FindInventoryType(DefaultInventory[i]) == none)
      			PlayerPawn.CreateInventory(DefaultInventory[i], (i > 0));
      
      	PlayerPawn.AddDefaultInventory();
      }
      
      defaultproperties
      {
         Acronym="TB"
         Description="The Ball Prototype"
         SpawnProtectionTime=0.000000
         DefaultEnemyRosterClass="TheBall.TBRoster"
         DefaultInventory(0)=Class'TheBall.TBWeap_BallGun'
         DefaultInventory(1)=None
         MapPrefixes(0)="TB"
         DefaultPawnClass=Class'TheBall.TBPawn'
         HUDType=Class'TheBall.TBHud'
         GameName="The Ball"
         PlayerControllerClass=Class'TheBall.TBPlayerController'
      }
      I am not sure which line is the 1 you want though. Probably the "startmatch" part.

      Comment


        #4
        I think that it may be the 'bWaitingToStartMatch = false;' that is the specific line that causes it if I am reading this correctly.

        Comment

        Working...
        X