In MH2Gold the UDamage is given to players although the game has not been started with mouseclick.
I want to change that in MH2Base.uc and need a bool variable that is set from false to true in the moment the game has been startet and players can fight.
Level.Game.bGameEnded only works if the game ends.
Level.TimeSeconds begins already to count when the game has not been started.
I don't find any info about Level.Game.Starttime. What is that?
Anybody has a tip how to solve this?
MH: Exists variable for gamestart?
Re: MH: Exists variable for gamestart?
I also missed such an info and added it by myself by substituting class'MonsterReplicationInfo' by my own GameReplicationInfo class:Aldebaran wrote:need a bool variable that is set from false to true in the moment the game has been startet and players can fight.
Spoiler
Code: Select all
class GameReplicationInfoSB expands TournamentGameReplicationInfo;
var bool bUseLives;
var bool bUseTeamSkins;
var int Lives;
var int MonsterCount;
var int HunterCount;
var bool bGameIsRunning; // see also Object.Actor.Info.GameInfo.bGameEnded
var int Build;
var int PlayedSeconds; // amount of seconds while bGameIsRunning==true
var string MapFilename;
var float MaxAmmoScale;
// internal variables
var byte LastSec;
replication
{
reliable if ( Role == ROLE_Authority )
MonsterCount, HunterCount, bGameIsRunning;
reliable if ( bNetInitial && Role == ROLE_Authority )
Lives, Build, bUseLives, bUseTeamSkins, MapFilename, MaxAmmoScale, PlayedSeconds;
}
simulated function Timer() {
if (bGameIsRunning && Level.NetMode == NM_Client)
if (Level.TimeSeconds - SecondCount >= Level.TimeDilation)
PlayedSeconds++;
Super.Timer();
}
defaultproperties {
}
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Re: MH: Exists variable for gamestart?
Thank you very much!
I can need such a variable for other things too, so nice to have found a solution
I can need such a variable for other things too, so nice to have found a solution
- sektor2111
- Godlike
- Posts: 6410
- Joined: Sun May 09, 2010 6:15 pm
- Location: On the roof.
Re: MH: Exists variable for gamestart?
Solution exist since.... 2014.
Else you can add another one (which No one cares) when a pawn killed drops stuff (DropWhenKilled) for properly set RespawnTime=0 and velocity of item replaced dropped using some Bool on purpose tested in ReplaceWith (rewritten in Base) like bTurdKilled set True at begin of drop and false at end of drop - mention that my old friend "Return" will mock code so here is needed a "GoTo" end of function where variable is set False. Dropping from Decorations will have default RespawnTime but If drop occurred from a Pawn it won't respawn - as UT does with UnReplaced stuff to not mess inventories from 1000 Kills...
More bools can be set for controlling things... is a matter of... attention.
Else you can add another one (which No one cares) when a pawn killed drops stuff (DropWhenKilled) for properly set RespawnTime=0 and velocity of item replaced dropped using some Bool on purpose tested in ReplaceWith (rewritten in Base) like bTurdKilled set True at begin of drop and false at end of drop - mention that my old friend "Return" will mock code so here is needed a "GoTo" end of function where variable is set False. Dropping from Decorations will have default RespawnTime but If drop occurred from a Pawn it won't respawn - as UT does with UnReplaced stuff to not mess inventories from 1000 Kills...
More bools can be set for controlling things... is a matter of... attention.
Re: MH: Exists variable for gamestart?
After re-thinking about the variable bGameIsRunning I realized that it is not independent of variable bGameEnded: although not possible by current code, it may happen that bGameIsRunning==True and bGameEnded==True what results in a description of an impossible game state.
So I will change bGameIsRunning to bGameWasStarted, only once set to TRUE in Event StartMatch(). The variable bGameIsRunning can change to a function:
bGameWasStarted==False and bGameEnded==True CAN happen and makes sense, if an admin has forced the game to end before it has started.
Unfortunately bGameEnded has to be duplicated into GameReplicationInfo ("bGameWasEnded") if clients need access to it.
So I will change bGameIsRunning to bGameWasStarted, only once set to TRUE in Event StartMatch(). The variable bGameIsRunning can change to a function:
Code: Select all
simulated function bool GameIsRunning() {
if (bGameWasEnded)
return false;
else
return bGameWasStarted;
}
Unfortunately bGameEnded has to be duplicated into GameReplicationInfo ("bGameWasEnded") if clients need access to it.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
- sektor2111
- Godlike
- Posts: 6410
- Joined: Sun May 09, 2010 6:15 pm
- Location: On the roof.
Re: MH: Exists variable for gamestart?
Hint:
GameStart can be captured using a Mutator VIA ModifyPlayer - at first execution. When game Starts ModifyPlayer gets called, then a general bool variable can become True if is not True yet, so mutator will know when game has been started VIA default DM bStartMatch thing, when it goes True for a fraction of time and then it turns to False but You can capture that interval easily.
That Bool can be used later in ticks, timers, states, when things are supposed to work (Bonuses included) - for me is nonsense to have bonuses or to process any Pawnlist if game is not even being started. So to speak, I go for a cheap solution at speed optimizing: Do not execute nothing if is not needed - rule simple as a pie. No player = No move from any kind.
GameStart can be captured using a Mutator VIA ModifyPlayer - at first execution. When game Starts ModifyPlayer gets called, then a general bool variable can become True if is not True yet, so mutator will know when game has been started VIA default DM bStartMatch thing, when it goes True for a fraction of time and then it turns to False but You can capture that interval easily.
That Bool can be used later in ticks, timers, states, when things are supposed to work (Bonuses included) - for me is nonsense to have bonuses or to process any Pawnlist if game is not even being started. So to speak, I go for a cheap solution at speed optimizing: Do not execute nothing if is not needed - rule simple as a pie. No player = No move from any kind.