Jump to content

How to test mutator??


Axesor

Recommended Posts

Hello there

I am total NOOB and I was trying to learn something and was doing my own mutator BUT I dont know how to test it now!

To test your mutator copy this file into the Renegade X/UDKGame/CookedPC folder and add a ?mutator=YourModPackageName.YourMutatorsMainClassExtendingUTMutator parameter to the Renegade X starting parameters or you could start it from the command line from inside UDK-2014-02/Binaries/Win32 folder like: udk CNC-Walls_Flying?game=RenX_Game.Rx_Game?mutator=YourModPackageName.YourMutatorsMainClassExtendingUTMutator -nomovie -windowed -log -forcelogflush

To start the game with multiple mutators you can concat the mutators with a "," like ?mutator=Mutator1,Mutator2, ...

What the hell is this curse???

?mutator=YourModPackageName.YourMutatorsMainClassExtendingUTMutator parameter to the Renegade X starting parameters or you could start it from the command line from inside UDK-2014-02/Binaries/Win32 folder like: udk CNC-Walls_Flying?game=RenX_Game.Rx_Game?mutator=YourModPackageName.YourMutatorsMainClassExtendingUTMutator -nomovie -windowed -log -forcelogflush

I didn't get nothing from it. Can somebody please explain to me how do I test my mutator, step by step? Just like you was explaining this to your grandma. Please

Thank you

Link to comment
Share on other sites

  • Totem Arts Staff

1. Make a shortcut of your udk.exe

2. Open shoetcut's properties

3. In Target box, after UDK.exe, add without space ?Mutator=PackageName.ClassName

4. Ok, then open that shortcut

package name is the main folder where you store your mutator script classes. Class name is the name of the script .uc file

Link to comment
Share on other sites

"...\Renegade X\Binaries\Win32\UDK.exe"

Nwm I am just dump. I didn't even created any mutator. I just changed few values in source code and saved it in MyMutator/Classes/ folder. Sorry I am trying to get into it... I never worked with codes before.

Moderators, please, remove this thread so players who actually made a mutator won't be confused looking for answer here.

But hey. Thx for respond. I actually get it from your instructions.

Edited by Guest
Link to comment
Share on other sites

Nope. I couldn't even run this simple mutator which does nohing. I was following step by step. Tried it multiple times. But the result was alway same-I can't test it.

I tried "...\Renegade X\Binaries\Win32\UDK.exe"?Mutator=Extra.FasterHarvies

also "...\Renegade X\Binaries\Win32\UDK.exe?Mutator=Extra.FasterHarvies"

Not working. When I try to save changes It throws error messages at me, that the target name is invalid.

An Example

Let's write a mutator that makes harvies go faster. First, install the UDK. Currently RenX was released with the July 2013 version of the UDK so lets install that. From http://download.udk.com/UDKInstall-2013-07.exe, if you're lazy. It probably goes to C:\udk\udk-2013-07. Now we make a project. Let's call our project Extra and our mutator FasterHarvies (following the example above).

Go to UDKROOT\Development\src\ and make the folder Extra. Then make the folder Extra\Classes.

Now go to UDKROOT\UDKGame\Config\DefaultEngineUDK.ini and find the section "UnrealEd.EditorEngine". This is where we add packages to be compiled. At the end of this section, add +EditPackages=Extra

Now our environment is ready. Create UDKROOT\Development\src\Extra\Classes\FasterHarvies.uc and open it with notepad (or notepad++ if you're smart).

Type "class FasterHarvies extends UTMutator;". Save the file. Now, run Unreal Frontend (this is installed with UDK), click the arrow dropdown under Script, and click Compile Scripts. If all goes well, the output should end like this

--------------------Extra - Release--------------------

Analyzing...

Scripts successfully compiled - saving package 'C:\UDK\UDK-2013-07\Binaries\Win32\..\..\UDKGame\Script\Extra.u'

Congratulations, you just made a mutator which does nothing. To test, copy Extra.u (from the path above) to your Renegade X server, under ROOT\UDKGame\CookedPC and run your server, adding to the command line ?Mutator=Extra.FasterHarvies

Also when I try to compile this sctipt in Unreal Frontend:

class FasterHarvies extends UTMutator;

It throws error message at me

Error, Superclass UTMutator of class FasterHarvies not found

So I had to correct the code (I don't even know if it's right but I saw it in another tutorials) like this:

class FasterHarvies extends Mutator;

And then it worked.

Also I am not using Udk-2013-07 but SDK.. I hope it doesn't matter :x

Link to comment
Share on other sites

  • Totem Arts Staff

First. it's UDK.exe CNC-[name of map]?mutator=Extra.FasteeHarvies. notice the map included in the command

Yeah, you gotta include the map, for example, if you want to run Islands, do it like this : "...\RenegadeX\Binaries\Win32\UDK.exe" CNC-Islands?Mutator=Extra.FasterHarvies

Second, extend it from Rx_Mutator instead of UTMutator

Link to comment
Share on other sites

  • Totem Arts Staff

Funny, really. You sure the editor compiles the scripts right? check renx_game or UTGame for those classes.....

unless, oooooh you put it in EditPackages did you? no. you add it in ModEditPackages on the bottom of the list. the order is important so it compiles renx scripts first THEN compiles your mutator

Link to comment
Share on other sites

  • Totem Arts Staff

The script compiles in order, ModEditPackages is compiled after EditPackages. So here's what happened before :

Your script compiles before the UTGame does, that's why it cannot find the UTMutator class, which is in UTGame. The package and their classes hasn't existed yet. RenX compiles after UTGame, that is why your mutator cannot detect Rx_Mutator as well.

Link to comment
Share on other sites

Guys...I'm cornered. I have my vision of mutator but I don't have nothing to bounce from. I have read several websites with Mutator tutorials for UT3, KillingFloor and general Mutator tutorials. I also tried to learn from downloaded Mutators from servers and this webside.. I didn't found nothing what I needed :/

Well, I tried to edit the values for the basic pistol, which I think would be the easiest, to know if my next mutators gonna work. This is my codes:

class Pistol_HC extends Rx_Mutator;

function InitMutator(string Options, out string ErrorMessage)

{

if (Rx_Game(WorldInfo.Game) != None)

{

Rx_Game(WorldInfo.Game).DefaultInventory[0] = class'Rx_Weapon_Pistol_HC';

}

Super.InitMutator(Options, ErrorMessage);

}

function bool CheckReplacement(Actor Other)

{

if (Other.IsA('Rx_Weapon_Pistol'))

{

ReplaceWith(Other, "Rx_Weapon_Pistol_HC");

}

return true;

}

+

class Rx_Weapon_Pistol_HC extends Rx_Weapon_Reloadable;

DefaultProperties

{

InstantHitDamage(0)=100 // 20 berore

InstantHitDamage(1)=0

}

Compilation didn't show any error message.

I'm completely new in this, without any previous experience in coding, and I'm trying to create my own mutator for the third day already. Without any success.

Link to comment
Share on other sites

I only see this small part of code and don't know anything about u script, but shouldn't the classname in your first line of code have "Rx_Weapon_" in front of it?

Just ignore this if that's not the problem, sometimes it can be these small things you overlook.

Link to comment
Share on other sites

In the first script I tried to replace original file named: Rx_Weapon_Pistol

with file that has edited values in it. I named it: Rx_Weapon_Pistol_HC

The second script is the file with edited values in it. And I want the game to use this values instead of original ones.

Shouldn't the classname in your first line of code have "Rx_Weapon_" in front of it?

I don't know if it's matters. I thought I can name it Potato if I want O_o

It's just a name of file and script. I guess...

Oh men I feel so bad and demotivated. I am complete noob.

Link to comment
Share on other sites

I think I am getting very close. If nobody will help me in this phase now, then I get stuck at this forever. Please help.

This is my second version of codes. And its not working:

class Pistol_HC extends Rx_Mutator;

function InitMutator( string Options, out string ErrorMessage )

{

if(Rx_Game(WorldInfo.Game) != none)

{

Rx_Game(WorldInfo.Game).DefaultInventory[0] = class'Rx_Weapon_Pistol_HC';

}

super.InitMutator( options, ErrorMessage );

}

function bool CheckReplacement( Actor Other )

{

if(Other.IsA('Rx_Weapon_Pistol'))

{

ReplaceWith(Other, "Rx_Weapon_Pistol_HC");

}

return true;

}

DefaultProperties

{

}

+

class Rx_Weapon_Pistol_HC extends Rx_Weapon_Pistol;

DefaultProperties

{

WeaponRange=10000.0

InstantHitDamage(0)=100

InstantHitDamage(1)=0

HeadShotDamageMult=1.0

}

Link to comment
Share on other sites

What weapons a player holds is managed by an Rx_InventoryManager. With the way it spawns and references its weapons you need to tell it the new weaponclass to successfully exchange a weapon with your modified version. The following code i did for a Mutator a while back contains some examples on how to change multiple stuff in the game including weapons:

class PrePatchBalanceMutator extends UTMutator 
config(PrePatchBalanceMutator);

var config int AirdropCooldownTime;


function InitMutator(string Options, out string ErrorMessage)
{
if (Rx_Game(WorldInfo.Game) != None)
{
	Rx_Game(WorldInfo.Game).PlayerReplicationInfoClass = class'PrePatchBalanceMod.Rx_Pri_Modified';
	Rx_Game(WorldInfo.Game).PlayerControllerClass = class'PrePatchBalanceMod.Rx_Controller_Modified';
	Rx_Game(WorldInfo.Game).DefaultPawnClass = class'PrePatchBalanceMod.Rx_Pawn_Modified';
}	

super.InitMutator(Options, ErrorMessage);	 	 
}

event PreBeginPlay()
{
local Rx_Building_Silo_Internals Silo;
local Rx_PurchaseSystem PurchaseSystem;
local Rx_Vehicle_Apache Apache;
local Rx_Vehicle_Orca Orca;

super.PreBeginPlay(); 

SetTimer(5.0,true,'CheckRefDead');

Silo = Rx_Building_Silo_Internals(GetDefaultObject(Class'Rx_Building_Silo_Internals')); 
Silo.CreditsGain = 0.5f;		

PurchaseSystem = Rx_PurchaseSystem(GetDefaultObject(Class'Rx_PurchaseSystem')); 
PurchaseSystem.AirdropCooldownTime = AirdropCooldownTime;		

Apache = Rx_Vehicle_Apache(GetDefaultObject(Class'Rx_Vehicle_Apache')); 
Apache.Health=375;	

Orca = Rx_Vehicle_Orca(GetDefaultObject(Class'Rx_Vehicle_Orca')); 
Orca.Health=375;						
}

function bool CheckReplacement(Actor Other)
{
if (Other.IsA('Rx_InventoryManager_GDI_RocketSoldier'))
{
	Rx_InventoryManager_GDI_RocketSoldier(Other).PrimaryWeapons[0] = class'Rx_Weapon_RevisedMissileLauncher';
}	
if (Other.IsA('Rx_InventoryManager_Nod_RocketSoldier'))
{
	Rx_InventoryManager_Nod_RocketSoldier(Other).PrimaryWeapons[0] = class'Rx_Weapon_RevisedMissileLauncher';
}
if (Other.IsA('Rx_InventoryManager_GDI_McFarland'))
{
	Rx_InventoryManager_GDI_McFarland(Other).PrimaryWeapons[0] = class'Rx_Weapon_RevisedFlakCannon';
}
if (Other.IsA('Rx_InventoryManager_GDI_Shotgunner'))
{
	Rx_InventoryManager_GDI_Shotgunner(Other).PrimaryWeapons[0] = class'Rx_Weapon_RevisedShotgun';
}	
if (Other.IsA('Rx_InventoryManager_Nod_Shotgunner'))
{
	Rx_InventoryManager_Nod_Shotgunner(Other).PrimaryWeapons[0] = class'Rx_Weapon_RevisedShotgun';
}
return true;
}

/** The following sets bLastHitWasDamagingPlayer wich is used in Rx_Pri_Modified to change credit gain */
function NetDamage(int OriginalDamage, out int Damage, Pawn Injured, Controller InstigatedBy, vector HitLocation, out vector Momentum, class DamageType, Actor DamageCauser)
{	
super.NetDamage(OriginalDamage, Damage, Injured, InstigatedBy, HitLocation, Momentum, DamageType, DamageCauser);
if(InstigatedBy != None && !InstigatedBy.IsA('SentinelController') && InstigatedBy.PlayerReplicationInfo != None && Rx_Pawn(Injured) != None)
{
	Rx_Pri_Modified(InstigatedBy.PlayerReplicationInfo).bLastHitWasDamagingPlayer = true;
}
}

/** Reduces Credit gain from a dead refinery */
function CheckRefDead()
{
local Rx_Building_Refinery Refinery;

ForEach AllActors(class'Rx_Building_Refinery',Refinery)
{
	if (Refinery.IsDestroyed())
	{
		Refinery.CreditsPerTick = 1.0f; // Gets halfed once more in the Refinery class
	}
}
}

final static function object GetDefaultObject(class ObjClass)
{
return FindObject(ObjClass.GetPackageName()$".Default__"$ObjClass, ObjClass);
}

defaultproperties
{

}

Link to comment
Share on other sites

I can't belive it's finally working! Thank you RypeL!

This is how it should look like:

class Pistol_HC extends Rx_Mutator;

function bool CheckReplacement(Actor Other)

{

if (Other.IsA('Rx_InventoryManager'))

{

Rx_InventoryManager(Other).SidearmWeapons[0] = class'Rx_Weapon_Pistol_HC';

}

return true;

}

DefaultProperties

{

}

I had an example of what I needed in front of my eyes all the time. I am soo dumb.

But hey, I am definitely going to find use for the rest of the codes that you posted :)

Link to comment
Share on other sites

So, I've been making progress with my mutator and now I am stuck again.

I have been trying to replace carbine in purchase terminal by my own carbine. And this error message I get when I tried to compile it.

C:\...\SDK\Development\Src\Extra\Classes\AHardCore.uc(15) : Error, Can't assign Const variables

Failure - 1 error(s), 0 warning(s)

And this is that part of mutator code:

(1)class AHardCore extends Rx_Mutator;

(2)

(3) function bool CheckReplacement(Actor Other)

(13) if (Other.IsA('Rx_PurchaseSystem'))

(14) {

(15) Rx_PurchaseSystem(Other).GDIWeaponClasses[1] = class'Rx_Weapon_Carbine_HC';

(16) }

(17) if (Other.IsA('Rx_PurchaseSystem'))

(18) {

(19) Rx_PurchaseSystem(Other).NodWeaponClasses[1] = class'Rx_Weapon_Carbine_HC';

(20) }

(21)

(22)

(23) return true;

(24)}

(25)

(26)

(27)DefaultProperties

(28){

(29)}

Don't worry, I am NOT working on Call of Duty mod :D Thank you for any respond :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...