Admin Ownage

  • 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.
I'm trying to make a mutator for my server, but can't work out how to get the key part to work.
What I'm trying to do is write a mutator that replaces the flak cannon with a 1-shot-kill flak cannon, but ONLY for my nickname. Basically, the idea is, I'm the admin; p*ss me off and die. I don't use the flak cannon usually, so that's the favourite for swapping.

What I've tried so far is to have the ProcessTouch method check for Other.Name, like this:

Code:
if ( Other.Name == "Burningmace" ) {
    Other.TakeDamage( 50000, Instigator, HitLocation, (MomentumTransfer * Velocity/speed), MyDamageType );
} else {
    Other.TakeDamage( Max(5, Damage - DamageAtten*FMax(0,(default.LifeSpan - LifeSpan - 1))), Instigator, HitLocation, (MomentumTransfer * Velocity/speed), MyDamageType );
}

However, I get the following problem:

Code:
AdminFlakChunk.uc(38) : Error, Types are incompatible with '=='
Compile aborted due to errors.
Failure - 1 error(s), 0 warning(s)

I get the feeling I'm missing something...
How can I get this to work?

Thanks
 

MonsOlympus

Active Member
May 27, 2004
2,225
0
36
42
You might want to try one equals dunno if that'll help. Im thinking you might need a bit more in this as if your name isnt in the game and someone else uses it they'll get the flakk. Thats bad!!

I think its a good start though, I like the idea Im a fan of the flakk :D

Edit: another quick thing too you might want to go different damage types as well cause you can add gibs or skeletise etc.
 
Last edited:
You can't use = as a comparitor in an if statement! :eek:
Anyone who knows any C-syntax language can tell you that... lol

You have a point with that nickname problem... how about some form of PlayerID... I seem to remember something in the UT2004RPG mod that used a PlayerID and nickname to find player stats. Anyone know how that would work?
 

MonsOlympus

Active Member
May 27, 2004
2,225
0
36
42
Error, Types are incompatible with '=='

Seems as though Other.name cant be a string so... um = perhaps but as you say you cant use == in an if statement.

PlayerID is the way to go I think its some sort of special identifier for uniqueness. This would solve any problems incase you get disconnected from the server. You'll have to forgive my last post a bit to, lack of sleep and dealing with newer people takes its toll.

They should have some kind skill level indicator on the side next to the postcount lmao

Ok now, perhaps theres something your missing with other.name it just might not hold a string variable. I'll check up on this and see what I can help with cause if you just want to get working the way you suggested then you can find some info on the id's. ;)

Edit: PlayerReplicationInfo.PlayerName, this could be the one your after. PlayerReplicationInfo.uc also holds the PlayerID so you could make it
Code:
if((PlayerReplicationInfo.PlayerName == "yourname") && (PlayerReplicationInfo.PlayerID == "yourid"))
 
Last edited:

MonsOlympus

Active Member
May 27, 2004
2,225
0
36
42
Hate to do a double post but if your using a psswrd for admin on the server this would be useful I imagine. Same class as before.
Code:
var bool	bAdmin;	// Player logged in as Administrator
 

Parser

Hello
May 7, 2002
1,531
0
0
119
England baby!
fraghouse.beyondunreal.com
The code you're using at the moment would be to hurt the player named "Burningmace" with 50000 damage every time a flak chunk hits him/her. I gather that wasn't what you were aiming for? :)

What you could do instead is code your admin flak cannon and just change the damage value to some insanely high value. Let's assume your weapon is called AdminFlakCannon, with the appropriate changed FireModes to fire your custom projectiles.

As you mention you're coding a mutator, you could then give your custom flak cannon to any player named "Burningmace" through the actual mutator like so:

Code:
function ModifyPlayer(Pawn Other)
{
	local PlayerReplicationInfo PRI;

	PRI = Other.PlayerReplicationInfo;

	Super.ModifyPlayer(Other);

	if (PRI != None)
	{
		if (PRI.PlayerName == "Burningmace" && PRI.bAdmin)
		{
			Spawn(class'AdminFlakCannon').GiveTo(Other);
		}
	}
}
So, if a player logs in as "Burningmace" and then logs in as admin, the next time the function is called (you might have to respawn/suicide for that), that player will be given the admin flak cannon.

Hope that helps!
 
Now that looks cool.
Instantly giving the admin the DEATH FLAVOURED GUN OF DOOM sounds better than my original idea :lol:

Plus it fixes the "other player signs on as Burningmace" problem.

I'll implement it and see if it works. I'm assuming this goes in the AdminOwnage.uc (mutator class) file...
 

Shambler[sixpack]

New Member
May 3, 2001
564
0
0
Ireland
Visit site
Just create a GameRules modifier:
Code:
Class AdminOwnageRules extends GameRules;

function int NetDamage(int OriginalDamage, int Damage, Pawn injured, Pawn instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType)
{
     if (instigatedBy.PlayerReplicationInfo.bAdmin && injured != instigatedBy && DamageType == Class'DesiredDamageType')
     Damage = 5000;

     return Super.NetDamage(OriginalDamage, Damage, injured, instigatedBy, HitLocation, Momentum, DamageType);
}
 
I wish to add a ProtectorFire class (for secondary fire) which toggles invunerability. I looked at the class tree and came up with this:
Code:
function projectile SpawnProjectile(Vector Start, Rotator Dir)
{
	local Projectile p;
	// Super would be ProjectileFire
	// Super.Super would be WeaponFire
	// Super.Super.Instigator is a Pawn, which would be the player.

	if (Super.Super.Instigator.DamageScaling == 0)
	{
		Super.Super.Instigator.DamageScaling == 1;
	} else {
		Super.Super.Instigator.DamageScaling == 0;
	}
	return p;
}

What am I doing wrong?
 

Parser

Hello
May 7, 2002
1,531
0
0
119
England baby!
fraghouse.beyondunreal.com
You don't need to call Super to access the variables such as Instigator, it's mainly used for functions where you want to execute the code of the parent class as well as your own (without having to write it all out again), eg

Code:
function PostBeginPlay()
{
	Super.PostBeginPlay();
}

Secondly, rather than using SpawnProjectile(), you could use DoFireEffect() instead, which is one of the base functions for the serverside aspect of the fire class. The variable you would be looking to alter for invincibility would be bGodMode, found in the Controller class, so your code could look something like this:

Code:
function DoFireEffect()
{
	if (Instigator.Controller != None)
	{
		if (Instigator.Controller.bGodMode)
		{
			Instigator.Controller.bGodMode = false;
			Instigator.ClientMessage("God Mode deactivated.");
		}

		else
		{
			Instigator.Controller.bGodMode = true;
			Instigator.ClientMessage("God Mode activated.");
		}
	}
}
There's no need to call Super for that function because all that function will do now is toggle the God mode bool.

Hope that helps!
 
OK, so I implemented that. There's a slight problem - it doesn't work.
I've posted my code at http://adminownage.pastebin.com/ and http://adminownage-b.pastebin.com/. I had to split it into two because there were so many files, there's a lot there. Don't worry about the filenames being a little dodgy, they get truncated. The two main problems I'm getting are:
1) Secondary fire does not toggle invunerability.
2) Primary fire does not fire a beam.

Could someone go through and see if they can find the problems?
Thanks.

EDIT: Oh, don't post anything on that first pastebin - if you do it will knock the last post off.
 
Last edited:

Parser

Hello
May 7, 2002
1,531
0
0
119
England baby!
fraghouse.beyondunreal.com
A couple of suggestions:

For ProtectorFire, try subclassing WeaponFire instead of ProjectileFire (and remove bSplashDamage and ProjSpawnOffset from the defaultproperties). It doesn't need to fire any projectiles, just toggle god mode.

As regards your beam not firing, it seems that you've made replacement classes for everything the shock rifle uses. In PunisherFire, it seems that you've commented out the bit that does multiple DoTrace functions. If you're not sticking with the "shotgun" idea, you could just remove the DoFireEffect function altogether in that and just keep your modified DamageMin and DamageMax values - that would get you your instant death beam. Although I thought you were doing a flak cannon? :p

Again, if things aren't working, check UT2004.log and post it here, as that can sometimes give a clearer analysis of what's going wrong. :)