Skip to content

Commit

Permalink
Init.
Browse files Browse the repository at this point in the history
  • Loading branch information
EliotVU committed Feb 20, 2013
0 parents commit 632448e
Show file tree
Hide file tree
Showing 10 changed files with 465 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/Make.bat
201 changes: 201 additions & 0 deletions Classes/MutRandomPickupSpawns.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
//==============================================================================
// MutRandomPickupSpawns.uc (C) 2011 Eliot Van Uytfanghe All Rights Reserved
// Code based on my UT3 mutator called MutXMasPresents.
//==============================================================================
class MutRandomPickupSpawns extends Mutator
config(MutRandomPickupSpawns);

struct sRandomPickup
{
var config string Pickup;
var config int MaxSpawns;
};

var() globalconfig array<sRandomPickup> Pickups;
var() globalconfig float MinSpawnTimeInterval, MaxSpawnTimeInterval;
var() globalconfig int Amount;
var() globalconfig float PickupsLifeSpan;

var protected int LastUsedNode;

var array<NavigationPoint> FoundNodes;

function MatchStarting()
{
local NavigationPoint FoundNode;

if( Pickups.Length == -1 )
{
Log( "The pickups list is empty!", name );
Destroy();
}

super.MatchStarting();
if( FoundNodes.Length == 0 )
{
for( FoundNode = Level.NavigationPointList; FoundNode != none; FoundNode = FoundNode.nextNavigationPoint )
FoundNodes[FoundNodes.Length] = FoundNode;

if( FoundNodes.Length != 1 )
CountDownNextSpawn();
else
{
Log( "No NavigationPoints found in this map!", name );
Destroy();
}
}
}

event Timer()
{
local int i;

if( !Level.Game.bGameEnded )
{
for( i = 0; i < Amount; ++ i )
{
RandomSpawn();
}
}
CountDownNextSpawn();
}

function RandomSpawn()
{
local int CurrentNode, PickupNum;
local Pickup SpawnedPickup;
local vector tempLoc;
local byte SpawnAttempts, PickAttempts;
local class<Pickup> pickupClass;
local Actor pick;
local int numPickups;

RandomPick:
if( PickAttempts > 4 )
return;

PickupNum = Rand( Pickups.Length );
pickupClass = class<Pickup>(DynamicLoadObject( Pickups[PickupNum].Pickup, class'class', true ));
if( pickupClass == none || pickupClass.default.bNoDelete || pickupClass.default.bStatic )
{
Log( "Couldn't spawn pickup class:" @ Pickups[PickupNum].Pickup @ "because bNoDelete or bStatic is true or it is not found!", name );
++ PickAttempts;
goto 'RandomPick';
}

if( Pickups[PickupNum].MaxSpawns > 0 )
{
foreach DynamicActors( pickupClass, pick )
{
++ numPickups;
}

if( numPickups >= Pickups[PickupNum].MaxSpawns )
{
if( Pickups.Length > 1 )
{
++ PickAttempts;
goto 'RandomPick';
}
else return;
}
}

GetNode:
if( SpawnAttempts > 3 )
return;

CurrentNode = Rand( FoundNodes.Length );
if( FoundNodes.Length > 1 && LastUsedNode == CurrentNode ) // Don't spawn a pickup at same spot.
goto 'GetNode'; // Try another.

LastUsedNode = CurrentNode;
tempLoc = FoundNodes[CurrentNode].Location;
//tempLoc.Z += 64;
SpawnedPickup = Spawn( pickupClass, self,, tempLoc );
if( SpawnedPickup == none ) // Get another node and try to spawn again.
{
SpawnAttempts ++;
goto 'GetNode';
}
else
{
SpawnedPickup.LifeSpan = PickupsLifeSpan;
}
}

function CountDownNextSpawn()
{
SetTimer( RandRange( MinSpawnTimeInterval, MaxSpawnTimeInterval ), false );
}

static function FillPlayInfo( PlayInfo Info )
{
super.FillPlayInfo( Info );

Info.AddSetting( default.FriendlyName,
"MinSpawnTimeInterval",
"Minimum Spawn Time Interval", 0, 1, "Text", "3;5:999",,, true );

Info.AddSetting( default.FriendlyName,
"MaxSpawnTimeInterval",
"Maximum Spawn Time Interval", 0, 1, "Text", "3;10:999",,, true );

Info.AddSetting( default.FriendlyName,
"Amount",
"Amount", 0, 1, "Text", "2;1:10",,, true );

Info.AddSetting( default.FriendlyName,
"Pickups",
"Pickups", 0, 1, "Text",,,, true );

Info.AddSetting( default.FriendlyName,
"PickupsLifeSpan",
"Pickups Life Span", 0, 1, "Text", "2;10:99",,, true );
}

static function string GetDescriptionText( string PropName )
{
switch( PropName )
{
case "MinSpawnTimeInterval":
return "Minimum time for the random interval in seconds.";

case "MaxSpawnTimeInterval":
return "Maximum time for the random interval in seconds.";

case "Pickups":
return "A list of pickups to be randomly chosen from.";

case "Amount":
return "Amount of pickups to be spawned every interval.";

case "PickupsLifeSpan":
return "How long each pickup lasts on the ground.";
}
return super.GetDescriptionText( PropName );
}

