A UT weapons mutator for unreal 1

Search, find and discuss about Mutators!
Post Reply
ReaperAA
Novice
Posts: 4
Joined: Sat Apr 21, 2018 2:38 pm

A UT weapons mutator for unreal 1

Post by ReaperAA »

Hi folks, i m trying to make a UT weapons mutator for unreal 1 so that i can use it in singleplayer. I am using BotPack that i got from here
https://www.oldunreal.com/cgi-bin/yabb2 ... 1374313749

I know that there is another UTWeapons mod in OldUnreal page that exists for Unreal 1 but it has too many visual glitches. So i decided to use its mutator code as a base to make the mutator for BotPack mod.

Here is the code of the original mutator inside UTWeapons.u mod:

Code: Select all

//=============================================================================
// UTWeapons.
//										Coded by .:..:
//=============================================================================
class UTWeapons expands Mutator;

#exec OBJ LOAD FILE=Classes\UT.u PACKAGE=UTWeapons
#exec OBJ LOAD FILE=Classes\UT2.u PACKAGE=UTWeapons

var bool bShouldReplace;

function PostBeginPlay()
{
	SetTimer(0.1,false);
}
function Timer()
{
	bShouldReplace = True;
}
function Class<Weapon> MyDefaultWeapon()
{
	Return class'ImpactHammer';
}

