Announcement

Collapse
No announcement yet.

Start Delay Mutator [I need Advise]

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

    Start Delay Mutator [I need Advise]

    Hello:

    I am trying to make a Start Delay Mutator that increase the CountDown at the begining of the map from 3 seconds to 10.

    The reason I am trying to increase the CountDown is to help aliviate the initial lag created by AntiCheat Mutators.

    So far this is the best that I came up with:

    Code:
    class MutStartDelay extends Mutator;
    
    var config int CountDown;
    
    function PostBeginPlay()
    {
        Super.PostBeginPlay();
    
        if(Level.Game.IsA('DeathMatch'))
        {
            DeathMatch(Level.Game).CountDown=10;
        }
    }
    
    defaultproperties
    {
        IconMaterialName="MutatorArt.nosym"
        ConfigMenuClassName=""
        Groupname="StartDelay"
        FriendlyName="StartDelay"
        Description="Add Start-up delay to the match."
    }
    But I cant get it to work, Any sugestions?

    #2
    POST happens AFTER the game starts, Use PreBeginPlay() , should work. Dont forger the super.

    Comment


      #3
      Thanks for the quick responce. I did what you told me:

      Code:
      class MutStartDelay extends Mutator;
      
      var config int CountDown;
      
      function PreBeginPlay()
      {
          if(Level.Game.IsA('DeathMatch'))
          {
              DeathMatch(Level.Game).CountDown=10;
          }
          Super.PreBeginPlay();
      }
      
      defaultproperties
      {
          IconMaterialName="MutatorArt.nosym"
          ConfigMenuClassName=""
          Groupname="StartDelay"
          FriendlyName="StartDelay"
          Description="Add Start-up delay to the match."
      }
      but it didnt work :sour:

      Comment


        #4
        Hmm, ill take a look, plus the countdown should be:
        DeathMatch(Level.Game).CountDown = CountDown;

        Comment


          #5
          It resets, in the DeathMatch Class, it resets on line 1145 idk maybe use a Tick untill it changes then Disable('Tick');

          Maybe use:
          Code:
          function Tick(float Dt)
          {
              if( Level.Game.IsA('DeathMatch') && DeathMatch(Level.Game).CountDown != CountDown  )
              {
                  DeathMatch(Level.Game).CountDown = CountDown  ;
                  Disable('Tick');
              }
          }

          Comment


            #6
            You lost me on the last post

            This is what I got now, still dont work:

            Code:
            class MutStartDelay extends Mutator;
            
            var float bCountDown;
            var int CountDown;
            
            event PreBeginPlay()
            {
                if( Level.Game.IsA('DeathMatch')
                     DeathMatch(Level.Game).CountDown=bCountDown;
            }
            
            defaultproperties
            {
                bCountDown=10
                IconMaterialName="MutatorArt.nosym"
                ConfigMenuClassName=""
                Groupname="StartDelay"
                FriendlyName="StartDelay"
                Description="Add Start-up delay to the match."
            }

            Comment


              #7
              It gets more complicated I found the Class StartupMessage

              Code:
              class StartupMessage extends CriticalEventPlus;
              
              var localized string Stage[8], NotReady, SinglePlayer;
              var sound	Riff;
              
              static simulated function ClientReceive(
              	PlayerController P,
              	optional int Switch,
              	optional PlayerReplicationInfo RelatedPRI_1,
              	optional PlayerReplicationInfo RelatedPRI_2,
              	optional Object OptionalObject
              	)
              {
              	Super.ClientReceive(P, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject);
              	if ( Switch < 7 )
              	{
              		P.Level.FillPrecacheMaterialsArray(false);
              		P.Level.FillPrecacheStaticMeshesArray(false);
              		P.PrecacheAnnouncements();
              	}
              	// don't play sound if quickstart=true, so no 'play' voiceover at start of tutorials
              	if ( Switch == 5 && P != none && P.Level != none && P.Level.Game != none && (!P.Level.Game.IsA('Deathmatch') || (!DeathMatch(P.Level.Game).bQuickstart && !DeathMatch(P.Level.Game).bSkipPlaySound)) )
              		P.PlayStatusAnnouncement('Play',1,true);
              	else if ( (Switch > 1) && (Switch < 5) )
              		P.PlayBeepSound();
              	else if ( Switch == 7 )
              		P.ClientPlaySound(Default.Riff);
              }
              
              static function string GetString(
              	optional int Switch,
              	optional PlayerReplicationInfo RelatedPRI_1,
              	optional PlayerReplicationInfo RelatedPRI_2,
              	optional Object OptionalObject
              	)
              {
              	local int i, PlayerCount;
              	local GameReplicationInfo GRI;
              
              	if ( (RelatedPRI_1 != None) && (RelatedPRI_1.Level.NetMode == NM_Standalone) )
              	{
              		if ( (DeathMatch(RelatedPRI_1.Level.Game) != None) && DeathMatch(RelatedPRI_1.Level.Game).bQuickstart )
              			return "";
              		if ( Switch < 2 )
              			return Default.SinglePlayer;
              	}
              	else if ( Switch == 0 && RelatedPRI_1 != None )
              	{
              		GRI = RelatedPRI_1.Level.GRI;
              		if (GRI == None)
              			return Default.Stage[0];
              		for (i = 0; i < GRI.PRIArray.Length; i++)
              		{
              			if ( GRI.PRIArray[i] != None && !GRI.PRIArray[i].bOnlySpectator
              			     && (!GRI.PRIArray[i].bIsSpectator || GRI.PRIArray[i].bWaitingPlayer) )
              				PlayerCount++;
              		}
              		if (GRI.MinNetPlayers - PlayerCount > 0)
              			return Default.Stage[0]@"("$(GRI.MinNetPlayers - PlayerCount)$")";
              	}
              	else if ( switch == 1 )
              	{
              		if ( (RelatedPRI_1 == None) || !RelatedPRI_1.bWaitingPlayer )
              			return Default.Stage[0];
              		else if ( RelatedPRI_1.bReadyToPlay )
              			return Default.Stage[1];
              		else
              			return Default.NotReady;
              	}
              	return Default.Stage[Switch];
              }
              
              defaultproperties
              {
              	bIsConsoleMessage=false
              	bIsUnique=true
              	bBeep=False
              	DrawColor=(R=32,G=64,B=255)
              	Stage(0)="Waiting for other players."
              	Stage(1)="Waiting for ready signals. You are READY."
              	Stage(2)="The match is about to begin...3"
              	Stage(3)="The match is about to begin...2"
              	Stage(4)="The match is about to begin...1"
              	Stage(5)="The match has begun!"
              	Stage(6)="The match has begun!"
              	Stage(7)="OVER TIME!"
              	NotReady="You are NOT READY. Press Fire!"
              	SinglePlayer="Press FIRE to start!"
              
                  Riff=sound'GameSounds.UT2K3Fanfare11'
              }
              .
              If I want to Increase the CountDown, I must then find the way to modify this class.

              Comment


                #8
                Bump, sound idea, would like this on my servers too.

                Comment


                  #9
                  What's the point of the var config int CountDown? :weird: It's just an empty var that basically does sod all, unless you had some other reason for including it?

                  Anyway, I haven't tried increasing the countdown time myself, but I have set it to '0' for an instant start match, using the same code you used:

                  Code:
                  event PostBeginPlay()
                  {
                  	Super.PostBeginPlay();
                  
                  	if ( Level.Game.IsA('DeathMatch') )
                          DeathMatch(Level.Game).Countdown = 0;
                  }
                  Which works fine. Only real difference is that I've used 'event' instead of function. Maybe try using that

                  Comment


                    #10
                    I Increased the CountDown value before, but It doesnt work, the
                    Countdown is set for 3 seconds , If we want to change that,
                    then we must change DeathMatch and StartupMessage Class,
                    and thats when things get complicated for me.


                    The reason I will like to see a longer countdown is simple, there are AntiCheats mutators that lags the game at the beginning of each game (when your system is being Scan).

                    A countdown for everybody of (10 to 20) seconds will reduce the amount of lag for the players.

                    Comment


                      #11
                      Originally posted by DarkSaber
                      What's the point of the var config int CountDown? :weird: It's just an empty var that basically does sod all, unless you had some other reason for including it?

                      Anyway, I haven't tried increasing the countdown time myself, but I have set it to '0' for an instant start match, using the same code you used:

                      Code:
                      event PostBeginPlay()
                      {
                      	Super.PostBeginPlay();
                      
                      	if ( Level.Game.IsA('DeathMatch') )
                              DeathMatch(Level.Game).Countdown = 0;
                      }
                      Which works fine. Only real difference is that I've used 'event' instead of function. Maybe try using that

                      The only differenc between event's and function is that Epic declared functions as events if they are called by native code. if you called every function event it will still work and vice versa...ex:

                      Code:
                      event DoSomething(int x)
                      {
                         log(x);
                      }
                      and

                      Code:
                      function DoSomething(int x)
                      {
                         log(x);
                      }
                      both work the exact same and are called the exact same:
                      Code:
                      DoSomething(5);

                      Comment


                        #12
                        I GOT AN IDEA!
                        Code:
                        function PreBeginPlay()
                        {
                            Super.PreBeginPlay();
                            if ( Level.Game.IsA('DeathMatch') )
                                DeathMatch(Level.Game).Default.CountDown = CountDown;
                        }
                        should work, it resets the default to yours so it wont reset to 3 i believe, try that!

                        Comment


                          #13
                          Originally posted by ^::B!G-A::
                          POST happens AFTER the game starts, Use PreBeginPlay() , should work. Dont forger the super.
                          Not true. By "BeginPlay" I think it must mean "the actor begins play", not "the game begins play". After all, Actors can and are spawned after the game starts, and PreBeginPlay() is always called for them.

                          Extract from Chain Of Events When Spawning Actors:
                          1. the Actor's initial properties are set:
                          ...
                          2. the Actor's Owner is set from the Spawn parameters
                          3. the Actor's Instigator is set to the spawning actor's Instigator
                          4. Karma physics are initialized for the actor
                          5. (in UT the actor's Spawned() event is called, in later engine versions this event is no longer available in UnrealScript)
                          6. the Actor's PreBeginPlay() event is called
                          7. the Actor's BeginPlay() event is called
                          8. the Actor's actual zone and PhysicsVolume are set
                          9. encroachment (overlapping with other actors' collision cylinders) is checked for the actor
                          10. the Actor's PostBeginPlay() event is called
                          11. the Actor's SetInitialState() event is called
                          12. the actor's base is set if it's None and the actor has bCollideActors and bShouldBaseAtStartup set to True and its Physics are set to either PHYS_None or PHYS_Rotating
                          13. the Actor's PostNetBeginPlay() event is called if this isn't a replicated actor (i.e. it was created on this machine with the Spawn() function)
                          14. (in UT now all SpawnNotify actors receive a SpawnNotification() event if this actor's class is a subclass of the class specified in their ActorClass property, in later engine versions SpawnNotifies are no longer available)
                          15. the Actor's actual Tag property is set
                          Have a read of the following UnrealWiki pages:
                          Chain_Of_Events_When_Spawning_Actors
                          Chain_Of_Events_At_Level_Startup


                          Also, calling super.PostBeginPlay() from a direct sub-class of Mutator (or Info, or Actor) calls this (declared in Actor):
                          Code:
                          event PostBeginPlay();
                          As you can see, it does nothing. This is done frequently in the existing UT(2004) code-base, but that alone shouldn't force you to do it. Generally it is a good idea to know what the function you are overriding is, what it does in the super-class(es), and thus what effect calling super.functionname() has.


                          As for the countdown, if I recall correctly, MapMixer has an option to override that.

                          Comment


                            #14
                            [EDIT, REMOVED FOR STUPIDITY]

                            [EDIT 2]
                            Still i would use Pre to set it before anything is begun.

                            Comment

                            Working...
                            X