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

Code Adding Weapons (M2 Carbine) to classes

On my computer at home I created a spreadsheet outlining all the steps required to put a new weapon into the game. From scratch and with some simplification there are over 100. Your work is cut out for you :)

To avoid confusion when I talk: class = coding concept. Role = rifleman, SL etc.

To get the weapon into a class: Examine RORoleInfo and its subclasses in RSGame. You will need to create a new role class extending the old role class. Then you will need to access the game's ROMapInfo and swap out instances of the old role class with your new class. This is most easily done with a mutator.

You will need to create a localization file for your code package and give a friendly name for your new weapon (or it will appear as the M1 still.) Find ROGame.int in the install location's localization folder and see how the weapons are named.

You will need to edit several other classes to properly integrate the weapon into all aspects of the game's UI.
 
Upvote 0
Huh, it didn't work I don't know what's wrong, am I supposed to keep this in my C:\Users\Tobias\Documents\My Games\RedOrchestra2\ROGame\Published\CookedPC
Or do I move it to the Game's files?
I'm brewing this with my M2_Carbine Files, I've placed everything in a Classes folder called MutM2Carbine

Your code should go in a directory like this

C:\Users\Tobias\Documents\My Games\RedOrchestra2\ROGame\Src\<DesiredScriptPackageName>\Classes

Your content package should go in:

C:\Users\Tobias\Documents\My Games\RedOrchestra2\ROGame\Unpublished\CookedPC\Packages

Make sure to add

ModPackages=DesiredScriptPackageName

in the ModPackage section of ROEditor.ini. Make this read only afterwards. Otherwise the make commandlet won't try to compile your files.
 
Upvote 0
Your code should go in a directory like this

C:\Users\Tobias\Documents\My Games\RedOrchestra2\ROGame\Src\<DesiredScriptPackageName>\Classes
Oops, didn't realise I said that wrong, yeah this is exactly where the script files are, I meant that I had classes folder with the files in a folder called MutM2Carbine

Currently my finished product is MutM2Carbine.u
Yeah, I've already added that line previously, however, how would I make the ROEditor Read only?
Hmm, I don't appear to have a Folder called Packages, in my CookedPC folder
I'm also an Idiot, I realised that I also needed to change the role info in the map itself, just did that right now.
alright so it still doesn't work, I think I need to rebuild the map.
 
Last edited:
Upvote 0
Oops, didn't realise I said that wrong, yeah this is exactly where the script files are, I meant that I had classes folder with the files in a folder called MutM2Carbine

Currently my finished product is MutM2Carbine.u
Yeah, I've already added that line previously, however, how would I make the ROEditor Read only?
Hmm, I don't appear to have a Folder called Packages, in my CookedPC folder

You'll want to create that folder; I don't believe it's strictly necessary but it's good for organization.

So you've been able to compile I take it? How are you swapping your role classes?

Edit: right click the .ini, select properties and you should see it near the bottom of the window. This is to prevent the file from being reset to its defaults (wiping your additions) which can sometimes happen during updates.
 
Last edited:
Upvote 0
You'll want to create that folder; I don't believe it's strictly necessary but it's good for organization.

So you've been able to compile I take it? How are you swapping your role classes?
I'm assuming in the editor you mean, I put the MutM2Carbine.u in a map, I've gone into the WorldInfo, and changed all the roles from RSInfo(Faction)(Role) to RSInfo(Faction)(Role)_Mk2
so RSInfoAlliedEngineer becomes RSAlliedEngineer_Mk2
I'm building the map right now, so I don't know how long that will take.
 
Last edited:
Upvote 0
I'm assuming in the editor you mean, I put the MutM2Carbine.u in a map, I've gone into the WorldInfo, and changed all the roles from RSInfo(Faction)(Role) to RSInfo(Faction)(Role)_Mk2
so RSInfoAlliedEngineer becomes RSAlliedEngineer_Mk2
I'm building the map right now, so I don't know how long that will take.

That should work, but of course it's not portable across maps. It's possible to write a mutator that will replace these roles at runtime.
 
Upvote 0
I haven't built the map, had to something, but would I need to rebuild it if I changed the roles in the WorldInfo?

If you didnt move or add anything to the map then you wouldnt need to rebuild it. Just save it and test it in PIE to make sure all roles appear when spawning. Then publish map and test it in actual game through steam workshop tab
 
Upvote 0
By publish I meant "cook" the map to compress it where it will then show up in your
C:\Users\Tobias\Documents\My Games\RedOrchestra2\ROGame/Published/Maps Folder. Then you launch the game and click the Steam Workshop tab on the home screen, your map should appear in the list.

A few questions to help clarify your issue though:

Have you added PlayerStartVolumes with ROPlayerStart Actors to accomidate however many players you will need?

Have you set up the Kismet to enable these PlayerStartVolumes?

If you have ROObjectives placed, are they associated with ROObjectiveVolumes and also activated in Kismet?

This is a good guide to a basic map set up to at least spawn players:
http://forums.tripwireinteractive.com/showthread.php?t=87123


Did you set the Game type to ROTerritories or something else?

Is the map named TE-mapname or whichever gametype you chose?

What exactly isn't working?
Players don't spawn?
Roles don't appear?
Map crashes the game?

354QO1S.jpg

Im not a coder, but the mutators that I have seen were all .u files I thought??
 
Last edited:
Upvote 0
Yeah, I have a mutator .u file.
These are the uncompiled files for the mutator.
for some reason on my RSTE-Saipan_M2 test map, even if I swap out the roles with the others the roles and weapons appear to be the originals (without the M2). I can spawn perfectly fine,
I'm wondering if I'm missing a file, this is my first time coding, so I don't know much, but it seems to quite fun & interesting, plus I'm determined.

I've brewed and tested both the map & the files, I'll try it on Spreewald which was my old test, seen in the video. It's in RO2, but it could be just something is wrong with Saipan (probably not, but it's worth eliminating as many factors as possible).
I've fooled around on the SDK for about 200+ hours now, I'm not a novice, but I'm definitely not an expert. I've set up some maps & modified some. In fact I even used danh's tutorial, which irritated me a little because it just went into the under the hoodstuff, but none the less it was helpful. So it's pretty much the same as Saipan, a territory map and no I didn't change anything but the roles, I'll check again though.
Later today I'll provide a complete list of what I changed and where stuff is in the code.
Just thought of something is there a limit to how many weapons a Role can have, seems like only three primaries....
 
Last edited:
Upvote 0
Okay so it's definitely not caused by a limit, I tested to see if it was, by removing a gun here and there, it still showed up as an M1 Carbine, both when playing as an SL & TL (Current classes I'm using for the weapon, can be changed). I tested with the TL not having an M1 in it's code, and has the SL Class have both the M1 & M2. Only the M1 appeared, along with the other guns. I removed the Trench Gun, it didn't appear. That's only good thing that happened.... :(

I even spawned to make sure, it was an M1, both times.

What's even worse is that even though I never mentioned an M1 Carbine in the code for the RSRoleInfoAlliedCommander, IT STILL SHOWED UP AS A M1!
:mad:

Here's the code (Part of it):

RoleType=RORIT_Commander
ClassTier=4
ClassIndex=`RSRI_RSRoleInfoAlliedCommander

// Primary : DEFAULTS
PrimaryWeapons(0)=class'RSGame.RSWeap_M1928_SMG'
// Primary : FRONTLINE ENEMY - Not really enemy weapons, but we want to keep these lower on the list
PrimaryWeapons(2)=class'MutM2Carbine.RSWeap_M2_Carbine'
NumPrimaryFrontlineEnemyWeapons=1
bHasEarlyUnlockPrimaryWeapons=true
// Primary : VETERAN ENEMY
PrimaryWeapons(3)=class'RSGame.RSWeap_Type100_SMG'
NumPrimaryVeteranEnemyWeapons=1
Don't know why it shows a space with Carbine (forums are glitchy I guess)
Any Devs have any helpful tips/ideas for me with this? (Or is just wishful thinking? :D)
 
Last edited:
Upvote 0
Okay so it's definitely not caused by a limit, I tested to see if it was, by removing a gun here and there, it still showed up as an M1 Carbine, both when playing as an SL & TL (Current classes I'm using for the weapon, can be changed). I tested with the TL not having an M1 in it's code, and has the SL Class have both the M1 & M2. Only the M1 appeared, along with the other guns. I removed the Trench Gun, it didn't appear. That's only good thing that happened.... :(

I even spawned to make sure, it was an M1, both times.

What's even worse is that even though I never mentioned an M1 Carbine in the code for the RSRoleInfoAlliedCommander, IT STILL SHOWED UP AS A M1!
:mad:

Here's the code (Part of it):


Don't know why it shows a space with Carbine (forums are glitchy I guess)
Any Devs have any helpful tips/ideas for me with this? (Or is just wishful thinking? :D)

Does your class extend RSWeap_M1Carbine? It will inherit the UI friendly name of that weapon. At you sure it doesn't just look like an M1 in the menu?
 
Last edited:
Upvote 0