PDA

View Full Version : [Mut/Maybe Gametype] Deathstroke



legacy-StarMech_LX
07-10-2003, 02:07 AM
Hey! I just started coding not that long ago, and i was working on a little mutator, heres a description: Players health goes down 1 ever .5 seconds, stops at 10, if under 10, goes back up until reached 10(unless of course they die), i made it to where no weapons are on the ground, but there are a few problems,

1. If you look in the code, it's suppose to replace all ammo with "IonStar.TheNone" which is nothing, so it should disappear.

2. When you kill a player, your health is supposed to go back up to 150... WTF isn't that happening!?

3. I'm trying to make it to where the only weapon they have in their inventory is the shield gun.

4. When they spawn, how do you make it to where they spawn with 150 health?

Thats it... heres the code:

//================================================== ===========================
// Deathstroke.
//================================================== ===========================
class Deathstroke extends Mutator;
var() float ConversionRatio;
var bool bdeathstroke;
event PreBeginPlay()
{
SetTimer(0.5,true);
bdeathstroke = false;
}
function Timer()
{
local Controller C;

for (C = Level.ControllerList; C != None; C = C.NextController)
{
if (C.Pawn != None && C.Pawn.Health > 10 )
{
C.Pawn.Health = Min( C.Pawn.Health - 1, C.Pawn.HealthMax);
}
if (C.Pawn != None && C.Pawn.Health < 10 && C.Pawn.Health > 0)
{
C.Pawn.Health = Min( C.Pawn.Health + 1, C.Pawn.HealthMax);
}
}
}
function ScoreKill(Pawn Killer, Pawn Killed)
{
if ( (Killer != None) && (Killer != None) )
Killer.Health = Killer.Health + 100;
}

function bool CheckReplacement( Actor Other, out byte bSuperRelevant )
{
bSuperRelevant = 0;
if ( xWeaponBase(Other) != None )
{
if ( xWeaponBase(Other).WeaponType != None )
xWeaponBase(Other).WeaponType = None;
else
return true;
}
else if ( WeaponPickup(Other) != None )
{
return true;
}
else if ( UTAmmoPickup(Other) != None )
{
return true;
}
return true;

return true;
}

Thanks for your help : D

legacy-Geminosity
07-10-2003, 06:52 AM
just one Q... is the shield gun meant to be the only weap allowed or do you just want them to start with only the shield gun? ~blink~

Angel_Mapper
07-10-2003, 10:46 AM
For the shield gun dealie, add this to your CheckReplacement function:


if (Other.isA('Weapon'))
return false;

if ( xPawn(Other) != None)
{
xPawn(Other).RequiredEquipment[0]="xWeapons.ShieldGun";
return true;
}

Also, if you want to get rid of the weapon bases as well, since they'd look silly sitting there with nothing on them, add this:


if ( xWeaponBase(Other) != None )
return false;
if (Other.isA('WeaponPickup'))
return false;


Woah, I'm answering coding questions. Scary. :bulb:

legacy-Geminosity
07-10-2003, 10:50 AM
well, don't know if it's the way it's done but I went ahead and coded it myself ^^;

just replace your code with...



class MutBumpers extends Mutator;

var name WeaponName;
var() float DegenPerSecond;
var int NewHealthMin, NewHealthMax;
var bool bAllowTranslocator;

// Don't call Actor PreBeginPlay() for Mutator
event PreBeginPlay()
{
SetTimer(0.5,true);
}

function PostBeginPlay()
{
local BumperRules G;
Super.PostBeginPlay();
G = spawn(class'BumperRules');
G.BumperMutator = self;
if ( Level.Game.GameRulesModifiers == None )
Level.Game.GameRulesModifiers = G;
else
Level.Game.GameRulesModifiers.AddGameRules(G);
}

function ModifyPlayer(Pawn Other)
{
Super.ModifyPlayer(Other);
Other.Health=NewHealthMax;
}


function Timer()
{
local Controller C;
for (C = Level.ControllerList; C != None; C = C.NextController)
{
if (C.Pawn != None && C.Pawn.Health > NewHealthMin )
{
C.Pawn.Health = Max( NewHealthMin, C.Pawn.Health-DegenPerSecond);
}
else if (C.Pawn != None && C.Pawn.Health < NewHealthMin )
{
C.Pawn.Health = Min( NewHealthMin, C.Pawn.Health+DegenPerSecond );
}
}
}

function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
if ( Other.IsA('Weapon') )
{
if ( Other.IsA('BallLauncher') )
{
bSuperRelevant = 0;
return true;
}
if ( Other.IsA('TransLauncher') && bAllowTranslocator )
{
bSuperRelevant = 0;
return true;
}

if ( !Other.IsA(WeaponName) )
{
Level.Game.bWeaponStay = false;
return false;
}
}

if ( Other.IsA('WeaponPickup') )
return False;
if ( Other.IsA('Ammo') )
return False;

if ( Other.IsA('xWeaponBase') )
Other.bHidden = True;

bSuperRelevant = 0;
return true;
}

defaultproperties
{
NewHealthMax=150
NewHealthMin=10
DegenPerSecond=1
WeaponName=ShieldGun
IconMaterialName="MutatorArt.nosym"
ConfigMenuClassName=""
GroupName="Arena"
FriendlyName="Bumpers"
Description="Shieldguns ahoy!"
}


making sure to change the names where appropriate (I called it 'Bumpers' instead of Deathstroke ^^ )

and then put this .uc in your classes folder too (being sure to rename stuff where needed again :p )



class BumperRules extends GameRules;

var MutBumpers BumperMutator;

function ScoreKill(Controller Killer, Controller Killed)
{
if ( (Killer != None) && (Killer.Pawn != None) )
Killer.Pawn.Health = BumperMutator.NewHealthMax;
if ( NextGameRules != None )
NextGameRules.ScoreKill(Killer,Killed);
}



Tried and tested :D



Edit: ick... looks like hell without the formatting and stuffs -.-
Most of it was salvaged easily enough from mutinstagib, mutbighead and mutregen though Sir Brizz's post in http://www.ataricommunity.com/forums/showthread.php?s=&threadid=283493&highlight=Health helped lots with setting the default health ;)

Edit 2: you don't need to add the 'BumperRules' to your .int file, it gets included by 'MutBumpers'

Final Edit (I promise ^^; ): You don't really need that 'Ball launcher' exclusion in the check function, I just left it in for the heck of it :p

legacy-Geminosity
07-13-2003, 07:46 PM
~blink~

Guess he didn't come back... oh well, at least I learned a few things doing it :p

~fixes the formatting in the previous post~

legacy-StarMech_LX
07-19-2003, 11:13 PM
nah, i have friends from texas over, we're all lanning and crap like that, get back to you tomarrow

legacy-StarMech_LX
07-20-2003, 10:34 PM
ok, well... guess i should go on and try to code something else :D
can you put the mut up for download :D?