• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/
  • Weve updated the Tripwire Privacy Notice under our Policies to be clearer about our use of customer information to come in line with the EU General Data Protection Regulation (GDPR) rules that come into force today (25th May 2018). The following are highlights of our changes:


    We've incorporated the relevant concepts from the GDPR including joining the EU and Swiss Privacy Shield framework. We've added explanations for why and how Tripwire processes customer data and the types of data that we process, as well as information about your data protection rights.



    For more information about our privacy practices, please review the new Privacy Policy found here: https://tripwireinteractive.com/#/privacy-notice

Mutator Common Coding Problems and solutions

FBX

FNG / Fresh Meat
Aug 17, 2006
238
42
0
Did you try to replace the default pawn setting in the gametype via a mutator?
Something like
Code:
function PreBeginPlay() 
{     
   super.PreBeginPlay();
   class'Package.Class'.default.WhateverProperty=10; 
}
The stuff I want to change isn't a setting. I want to override existing functions with my own.

Unrealscript confuses me in that if I take the controller which owns the pawn and typecast the pawn to my own custom class which extends ROPawn, then assign it to the controller's pawn, it breaks. The old pawn disappears (if I use checkreplacement and return false) and the new one doesn't have any functionality. If I don't use checkreplacement the old pawn hangs around but doesn't work.
 

FBX

FNG / Fresh Meat
Aug 17, 2006
238
42
0
I have a few questions to which I do not have the answer. I hope someone can help me out:

  1. How can I write something to the RO2 log file?
    I've tried the `log and `logd macro with -debug passed to the make command, but I still do not see anything appear in the log files.
  2. How should I make my mutator known (and selectable) in the web-admin tool?
  3. How should the format of the defaulthullmgmutator.ini file look like for the next mutator class? (it's just a snipped of the class)
Code:
class HullMGMutator extends Mutator
    config(HullMGMutator);
    
struct MissPercentages
{
    var float Recruit;
    var float Soldier;
    var float Veteran;
    var float Hero; 
};

var config MissPercentages HullMGMissPercentages;
I've tried this, but the mutator doesn't seem to load it:
Code:
[HullMGMutator.HullMGMutator]
HullMGMissPercentages=(Recruit=75.0,Soldier=70.0,Veteran=65.0,Hero=60.0)
100% ditto on logging. Would make debugging this stuff a lot easier to see what the variables are at certain points.
 

worluk

FNG / Fresh Meat
Nov 21, 2005
2,226
85
0
The stuff I want to change isn't a setting. I want to override existing functions with my own.

Unrealscript confuses me in that if I take the controller which owns the pawn and typecast the pawn to my own custom class which extends ROPawn, then assign it to the controller's pawn, it breaks. The old pawn disappears (if I use checkreplacement and return false) and the new one doesn't have any functionality. If I don't use checkreplacement the old pawn hangs around but doesn't work.
You misunderstood. I suggested you replace the gametypes default pawn that way, therefore not requiring a checkreplacement as the standard gamecode would spawn your pawn by default.
 

worluk

FNG / Fresh Meat
Nov 21, 2005
2,226
85
0
I have a few questions to which I do not have the answer. I hope someone can help me out:

  1. How can I write something to the RO2 log file?
    I've tried the `log and `logd macro with -debug passed to the make command, but I still do not see anything appear in the log files.
  2. How should I make my mutator known (and selectable) in the web-admin tool?
  3. How should the format of the defaulthullmgmutator.ini file look like for the next mutator class? (it's just a snipped of the class)
Code:
class HullMGMutator extends Mutator
    config(HullMGMutator);
    
struct MissPercentages
{
    var float Recruit;
    var float Soldier;
    var float Veteran;
    var float Hero; 
};

var config MissPercentages HullMGMissPercentages;
I've tried this, but the mutator doesn't seem to load it:
Code:
[HullMGMutator.HullMGMutator]
HullMGMissPercentages=(Recruit=75.0,Soldier=70.0,Veteran=65.0,Hero=60.0)
*shrug* no idea about the log, HoS was not in any state when i tried and i wont touch its code with a ten foot pole now.
What you could do though for debugging (in case you dont want to use the to my knowledge working, real debugger option that comes with nfringe), you can use a broadcast call to print stuff ingame. Did that for debugging tank code for CC.

For the mutator to show up in webadmin you need the .ini and .int file for the mutator. Check other files of that sort and the standard tutorials on UT3/UE3 mutators on how those should look.
 

Ducky

Super Moderator
May 22, 2011
6,359
237
0
Netherlands
*shrug* no idea about the log, HoS was not in any state when i tried and i wont touch its code with a ten foot pole now.
What you could do though for debugging (in case you dont want to use the to my knowledge working, real debugger option that comes with nfringe), you can use a broadcast call to print stuff ingame. Did that for debugging tank code for CC.

For the mutator to show up in webadmin you need the .ini and .int file for the mutator. Check other files of that sort and the standard tutorials on UT3/UE3 mutators on how those should look.
I did, but they all refer to using this command:
Code:
ucc dumpint HullMGMutator.u
But I can't find any ucc executable :(

By the way. I was always in the impression that those .int files were only for UT2003 and not for UT2004 and his offspring's.

Well at least I got mu mutator to load the defaulhullmgmutator.ini file now. There was a typo in the .ini file name on my server :D
 

worluk

FNG / Fresh Meat
Nov 21, 2005
2,226
85
0
No need for that command, the int files are plain ascii anyway. As i said, there are enough mutator tutorials out there stating how those files are set up. You will need .ini, .u and .int for the mutator to show up in the webadmin
 

Ducky

Super Moderator
May 22, 2011
6,359
237
0
Netherlands
No need for that command, the int files are plain ascii anyway. As i said, there are enough mutator tutorials out there stating how those files are set up. You will need .ini, .u and .int for the mutator to show up in the webadmin
I did that. I have the .ini and .u. I also created a .int following instructions from the internet, but still the mutator doesn't show up on the Change Map screen.
Mostly I've been using this http://wiki.beyondunreal.com/Legacy:UnrealScript_Hello_World (which is using the 'older' UT2003) and this http://wiki.beyondunreal.com/UnrealScript_Hello_World. And again here http://wiki.beyondunreal.com/Legacy:Create_An_INT_File (which is again for UT2003 only).
But none of those works.

Maybe you know a better web-link for me, because i'm running out of options? :(
 
Last edited:

Mekhazzio

FNG / Fresh Meat
Sep 21, 2011
1,104
641
0
Yeah, it's not a file problem. (also, the .int files are unicode, not ascii)

It looks to me like there's a flaw in the webadmin mutator handling. It's recognizing that the mutators are there, and it's reading the ROUIDataProvider_Mutator block correctly (the part that checks for duplicates functions) but it's not populating that data into the DCEMutator object that it uses for all its internal handling (verified with "getall dcemutator classname" on the server console). With all the data left null, the later logic breaks down, of course.

It looks to me like it's missing a call to DCEMutator.init() on DataStoreCache.uc line 574.
 
  • Like
Reactions: Ducky

Ducky

Super Moderator
May 22, 2011
6,359
237
0
Netherlands
Yeah, it's not a file problem. (also, the .int files are unicode, not ascii)

It looks to me like there's a flaw in the webadmin mutator handling. It's recognizing that the mutators are there, and it's reading the ROUIDataProvider_Mutator block correctly (the part that checks for duplicates functions) but it's not populating that data into the DCEMutator object that it uses for all its internal handling (verified with "getall dcemutator classname" on the server console). With all the data left null, the later logic breaks down, of course.

It looks to me like it's missing a call to DCEMutator.init() on DataStoreCache.uc line 574.
Amazing... You really did dive deap into the scripting that comes with the SDK. Nice bug tracking :)
 
Last edited:

Ducky

Super Moderator
May 22, 2011
6,359
237
0
Netherlands
100% ditto on logging. Would make debugging this stuff a lot easier to see what the variables are at certain points.
Figured out how to write stuff to the servers log files. This is what is working for me:
Code:
`Log("Some message that I want to log",, 'MyMutatorClass');
 

LordGleedo

FNG / Fresh Meat
Jul 18, 2010
800
74
0
Bucks, England
www.theoldgitsarmy.com
I did, but they all refer to using this command:
Code:
ucc dumpint HullMGMutator.u
But I can't find any ucc executable :(

By the way. I was always in the impression that those .int files were only for UT2003 and not for UT2004 and his offspring's.

Well at least I got mu mutator to load the defaulhullmgmutator.ini file now. There was a typo in the .ini file name on my server :D
The UCC.exe was the old UT2004 compiler, so you could try running rogame.exe dumpint HullMGMutator.u to see if that works.
 

Yoshiro

In Soviet Russia, Yoshiro is a cake
Staff member
Oct 10, 2005
12,248
3,444
113
UCC isn't really part of the engine anymore.
 

FBX

FNG / Fresh Meat
Aug 17, 2006
238
42
0
The issue I'm having is that as a client on a dedicated server I'm not seeing any of the mutator function calls working. None of my log messages show up in the console. Nothing client side seems to happen. I've tried some very basic stuff and have tried making a client function then having the server call it, but nothing happens.

The server-side stuff seems to work (such as modifying variables that are replicated to the client), and the client side stuff works on a listen server, but thats it.
 

Ducky

Super Moderator
May 22, 2011
6,359
237
0
Netherlands
The issue I'm having is that as a client on a dedicated server I'm not seeing any of the mutator function calls working. None of my log messages show up in the console. Nothing client side seems to happen. I've tried some very basic stuff and have tried making a client function then having the server call it, but nothing happens.

The server-side stuff seems to work (such as modifying variables that are replicated to the client), and the client side stuff works on a listen server, but thats it.
If you run it on a dedicated server, do you then see your log lines in the server logs?

An other thing that you can try is to place your mutator by hand in the steam\SteamApps\common\Red Orchestra 2\ROGame\CookedPC\Script folder. Next connect to the dedicated server and try it again.
 

FBX

FNG / Fresh Meat
Aug 17, 2006
238
42
0
As I said, the server stuff runs, but I can't find evidence that my client stuff runs at all. Changing sensitivity is entirely client-side.

It'd be nice if someone had a simple example that worked so I can try to figure out what I'm doing wrong. I have the functions I am calling as "client" or "simulated" and I have them mentioned in the replication statement:

Code:
replication
{
    reliable if (Role == ROLE_Authority)
        addInputClient, LogicCheckerTimerClient;
}


reliable client function addInputClient(PlayerInput newinput, ROPawn MyPawn) {
... etc
 
Last edited:

FBX

FNG / Fresh Meat
Aug 17, 2006
238
42
0
I'm giving up. My conclusion is that the mutator isn't being loaded at all on the cilent. I'm not seeing anything in the client logs that mention actually loading the mutator. Shame
 
Last edited:

Ducky

Super Moderator
May 22, 2011
6,359
237
0
Netherlands
I'm giving up. My conclusion is that the mutator isn't being loaded at all on the cilent. I'm not seeing anything in the client logs that mention actually loading the mutator. Shame
Don't give up. PM you sources to TWI's dev team and ask for assistance/advice. They did help me out when I had an issue with my mutator.
 

FBX

FNG / Fresh Meat
Aug 17, 2006
238
42
0
TWI, can you please verify that mutators are being loaded on the client side like it should? If so, can you provide the code for a test example that proves this?
 
  • Like
Reactions: Ducky

[TW]Strago

Tripwire Interactive Staff
Jun 23, 2010
166
204
0
How can I write something to the RO2 log file?
I've tried the `log and `logd macro with -debug passed to the make command, but I still do not see anything appear in the log files.
Script logging is disabled by default to improve the performance of players who don't need it. To enable it type 'Unsuppress ScriptLog' into the console or remove 'Suppress=ScriptLog' from ROEngine.ini.

Adding a custom logging group such as, 'MyMutatorClass', also does the trick because MyMutatorClass is not suppressed.