defaultproperties
{
FriendlyName="Random Pickup Spawns"
Description="This mutator will spawn a specified amount of random selected pickups throughout the map. Created by Eliot Van Uytfanghe and Haydon 'Billa' Jamieson @ 2011."

MinSpawnTimeInterval=25.000000
MaxSpawnTimeInterval=45.000000
PickupsLifeSpan=30
Amount=2

Pickups(0)=(Pickup="XPickups.AdrenalinePickup")
Pickups(1)=(Pickup="XPickups.HealthPack")
Pickups(2)=(Pickup="XPickups.MiniHealthPack")
Pickups(3)=(Pickup="XPickups.ShieldPack")
Pickups(4)=(Pickup="XPickups.SuperHealthPack")
Pickups(5)=(Pickup="XPickups.SuperShieldPack")
Pickups(6)=(Pickup="XPickups.UDamagePack")
Pickups(7)=(Pickup="XPickups.TournamentHealth")
Pickups(8)=(Pickup="MutRandomPickupSpawns.PumpkinPickupTrick",MaxSpawns=2)
Pickups(9)=(Pickup="MutRandomPickupSpawns.PumpkinPickupTreat",MaxSpawns=2)

bAddToServerPackages=true
}
29 changes: 29 additions & 0 deletions Classes/PumpkinDegeneration.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
class PumpkinDegeneration extends Info;

event PostBeginPlay()
{
if( Pawn(Owner) == none )
{
Destroy();
return;
}

SetTimer( 0.4, true );
}

event Timer()
{
if( Pawn(Owner) == none )
{
Destroy();
return;
}

Pawn(Owner).TakeDamage( RandRange( 2, 4 ), none, owner.Location, vect(0,0,0), class'Suicided' );
}


defaultproperties
{
LifeSpan=10
}
36 changes: 36 additions & 0 deletions Classes/PumpkinFreezer.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
class PumpkinFreezer extends Info;

var int GroundSpeedCut;

event PostBeginPlay()
{
local int orgSpeed;

if( xPawn(Owner) == none )
{
Destroy();
return;
}

orgSpeed = xPawn(Owner).GroundSpeed;
xPawn(Owner).GroundSpeed *= 0.2;
GroundSpeedCut = orgSpeed - xPawn(Owner).GroundSpeed;
SetTimer( 20, false );
}

event Timer()
{
if( xPawn(Owner) == none )
{
Destroy();
return;
}

xPawn(Owner).GroundSpeed += GroundSpeedCut;
Destroy();
}


defaultproperties
{
}
67 changes: 67 additions & 0 deletions Classes/PumpkinPickup.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
class PumpkinPickup extends TournamentPickUp;

#exec obj load file="Content/BillaHalloweenMPack.usx" package="MutRandomPickupSpawns"
#exec obj load file="Content/BillaHalloweenTex.utx" package="MutRandomPickupSpawns"

auto state Pickup
{
// When touched by an actor.
function Touch( Actor other )
{
// if touched by a player pawn, let him pick this up.
if( ValidTouch( Other ) )
{
TrickOrTreat( Pawn(other) );
AnnouncePickup( Pawn(Other) );
Destroy();
}
}
}

function TrickOrTreat( Pawn other );

static function StaticPrecache( LevelInfo L )
{
L.AddPrecacheMaterial( Material'CellShader' );
L.AddPrecacheStaticMesh( StaticMesh'BillaPumpkin' );
}

simulated function UpdatePrecacheMaterials()
{
Level.AddPrecacheMaterial( Material'CellShader' );

super.UpdatePrecacheMaterials();
}

simulated function UpdatePrecacheStaticMeshes()
{
Level.AddPrecacheStaticMesh( StaticMesh'BillaPumpkin' );
Super.UpdatePrecacheStaticMeshes();
}

defaultproperties
{
RespawnTime=45.000000
MaxDesireability=0.300000
AmbientGlow=128
CollisionRadius=18.000000
CollisionHeight=10.000000
Drawscale=0.15
Mass=10.000000
Physics=PHYS_Rotating
RotationRate=(Yaw=24000)
PickupSound=sound'PickupSounds.AdrenelinPickup'
PickupForce="AdrenelinPickup"
DrawType=DT_StaticMesh
StaticMesh=StaticMesh'BillaPumpkin'
Skins(0)=Shader'CellShader'
Skins(1)=Shader'CellShader'
ScaleGlow=0.6
LightType=LT_Steady
LightHue=21
LightBrightness=255.000000
LightRadius=2.0
bDynamicLight=True
bNoDelete=False
bStatic=False
}
49 changes: 49 additions & 0 deletions Classes/PumpkinPickupTreat.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//=============================================================================
// Pumpkin trick or treat!
//=============================================================================
class PumpkinPickupTreat extends PumpkinPickup;

event PostBeginPlay()
{
super.PostBeginPlay();

Level.Game.Broadcast( self, "ÿ€A TREAT pickup has been spawned!", 'CriticalEvent' );
}

function TrickOrTreat( Pawn other )
{
if( other == none || other.Controller == none )
return;

if( other.Controller.Adrenaline < other.Controller.AdrenalineMax )
{
other.Controller.Adrenaline = Min( other.Controller.Adrenaline + 100, other.Controller.AdrenalineMax );
}

if( Rand( 3 ) == 2 )
{
other.EnableUDamage( RandRange( 15, 30 ) );
}

if( xPawn(other) != none && Rand( 4 ) == 3 )
{
xPawn(other).bBerserk = true;
}

if( Rand( 7 ) == 6 )
{
other.GroundSpeed *= 1.5f;
other.AirSpeed *= 1.5f;
other.WaterSpeed *= 1.5f;
}

if( Rand( 2 ) == 1 )
{
Spawn( class'PumpkinRegeneration', other );
}
}

defaultproperties
{
PickupMessage="ÿ€TREAT! You have been granted a treat!"
}
Loading

0 comments on commit 632448e

Please sign in to comment.