Post: Calculated Match Bonus
01-13-2015, 09:54 PM #1
Invalidate
Save Point
(adsbygoogle = window.adsbygoogle || []).push({}); Hey guys I doubt any of you remember me. I used to be zFlaVouR & was fairly known back in the mw2 1.12 days. Either way I wanted to make a calculated match bonus for S&Awesome face in BO2 priv match. I just came across an issue when adding the formula to the .gsc

    self.matchbonus = int(((55+6) /12) * [COLOR="#FF0000"]time elapsed[/COLOR]);


as you can tell I'm missing a timer/interval that follows the ingame round timer of 120 seconds for the match bonus to be calculated properly. Please let me know if you can help, thank you in advance.
Last edited by Invalidate ; 01-14-2015 at 12:06 PM.
01-14-2015, 07:42 PM #11
Originally posted by Invalidate View Post
both freeze your ps3 :L

Neither froze me. You must be using it incorrectly.
01-14-2015, 08:55 PM #12
justinster
Error… Cat invasion!
Originally posted by FeverDEX View Post
gettime();

and you can just use "level.rankedmatch = true;" to enable match bonus in a private match :fa:


does that also mean that the match will show on your combat record ?"
01-15-2015, 12:03 AM #13
jwm614
NextGenUpdate Elite
heres how the game updates its havent really looked at it tho

    updateMatchBonusScores( winner )
{
if ( !game["timepassed"] )
return;

if ( !level.rankedMatch )
return;

// dont give the bonus until the game is over
if ( level.teamBased && isDefined( winner ) )
{
if ( winner == "endregulation" )
return;
}

if ( !level.timeLimit || level.forcedEnd )
{
gameLength = maps\mp\gametypes\_globallogic_utils::getTimePassed() / 1000;
// cap it at 20 minutes to avoid exploiting
gameLength = min( gameLength, 1200 );

// the bonus for final fight needs to be based on the total time played
if ( level.gameType == "twar" && game["roundsplayed"] > 0 )
gameLength += level.timeLimit * 60;
}
else
{
gameLength = level.timeLimit * 60;
}

if ( level.teamBased )
{
winningTeam = "tie";

// TODO MTEAM - not sure if this is absolutely necessary but I dont know
// if "winner" is anything other then a valid team or "tie" at this point
foreach ( team in level.teams )
{
if ( winner == team )
{
winningTeam = team;
break;
}
}

if ( winningTeam != "tie" )
{
winnerScale = 1.0;
loserScale = 0.5;
}
else
{
winnerScale = 0.75;
loserScale = 0.75;
}

players = level.players;
for( i = 0; i < players.size; i++ )
{
player = players[i];

if ( player.timePlayed["total"] < 1 || player.pers["participation"] < 1 )
{
player thread maps\mp\gametypes\_rank::endGameUpdate();
continue;
}

totalTimePlayed = player.timePlayed["total"];

// make sure the players total time played is no
// longer then the game length to prevent exploits
if ( totalTimePlayed > gameLength )
{
totalTimePlayed = gameLength;
}

// no bonus for hosts who force ends
if ( level.hostForcedEnd && player IsHost() )
continue;

// no match bonus if negative game score
if ( player.pers["score"] < 0 )
continue;

spm = player maps\mp\gametypes\_rank::getSPM();
if ( winningTeam == "tie" )
{
playerScore = int( (winnerScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "tie", playerScore );
player.matchBonus = playerScore;
}
else if ( isDefined( player.pers["team"] ) && player.pers["team"] == winningTeam )
{
playerScore = int( (winnerScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "win", playerScore );
player.matchBonus = playerScore;
}
else if ( isDefined(player.pers["team"] ) && player.pers["team"] != "spectator" )
{
playerScore = int( (loserScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "loss", playerScore );
player.matchBonus = playerScore;
}
}
}
else
{
if ( isDefined( winner ) )
{
winnerScale = 1.0; // win
loserScale = 0.5; // loss
}
else
{
winnerScale = 0.75; // tie
loserScale = 0.75; // tie
}

players = level.players;
for( i = 0; i < players.size; i++ )
{
player = players[i];

if ( player.timePlayed["total"] < 1 || player.pers["participation"] < 1 )
{
player thread maps\mp\gametypes\_rank::endGameUpdate();
continue;
}

totalTimePlayed = player.timePlayed["total"];

// make sure the players total time played is no
// longer then the game length to prevent exploits
if ( totalTimePlayed > gameLength )
{
totalTimePlayed = gameLength;
}

spm = player maps\mp\gametypes\_rank::getSPM();

isWinner = false;
for ( pIdx = 0; pIdx < min( level.placement["all"][0].size, 3 ); pIdx++ )
{
if ( level.placement["all"][pIdx] != player )
continue;
isWinner = true;
}

if ( isWinner )
{
playerScore = int( (winnerScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "win", playerScore );
player.matchBonus = playerScore;
}
else
{
playerScore = int( (loserScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "loss", playerScore );
player.matchBonus = playerScore;
}
}
}
}



    


giveMatchBonus( scoreType, score )
{
self endon ( "disconnect" );

level waittill ( "give_match_bonus" );

self AddRankXPValue( scoreType, score );

self maps\mp\gametypes\_rank::endGameUpdate();
}
08-30-2015, 05:16 PM #14
Originally posted by jwm614 View Post
heres how the game updates its havent really looked at it tho

    updateMatchBonusScores( winner )
{
if ( !game["timepassed"] )
return;

if ( !level.rankedMatch )
return;

// dont give the bonus until the game is over
if ( level.teamBased && isDefined( winner ) )
{
if ( winner == "endregulation" )
return;
}

if ( !level.timeLimit || level.forcedEnd )
{
gameLength = maps\mp\gametypes\_globallogic_utils::getTimePassed() / 1000;
// cap it at 20 minutes to avoid exploiting
gameLength = min( gameLength, 1200 );

// the bonus for final fight needs to be based on the total time played
if ( level.gameType == "twar" && game["roundsplayed"] > 0 )
gameLength += level.timeLimit * 60;
}
else
{
gameLength = level.timeLimit * 60;
}

if ( level.teamBased )
{
winningTeam = "tie";

// TODO MTEAM - not sure if this is absolutely necessary but I dont know
// if "winner" is anything other then a valid team or "tie" at this point
foreach ( team in level.teams )
{
if ( winner == team )
{
winningTeam = team;
break;
}
}

if ( winningTeam != "tie" )
{
winnerScale = 1.0;
loserScale = 0.5;
}
else
{
winnerScale = 0.75;
loserScale = 0.75;
}

players = level.players;
for( i = 0; i < players.size; i++ )
{
player = players[i];

if ( player.timePlayed["total"] < 1 || player.pers["participation"] < 1 )
{
player thread maps\mp\gametypes\_rank::endGameUpdate();
continue;
}

totalTimePlayed = player.timePlayed["total"];

// make sure the players total time played is no
// longer then the game length to prevent exploits
if ( totalTimePlayed > gameLength )
{
totalTimePlayed = gameLength;
}

// no bonus for hosts who force ends
if ( level.hostForcedEnd && player IsHost() )
continue;

// no match bonus if negative game score
if ( player.pers["score"] < 0 )
continue;

spm = player maps\mp\gametypes\_rank::getSPM();
if ( winningTeam == "tie" )
{
playerScore = int( (winnerScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "tie", playerScore );
player.matchBonus = playerScore;
}
else if ( isDefined( player.pers["team"] ) && player.pers["team"] == winningTeam )
{
playerScore = int( (winnerScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "win", playerScore );
player.matchBonus = playerScore;
}
else if ( isDefined(player.pers["team"] ) && player.pers["team"] != "spectator" )
{
playerScore = int( (loserScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "loss", playerScore );
player.matchBonus = playerScore;
}
}
}
else
{
if ( isDefined( winner ) )
{
winnerScale = 1.0; // win
loserScale = 0.5; // loss
}
else
{
winnerScale = 0.75; // tie
loserScale = 0.75; // tie
}

players = level.players;
for( i = 0; i < players.size; i++ )
{
player = players[i];

if ( player.timePlayed["total"] < 1 || player.pers["participation"] < 1 )
{
player thread maps\mp\gametypes\_rank::endGameUpdate();
continue;
}

totalTimePlayed = player.timePlayed["total"];

// make sure the players total time played is no
// longer then the game length to prevent exploits
if ( totalTimePlayed > gameLength )
{
totalTimePlayed = gameLength;
}

spm = player maps\mp\gametypes\_rank::getSPM();

isWinner = false;
for ( pIdx = 0; pIdx < min( level.placement["all"][0].size, 3 ); pIdx++ )
{
if ( level.placement["all"][pIdx] != player )
continue;
isWinner = true;
}

if ( isWinner )
{
playerScore = int( (winnerScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "win", playerScore );
player.matchBonus = playerScore;
}
else
{
playerScore = int( (loserScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "loss", playerScore );
player.matchBonus = playerScore;
}
}
}
}



    


giveMatchBonus( scoreType, score )
{
self endon ( "disconnect" );

level waittill ( "give_match_bonus" );

self AddRankXPValue( scoreType, score );

self maps\mp\gametypes\_rank::endGameUpdate();
}


If i use that code will the match bonus work for me and everyone else in the lobby
08-30-2015, 08:57 PM #15
itsSorrow
In my man cave
Originally posted by Mrtbyhyourwme View Post
If i use that code will the match bonus work for me and everyone else in the lobby


no.. thats not it.. look up "Match bonus no freeze"
08-31-2015, 04:07 AM #16
FlavorModz
Do a barrel roll!
Originally posted by Invalidate View Post
Hey guys I doubt any of you remember me. I used to be zFlaVouR & was fairly known back in the mw2 1.12 days. Either way I wanted to make a calculated match bonus for S&Awesome face in BO2 priv match. I just came across an issue when adding the formula to the .gsc

    self.matchbonus = int(((55+6) /12) * [COLOR="#FF0000"]time elapsed[/COLOR]);


as you can tell I'm missing a timer/interval that follows the ingame round timer of 120 seconds for the match bonus to be calculated properly. Please let me know if you can help, thank you in advance.


yo here it is for Snd..

on onplayerspawned()


        self thread timegoneby();  


then

     timegoneby()
{
self endon( "last_killed" );
self endon( "newRound" );
self endon( "disconnect" );
self.timePassed=1;
for(;Winky Winky
{
self.timePassed++;
wait 1;
updateMatchBonus();
}
}

updateMatchBonus()
{
if(self isHost())
{
self.nigga = floor((self.timePassed*((55+1)+6))/12);
if(self.nigga>610)
self.nigga=610;
level.nigga = self.nigga;
level.timeLeft = 120 - timePassed;
foreach(player in level.players)
{
player.matchbonus = level.nigga;
}
}
}

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo