News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 2nd Dec 2004, 04:05 PM   #1
MooLue4000
Registered User
 
Join Date: Nov. 26th, 2004
Posts: 3
Smile New Game

I decided I would make a new gametype called OddMan. I have it all worked out and seems to work perfectly. It is a deathmatch game that has a player become the OddMan. To become him, you must kill first and you will be rewared with zero points. Everytime the OddMan kills, he gets a point. If somebody kills you, they get five points. The whole time, the OddMan has regenerating health(by one), UDamage, and the Offensive Effect and Regen Crosses around him. The code is:

Code:
class OddMan extends Deathmatch;

var Pawn OddMan;
var xEmitter Effect;

function unsetOddMan()
{
    setTimer(0, false);
    OddMan = None;
}

function setOddMan(Pawn O)
{
    setTimer(0.5, true);
    OddMan = O;
    Spawn(class'OffensiveEffect', OddMan,, OddMan.Location, 

OddMan.Rotation);
    Spawn(class'RegenCrosses', OddMan,, OddMan.Location, 

OddMan.Rotation);
}

function Timer()
{
    if(OddMan != None)
    {
        OddMan.EnableUDamage(1.0);

            if(OddMan.Role == ROLE_Authority)
            {
                OddMan.GiveHealth(1, 1000);
                if(OddMan.Health == 1000)
                    OddMan.AddShieldStrength(1);
            }
    }
}

function Killed(Controller Killer, Controller Killed, Pawn 

KilledPawn, class<DamageType> damageType)
{
    if(OddMan == None)
    {
        setOddMan(Killer.Pawn);
    }

    else if(Killed.Pawn == OddMan)
    {
        if(Killer == Killed)
        {
            unsetOddMan();
            Super.Killed(Killer, Killed, KilledPawn, 

damageType);
        }
        else
        {
            setOddMan(Killer.Pawn);
            Super.Killed(Killer, Killed, KilledPawn, 

damageType);
            Super.Killed(Killer, Killed, KilledPawn, 

damageType);
            Super.Killed(Killer, Killed, KilledPawn, 

damageType);
            Super.Killed(Killer, Killed, KilledPawn, 

damageType);
            Super.Killed(Killer, Killed, KilledPawn, 

damageType);
        }
    }

    else if(Killer.Pawn == OddMan)
    {
	if(Killer == Killed)
	{
	    unsetOddMan();
	    Super.Killed(Killer, Killed, KilledPawn, 

damageType);
	}
	
	else
	{
        Super.Killed(Killer, Killed, KilledPawn, damageType);
	}
    }
}

defaultproperties
{
    GameName = "OddMan"
}
It works exactly how it should. The only problem is that after a certain amount of time(incidently the exact time you run out of adrenaline when using a combo) you lose the effects. Now I looked and didn't see anything about this on UnrealWiki or maybe I was searching for the wrong subject. I would like to know if anybody could help on getting this on the pawn permantly until he stops being the OddMan. Thanks in Advance!

EDIT: Okay I changed the code a bit and put the spawn functions right under the health regeneration code...However something terrible has happened, it doesn't stop spawning!!! Is there anyway to stop it from running more than once?

PERFECTED CODE:
Code:
class OddMan extends Deathmatch;

var Pawn OddMan;
var xEmitter Effect;

function unsetOddMan()
{
    setTimer(0, false);
    OddMan = None;
}

function setOddMan(Pawn O)
{
    setTimer(0.5, true);
    OddMan = O;
}

function Timer()
{
    if(OddMan != None)
    {
        OddMan.EnableUDamage(1.0);

            if(OddMan.Role == ROLE_Authority)
            {
                OddMan.GiveHealth(1, 500);
                if(OddMan.Health == 500)
                    OddMan.AddShieldStrength(1);
            }

    	    if(Effect == None)
    	    {
        	Effect = Spawn(class'OffensiveEffect', 

OddMan,, OddMan.Location, OddMan.Rotation);
		Effect = Spawn(class'RegenCrosses', OddMan,, 	

OddMan.Location, OddMan.Rotation);
    	    }
    }
}

function Killed(Controller Killer, Controller Killed, Pawn 

KilledPawn, class<DamageType> damageType)
{
    if(OddMan == None)
    {
        setOddMan(Killer.Pawn);
    }

    else if(Killed.Pawn == OddMan)
    {
        if(Killer == Killed)
        {
            unsetOddMan();
            Super.Killed(Killer, Killed, KilledPawn, 

damageType);
        }
        else
        {
            setOddMan(Killer.Pawn);
            Super.Killed(Killer, Killed, KilledPawn, 

damageType);
            Super.Killed(Killer, Killed, KilledPawn, 

damageType);
            Super.Killed(Killer, Killed, KilledPawn, 

damageType);
            Super.Killed(Killer, Killed, KilledPawn, 

damageType);
            Super.Killed(Killer, Killed, KilledPawn, 

damageType);
        }
    }

    else if(Killer.Pawn == OddMan)
    {
	if(Killer == Killed)
	{
	    unsetOddMan();
	    Super.Killed(Killer, Killed, KilledPawn, 

damageType);
	}
	
	else
	{
        Super.Killed(Killer, Killed, KilledPawn, damageType);
	}
    }
}

defaultproperties
{
    GameName = "OddMan"
}
I got it to work, thank you guys for looking at the topic, I truely appreciate it I knew it had to be something stupid Go ahead and compile the code if you want to try it out* Have fun and thanks again!



*NOTE: This game was the first game ever made by me so if it sucks, you should know why. Feel free to change it at your will

Last edited by MooLue4000; 2nd Dec 2004 at 04:49 PM.
MooLue4000 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 09:28 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.

Copyright ©1998 - 2012, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer