
New BallLuncher:
Code: Select all
class MBallLauncher extends BallLauncher
var int drainTotal
//this function is a modified version of the healing function. Now it drains health from the ball carrier
simulated function ModifyPawn( float dt )
{
if ( Instigator.Weapon == self && Instigator.PlayerReplicationInfo.HasFlag != None)
{
drainTotal += 1;
Instigator.Health -= 1;
}
if ( Instigator.Weapon != self && Instigator.PlayerReplicationInfo.HasFlag != None)
{
xBombFlag(Instigator.PlayerReplicationInfo.HasFlag).SetHolder( Instigator.Controller );
}
}
//this function causes the ball carrier to slow down
simulated function BringUp(optional Weapon PrevWeapon)
{
if ( Instigator.PlayerReplicationInfo.HasFlag == None )
{
Instigator.AirControl *= 0.5;
Instigator.GroundSpeed *= 0.5;
Instigator.WaterSpeed *= 0.5;
Instigator.AirSpeed *= 0.5;
Instigator.JumpZ *= 0.5;
}
Super.BringUp();
}
//this function causes the ball carrier to speed up when the ball is thrown or lost and also returns all the health drained, back to the ex-ball carrier
simulated function bool PutDown()
{
if ( Instigator.PlayerReplicationInfo.HasFlag == None )
{
Instigator.AirControl *= 2;
Instigator.GroundSpeed *= 2;
Instigator.WaterSpeed *= 2;
Instigator.AirSpeed *= 2;
Instigator.JumpZ *= 2;
Instigator.Health += drainTotal;
}
return Super.PutDown();
}
//def props
defaultproperties
{
drainTotal=0
}
Code: Select all
class ChaosMBRBot extends ChaosBot
simulated function Bool CheckForMeleeGame()
{
if (level.Game.IsA('MBombingRun') && Level.Game.GetPropertyText("WeaponOption") ~= "0")
{
Return True;
}
else
{
Super.CheckForMeleeGame();
}
}
DefaultProperties
{
}
Code: Select all
class MBombingRun extends xBombingRun
//copied from ChaosxDeathmatch
event InitGame( string Options, out string Error )
{
local bool bMFound;
ForEach AllActors(class'Mutator', MUT)
{
If (MUT.IsA('ChaosUT'))
{
bMFound=true;
Break;
}
}
If(!bMFound)
{
Level.Game.AddMutator("ChaosGames.ChaosUT");
}
}
//copied from ChaosxDeathmatch
event PreBeginPlay()
{
Super.PreBeginPlay();
Spawn(class'ChaosMeleeInfo');
}
//copied from ChaosxDeathmatch
function AddDefaultInventory( pawn P )
{
Super.AddDefaultInventory(P);
if (ChaosPRIBase(P.PlayerReplicationInfo) != None && bMeleeGame)
ChaosPRIBase(P.PlayerReplicationInfo).GiveMeleeWeapon(P, ChaosGRIBase(GameReplicationInfo));
}
//copied from ChaosxDeathmatch
event PlayerController Login( string Portal, string Options, out string Error )
{
local PlayerController NewPlayer;
local CUTReplicationInfo CUTPRI;
NewPlayer = Super.Login(Portal, Options, Error);
if (NewPlayer != None )
NewPlayer.PawnClass=Class'ChaosGames.ChaosxDeathMatch_Pawn';
CUTPRI = Spawn(class'CUTReplicationInfo', NewPlayer);
if ( CUTPRI != None )
CUTPRI.myPRI = NewPlayer.PlayerReplicationInfo;
return NewPlayer;
}
//copied from ChaosxDeathmatch
function Bot SpawnBot(optional string botName)
{
local Bot NewBot;
local RosterEntry Chosen;
local UnrealTeamInfo BotTeam;
BotTeam = GetBotTeam();
Chosen = BotTeam.ChooseBotClass(botName);
if (Chosen.PawnClass == None)
Chosen.Init(); //amb
NewBot = Spawn(class'ChaosMBRBot');
if ( NewBot != None )
InitializeBot(NewBot,BotTeam,Chosen);
return NewBot;
}
//copied from xBombingRun. Modified to support the new BallLauncher
simulated function ScoreBomb(Controller Scorer, xBombFlag theFlag)
{
local bool ThrowingScore;
local int i;
local float ppp,numtouch,maxpoints,maxper;
local controller C;
Bomb = theFlag;
if( ResetCountDown > 0 )
{
//log("Ignoring score during reset countdown.",'BombingRun');
theFlag.SendHome();
return;
}
// blow up all redeemer guided warheads
for ( C=Level.ControllerList; C!=None; C=C.NextController )
if ( (C.Pawn != None) && C.Pawn.IsA('RedeemerWarhead') )
C.Pawn.Fire(0);
// are we dealing with a throwing score?
if (Scorer.PlayerReplicationInfo.HasFlag == None)
ThrowingScore = true;
if ( (Scorer.Pawn != None) && Scorer.Pawn.Weapon.IsA('MBallLauncher') )
Scorer.ClientSwitchToBestWeapon();
theFlag.Instigator = none; // jmw - need this to stop the reentering of ScoreBomb due to touch with the base
// awards for scoring
IncrementGoalsScored(Scorer.PlayerReplicationInfo);
OldScore = Scorer.PlayerReplicationInfo.Team.Score;
if (ThrowingScore)
{
Scorer.PlayerReplicationInfo.Team.Score += 3.0;
Scorer.PlayerReplicationInfo.Team.NetUpdateTime = Level.TimeSeconds - 1;
TeamScoreEvent(Scorer.PlayerReplicationInfo.Team.TeamIndex,3,"ball_tossed");
// Individual points
Scorer.PlayerReplicationInfo.Score += 2; // Just for scoring
MaxPoints=10;
MaxPer=2;
ScoreEvent(Scorer.PlayerReplicationInfo,5,"ball_thrown_final");
}
else
{
Scorer.PlayerReplicationInfo.Team.Score += 7.0;
Scorer.PlayerReplicationInfo.Team.NetUpdateTime = Level.TimeSeconds - 1;
TeamScoreEvent(Scorer.PlayerReplicationInfo.Team.TeamIndex,7,"ball_carried");
// Individual points
Scorer.PlayerReplicationInfo.Score += 5; // Just for scoring
MaxPoints=20;
MaxPer=5;
ScoreEvent(Scorer.PlayerReplicationInfo,5,"ball_cap_final");
}
Scorer.PlayerReplicationInfo.NetUpdateTime = Level.TimeSeconds - 1;
// Each player gets MaxPoints/x but it's guarenteed to be at least 1 point but no more than MaxPer points
numtouch=0;
for (i=0;i<TheFlag.Assists.length;i++)
{
if ( (TheFlag.Assists[i]!=None) && (TheFlag.Assists[i].PlayerReplicationInfo.Team == Scorer.PlayerReplicationInfo.Team) )
numtouch = numtouch + 1.0;
}
ppp = MaxPoints / numtouch;
if (ppp<1>MaxPer)
ppp = MaxPer;
for (i=0;i<TheFlag>= GoalScore) )
EndGame(Scorer.PlayerReplicationInfo,"teamscorelimit");
else if ( bOverTime )
EndGame(Scorer.PlayerReplicationInfo,"timelimit");
ResetCountDown = ResetTimeDelay+1;
if ( bGameEnded )
theFlag.Score();
else
theFlag.SendHomeDisabled(ResetTimeDelay);
}
defaultProperties
{
GameName="MBR"
Description="Each level has a ball that starts in the middle of the playing field. Your team scores by getting the ball through the enemy team's hoop. You score 7 points for jumping through the hoop while holding the ball, and 3 points for tossing the ball through the hoop. The ball can be passed to teammates, and is dropped if the player carrying it is killed. This version of Bombing Run is played only with Chaos UT Melee weapons. Also, the ball carrier has reduced speed and loses health passively."
}
1) Replace the old Ball Launcher with the new one
2) Replace all the weapons with only melee weapons and translocator
3) Put the whole thing together