New Game

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

MooLue4000

New Member
Nov 26, 2004
3
0
0
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 :lol: 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: