Getting Unreal & UT weapons to exist simultaneously?

  • 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.

WildWing

New Member
Sep 16, 2001
87
0
0
New York City
Visit site
What I'm trying to do on my map is get Unreal & UT weapons to exist within a UT Death Match game type, without UT weapons replacing their Unreal counterparts as they always do... Now after trying to switch game types over and over, it looks like my last chance at doing this is to create a new subclass under "Tournament Weapon" in the actor class browser. The thing is, I did try this with an Automag, I copied the script for the Automag, created a new subclass under "Tournament Weapon" called "UT Automag", pasted the script and changed all that I THOUGHT needed to be changed so that it would worK correctly in a UT level with being replaced, then compiled it, I got no errors but... But I was able to get the Automag into the game but when firing it, it did none of it's animation or firing sounds, and left boxes or ammunition pickups in the air for it's projectile? :p Anyway can any of you poeple out there that know how to code tell what I didi wrong with this, I'm almost sure it could be done, just that I messed up somewhere in the coding. But I came pretty close to getting it to work, the Automag did show up unreplaced by a UT's Enforcer, just disfunctional:p
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
Every GameType class has a BaseMutatorClass property which is set to class'Botpack.DMMutator' for all UT gametypes.

Try this:
Subclass Botpack.DMMutator and remove the weapon replacement stuff from CheckReplacement(). If you want to create a new gametype use the new subclass as the BaseMutator.
If you want to write a mutator put the following code in it:
Code:
function ReplaceDMMutator()
{
	local Mutator M, PrevMutator, BaseNextMutator, NewBaseMutator;
	
	log("Replacing BaseMutator...");
	if ( Level.Game.IsA('DeathMatchPlus') && Level.Game.BaseMutator.Class == Class'Botpack.DMMutator' ) {
		For ( M = Level.Game.BaseMutator; M != None; M = M.NextMutator )
			if ( M.NextMutator == Self ) {
				PrevMutator = M;
				break;
			}
		if ( PrevMutator != None )
			PrevMutator.NextMutator = NextMutator;
		BaseNextMutator = Level.Game.BaseMutator.NextMutator;
		
		NewBaseMutator = Spawn(class'[i]YourPackage.YourNewDMMutatorSubclass[/i]');
		if ( NewBaseMutator != None ) {
			NewBaseMutator.NextMutator = BaseNextMutator;
			Level.Game.BaseMutator.Destroy();
			Level.Game.BaseMutator = NewBaseMutator;
		}
		log("BaseMutator now is"@Level.Game.BaseMutator);
	}
	else
		log("BaseMutator still is"@Level.Game.BaseMutator);
}
Call ReplaceDMMutator() inside PreBeginPlay() to replace the base mutator.

If you just want to make a map it might become more difficult. Try creating a hidden actor that has the replacement code inside and put it somewhere in your map. (I don't know if this works.)
 

WildWing

New Member
Sep 16, 2001
87
0
0
New York City
Visit site
Originally posted by Wormbo
Every GameType class has a BaseMutatorClass property which is set to class'Botpack.DMMutator' for all UT gametypes.

Try this:
Subclass Botpack.DMMutator and remove the weapon replacement stuff from CheckReplacement(). If you want to create a new gametype use the new subclass as the BaseMutator.
If you want to write a mutator put the following code in it:
Code:
function ReplaceDMMutator()
{
	local Mutator M, PrevMutator, BaseNextMutator, NewBaseMutator;
	
	log("Replacing BaseMutator...");
	if ( Level.Game.IsA('DeathMatchPlus') && Level.Game.BaseMutator.Class == Class'Botpack.DMMutator' ) {
		For ( M = Level.Game.BaseMutator; M != None; M = M.NextMutator )
			if ( M.NextMutator == Self ) {
				PrevMutator = M;
				break;
			}
		if ( PrevMutator != None )
			PrevMutator.NextMutator = NextMutator;
		BaseNextMutator = Level.Game.BaseMutator.NextMutator;
		
		NewBaseMutator = Spawn(class'[i]YourPackage.YourNewDMMutatorSubclass[/i]');
		if ( NewBaseMutator != None ) {
			NewBaseMutator.NextMutator = BaseNextMutator;
			Level.Game.BaseMutator.Destroy();
			Level.Game.BaseMutator = NewBaseMutator;
		}
		log("BaseMutator now is"@Level.Game.BaseMutator);
	}
	else
		log("BaseMutator still is"@Level.Game.BaseMutator);
}
Call ReplaceDMMutator() inside PreBeginPlay() to replace the base mutator.

If you just want to make a map it might become more difficult. Try creating a hidden actor that has the replacement code inside and put it somewhere in your map. (I don't know if this works.)
Ok, I'm going to the first suggestion first, but twhere is this "Botpack.DMMutator" located in the Actor Class?
 

WildWing

New Member
Sep 16, 2001
87
0
0
New York City
Visit site
Originally posted by Wormbo
Actor -> Info -> Mutator -> DMMutator
Ok, I think I'll try creating a hidden Actor with this code in it instaed, because I am doing a map that I want this to be a part of, so how do I do that? (create a hidden actor with this code in it) Please explain this in mass detail, I know nothing about coding. :D
 
Last edited:

WildWing

New Member
Sep 16, 2001
87
0
0
New York City
Visit site
Originally posted by Wormbo
Actor -> Info -> Mutator -> DMMutator
I did what you said as far as creating an Actor subclassed from "DMMutator" but when I try to play the level to see if things are working correctly, I get an error message saying "Can't find EditPackage MyMutator" What am I doing wrong?
 

WildWing

New Member
Sep 16, 2001
87
0
0
New York City
Visit site
Originally posted by Wormbo

:confused:
Did you compile your stuff?
What I did was subclass "DMMutator" past in the script for the new Actor and at the upper left corner of the Actor Class browser press "Compile changed scripts" Did I miss something or was this done totally wrong anyway, how would you do it?
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
I'm not using UnrealEd for coding stuff so I can't tell if you did something wrong.
I'm working the way described here (from '10 - Don't Use UnrealEd' to '13 - How You Build Your Package')
I use EditPad Lite to edit the .UC files created in the tutorial.
 

WildWing

New Member
Sep 16, 2001
87
0
0
New York City
Visit site
Originally posted by Wormbo
I'm not using UnrealEd for coding stuff so I can't tell if you did something wrong.
I'm working the way described here (from '10 - Don't Use UnrealEd' to '13 - How You Build Your Package')
I use EditPad Lite to edit the .UC files created in the tutorial.
I downloaded EditPad Lite, so what do I do export the "DMMutator" script then open it up with EditePad? And what exactly do I do with this code you supplied me with, do I take out the line of the original "DMMutator" code with the weapon replacment stuff and put in the code you gave me. Or just paste what you gave me right into this new Actor?
 

WildWing

New Member
Sep 16, 2001
87
0
0
New York City
Visit site
I think I'm getting close to solving this puzzle, I was able to get the UNREAL Minigun into the game but for some reason it won't fire? I was thinking that it has something to do with selecting those animation meshes from the mesh browser but I'm not sure, any ideas?