function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
	if( !bShouldReplace )
	{
		if( Weapon(Other)!=None )
		{
			if( DispersionPistol(Other)!=None && ReplaceWith(Other,string(class'ImpactHammer')) )
				Return False;
			else if( Automag(Other)!=None && ReplaceWith(Other,string(class'Enforcer')) )
				Return False;
			else if( Stinger(Other)!=None && ReplaceWith(Other,string(class'PulseGun')) )
				Return False;
			else if( ASMD(Other)!=None && ReplaceWith(Other,string(class'ShockRifle')) )
				Return False;
			else if( Eightball(Other)!=None && ReplaceWith(Other,string(class'UT_Eightball')) )
				Return False;
			else if( FlakCannon(Other)!=None && ReplaceWith(Other,string(class'UT_FlakCannon')) )
				Return False;
			else if( Razorjack(Other)!=None && ReplaceWith(Other,string(class'Ripper')) )
				Return False;
			else if( GESBioRifle(Other)!=None && ReplaceWith(Other,string(class'UT_BioRifle')) )
				Return False;
			else if( Rifle(Other)!=None && ReplaceWith(Other,string(class'SniperRifle')) )
				Return False;
			else if( Minigun(Other)!=None )
			{
				if( FRand()<0.9 && ReplaceWith(Other,string(class'Minigun2')) )
					Return False;
				else if( ReplaceWith(Other,string(class'WarheadLauncher')) )
					Return False;
			}
		}
		else if( Ammo(Other)!=None )
		{
			if( Other.Class==Class'ASMDAmmo' && ReplaceWith(Other,string(class'ShockCore')) )
				Return False;
			else if( FlakBox(Other)!=None && ReplaceWith(Other,string(class'FlakAmmo')) )
				Return False;
			else if( RazorAmmo(Other)!=None && ReplaceWith(Other,string(class'BladeHopper')) )
				Return False;
			else if( RifleAmmo(Other)!=None && ReplaceWith(Other,string(class'BulletBox')) )
				Return False;
			else if( RocketCan(Other)!=None && ReplaceWith(Other,string(class'RocketPack')) )
				Return False;
			else if( ShellBox(Other)!=None && ReplaceWith(Other,string(class'Miniammo')) )
				Return False;
			else if( Sludge(Other)!=None && ReplaceWith(Other,string(class'BioAmmo')) )
				Return False;
			else if( StingerAmmo(Other)!=None && ReplaceWith(Other,string(class'PAmmo')) )
				Return False;
		}
		else if( WeaponPowerUp(Other)!=None && ReplaceWith(Other,string(class'ChainSaw')) )
			Return False;
	}
	if( Other.bIsPawn && SkaarjTrooper(Other)!=None )
	{
		if( SkaarjTrooper(Other).WeaponType==class'DispersionPistol' )
		{
			if( FRand()<0.4 )
				SkaarjTrooper(Other).WeaponType=class'ImpactHammer';
			else if( FRand()<0.3 )
				SkaarjTrooper(Other).WeaponType=class'ChainSaw';
			else SkaarjTrooper(Other).WeaponType=class'Translocator';
		}
		else if( SkaarjTrooper(Other).WeaponType==class'Automag' )
			SkaarjTrooper(Other).WeaponType=class'Enforcer';
		else if( SkaarjTrooper(Other).WeaponType==class'Stinger' )
			SkaarjTrooper(Other).WeaponType=class'PulseGun';
		else if( SkaarjTrooper(Other).WeaponType==class'ASMD' )
			SkaarjTrooper(Other).WeaponType=class'ShockRifle';
		else if( SkaarjTrooper(Other).WeaponType==class'Eightball' )
			SkaarjTrooper(Other).WeaponType=class'UT_Eightball';
		else if( SkaarjTrooper(Other).WeaponType==class'FlakCannon' )
			SkaarjTrooper(Other).WeaponType=class'UT_FlakCannon';
		else if( SkaarjTrooper(Other).WeaponType==class'Razorjack' )
			SkaarjTrooper(Other).WeaponType=class'Ripper';
		else if( SkaarjTrooper(Other).WeaponType==class'GESBioRifle' )
			SkaarjTrooper(Other).WeaponType=class'UT_BioRifle';
		else if( SkaarjTrooper(Other).WeaponType==class'Rifle' )
			SkaarjTrooper(Other).WeaponType=class'SniperRifle';
		else if( SkaarjTrooper(Other).WeaponType==class'Minigun' )
			SkaarjTrooper(Other).WeaponType=class'Minigun2';
	}
	else if( Decoration(Other)!=None && Decoration(Other).contents!=None )
	{
		if( Decoration(Other).contents==Class'DispersionPistol' )
			Decoration(Other).contents = Class'ImpactHammer';
		else if( Decoration(Other).contents==Class'Stinger' )
			Decoration(Other).contents = Class'PulseGun';
		else if( Decoration(Other).contents==Class'ASMD' )
			Decoration(Other).contents = Class'ShockRifle';
		else if( Decoration(Other).contents==Class'Eightball' )
			Decoration(Other).contents = Class'UT_Eightball';
		else if( Decoration(Other).contents==Class'FlakCannon' )
			Decoration(Other).contents = Class'UT_FlakCannon';
		else if( Decoration(Other).contents==Class'Razorjack' )
			Decoration(Other).contents = Class'Ripper';
		else if( Decoration(Other).contents==Class'GESBioRifle' )
			Decoration(Other).contents = Class'UT_BioRifle';
		else if( Decoration(Other).contents==Class'Rifle' )
			Decoration(Other).contents = Class'SniperRifle';
		else if( Decoration(Other).contents==Class'Minigun' )
			Decoration(Other).contents = Class'Minigun2';
		else if( Decoration(Other).contents==Class'ASMDAmmo' )
			Decoration(Other).contents = Class'ShockCore';
		else if( Decoration(Other).contents==Class'FlakBox' )
			Decoration(Other).contents = Class'FlakAmmo';
		else if( Decoration(Other).contents==Class'RazorAmmo' )
			Decoration(Other).contents = Class'BladeHopper';
		else if( Decoration(Other).contents==Class'RifleAmmo' || Decoration(Other).contents==Class'RifleRound' )
			Decoration(Other).contents = Class'BulletBox';
		else if( Decoration(Other).contents==Class'RocketCan' )
			Decoration(Other).contents = Class'RocketPack';
		else if( Decoration(Other).contents==Class'ShellBox' || Decoration(Other).contents==Class'Clip' )
			Decoration(Other).contents = Class'MiniAmmo';
		else if( Decoration(Other).contents==Class'Sludge' )
			Decoration(Other).contents = Class'BioAmmo';
		else if( Decoration(Other).contents==Class'StingerAmmo' )
			Decoration(Other).contents = Class'PAmmo';
	}
	return true;
}
and code for UTWeapons.int is:

Code: Select all

[Public]
Object=(Name=UTWeapons.UTWeapons,Class=Class,MetaClass=Engine.Mutator,Description="UT Weapons,Replace original Unreal weapons with Unreal Tournament ones.")

What i did was that i copied/added the mutator code to BotPack.u and changed the "UTWeapons.UTWeapons" in UTWeapons.int to "BotPack.UTWeapons" but it didn't work. Can anyone help me what to change in mutator code to make it work.
User avatar
papercoffee
Godlike
Posts: 10443
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: A UT weapons mutator for unreal 1

Post by papercoffee »

Wouldn't OldUnreal not the better forum to ask Unreal related questions?
SC]-[WARTZ_{HoF}
Adept
Posts: 426
Joined: Tue Feb 21, 2012 7:29 pm

Re: A UT weapons mutator for unreal 1

Post by SC]-[WARTZ_{HoF} »

I have plans myself to mod UT99 weapons/hud for Unreal1. It is on my todo list which happens to be ever growing. :omfg:
Image
Image
Image
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: A UT weapons mutator for unreal 1

Post by Barbie »

ReaperAA wrote:

Code: Select all

...
var bool bShouldReplace;

function PostBeginPlay() {
	SetTimer(0.1,false);
}

function Timer() {
	bShouldReplace = True;
}
...
function bool CheckReplacement(Actor Other, out byte bSuperRelevant) {
	if( !bShouldReplace ) {
		...Replacement is done here...
	}
	return true;
}
In my understanding bShouldReplace indicates if a replacement should happen or not. I guess the default value is FALSE (if not set anywhere else). That Mutator initially sets a timer of 0.1 seconds, and that timer changes the value of bShouldReplace to TRUE. So by the above given code a replacement is only done within the first 0.1 second. That says the code.

On the other side the variable naming is contradictory to its usage: if bShouldReplace is FALSE, replacement is done and vice versa. The coder either didn't take his pills or too many of them?
My recommendation for above Mutator:

Code: Select all

...
var bool bShouldReplace;

function bool CheckReplacement(Actor Other, out byte bSuperRelevant) {
	if( bShouldReplace ) {
		...Replacement is done here...
	}
	return true;
}
defaultproperties {
	bShouldReplace=true
}
and leave changing of bShouldReplace to an INI file.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: A UT weapons mutator for unreal 1

Post by sektor2111 »

True, replacement posted in first post is reacting only in first moment (0.1) and not later - because replacement work only for FALSE case and then is turned into True.

Code: Select all

function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
   if( !bShouldReplace ) //Until timer is coming then good bye
   {
      if( Weapon(Other)!=None )
      {
....
Whatever spawns later (DropWhenKilled) or (Decoration Content 2-3) will not be replaced. If mutator doesn't work, then exist a reason, first route to debug is checking game logs and then posting the problem. The name of the boolean it's not self-explanatory, it's causing confusions because it does pointing to the opposite meaning. I would recommend to call it "bKuthitotehvjhd" as well if it's not intended to get understanding for beginner coders.

For turning stuff in a more serious way I would call that variable "bNoMoreReplace". When is True replacement will stop working - LOGIC based.

PS
Note 1:
If this would be my mutator it would get turned in a State code without Timer, because it's simple to do that. "Auto State StoppingReplacements".
Note 2:
I see no deal according to velocity for the case of DropWhenKilled and/or RespawnTime since the replacement is done in the same old borked primitive format using "ReplaceWith" (different in 227 ??) . To translate it for other environment let's install Windows95.
Post Reply