View Full Version : Start Delay Mutator [I need Advise]
legacy-[PSI]PsySniper
09-12-2005, 03:29 PM
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:
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?
legacy-^::B!G-A::
09-12-2005, 04:31 PM
POST happens AFTER the game starts, Use PreBeginPlay() , should work. Dont forger the super.
legacy-[PSI]PsySniper
09-12-2005, 05:38 PM
Thanks for the quick responce. I did what you told me:
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:
legacy-^::B!G-A::
09-12-2005, 05:40 PM
Hmm, ill take a look, plus the countdown should be:
DeathMatch(Level.Game).CountDown = CountDown;
legacy-^::B!G-A::
09-12-2005, 05:45 PM
It resets, in the DeathMatch Class, it resets on line 1145 idk maybe use a Tick untill it changes then Disable('Tick');
Maybe use:
function Tick(float Dt)
{
if( Level.Game.IsA('DeathMatch') && DeathMatch(Level.Game).CountDown != CountDown )
{
DeathMatch(Level.Game).CountDown = CountDown ;
Disable('Tick');
}
}
legacy-[PSI]PsySniper
09-12-2005, 06:06 PM
You lost me on the last post :D
This is what I got now, still dont work:
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."
}
legacy-[PSI]PsySniper
09-12-2005, 06:16 PM
It gets more complicated I found the Class StartupMessage
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.
frisp
09-14-2005, 08:27 PM
Bump, sound idea, would like this on my servers too.
Radiosity
09-14-2005, 09:10 PM
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:
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 :)
legacy-[PSI]PsySniper
09-15-2005, 09:26 AM
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.
Hsoolien
09-15-2005, 10:34 AM
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:
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:
event DoSomething(int x)
{
log(x);
}
and
function DoSomething(int x)
{
log(x);
}
both work the exact same and are called the exact same:
DoSomething(5);
legacy-^::B!G-A::
09-15-2005, 03:11 PM
I GOT AN IDEA!
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! :D
porkmanii
09-17-2005, 10:00 AM
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 (http://wiki.beyondunreal.com/wiki/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 (http://wiki.beyondunreal.com/wiki/Chain_Of_Events_When_Spawning_Actors)
Chain_Of_Events_At_Level_Startup (http://wiki.beyondunreal.com/wiki/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):
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 (http://www.ataricommunity.com/forums/showthread.php?threadid=445029) has an option to override that.
legacy-^::B!G-A::
09-17-2005, 10:04 AM
[EDIT, REMOVED FOR STUPIDITY]:D
[EDIT 2]
Still i would use Pre to set it before anything is begun.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.