• 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

No it definitely was an M1, I even fired it...

Anyways, yes, I just realized that it does, I'll go test it again.
And it did not work I changed the references in RSWeapAttach_M2_Carbine & RSWeap_M2_Carbine to ROWeaponAttachment & RSProjectileWeapon respectively.

Did you copy all of the code from RSWeap_M1_Carbine into your new class and change what was necessary?

Did you do the same with RSWeapAttach_M1_Carbine?

Does your content class extend RSWeap_M2_Carbine?

Does the WeaponContentClass array point to RSWeap_M2_Carbine_Content in all its entries? (or level classes)

Here's what my rifleman class looks like. The game's system is a bit unintuitive. Try copying this block and substituting your weapons for mine; this should insure that there's only one weapon the role can have for testing purposes.

Code:
class SMRoleInfoAxisRifleman extends RORoleInfoAxisRifleman;

defaultproperties
{
	NumPrimaryVeteranEnemyWeapons=0
	NumPrimaryVeteranWeapons=1
	NumPrimaryHeroEnemyWeapons=0
	NumPrimaryUnlimitedWeapons=0
	
	PrimaryWeapons.Empty
	
	bHasEarlyUnlockPrimaryWeapons=true

	PrimaryWeapons(0)=class'SoundMutator.ROWeap_Kar98_Rifle_Wartorn'
	PrimaryWeapons(1)=class'SoundMutator.ROWeap_Kar98_Rifle_Hoodless_Wartorn'
	
	SecondaryWeapons.Empty
	
	bAllowPistolsInRealism=true
	bHasEarlyUnlockSecondaryWeapons=true
	NumSecondaryHeroEnemyWeapons=0
        NumSecondarySoldierWeapons=0
	
	SecondaryWeapons(0)=class'SoundMutator.ROWeap_M1939_Grenade_SM_Rifleman'
	SecondaryWeapons(1)=class'SoundMutator.ROWeap_M39_Eihandgranate_Rifleman'
	
	OtherItems.Empty
	
	OpposingTeamEquivalentClass=class'SoundMutator.SMRoleInfoAlliesRifleman'
}
 
Upvote 0
Did you copy all of the code from RSWeap_M1_Carbine into your new class and change what was necessary?

Did you do the same with RSWeapAttach_M1_Carbine?

Does your content class extend RSWeap_M2_Carbine?

Does the WeaponContentClass array point to RSWeap_M2_Carbine_Content in all its entries? (or level classes)

Here's what my rifleman class looks like. The game's system is a bit unintuitive. Try copying this block and substituting your weapons for mine; this should insure that there's only one weapon the role can have for testing purposes.

Code:
class SMRoleInfoAxisRifleman extends RORoleInfoAxisRifleman;

defaultproperties
{
	NumPrimaryVeteranEnemyWeapons=0
	NumPrimaryVeteranWeapons=1
	NumPrimaryHeroEnemyWeapons=0
	NumPrimaryUnlimitedWeapons=0
	
	PrimaryWeapons.Empty
	
	bHasEarlyUnlockPrimaryWeapons=true

	PrimaryWeapons(0)=class'SoundMutator.ROWeap_Kar98_Rifle_Wartorn'
	PrimaryWeapons(1)=class'SoundMutator.ROWeap_Kar98_Rifle_Hoodless_Wartorn'
	
	SecondaryWeapons.Empty
	
	bAllowPistolsInRealism=true
	bHasEarlyUnlockSecondaryWeapons=true
	NumSecondaryHeroEnemyWeapons=0
        NumSecondarySoldierWeapons=0
	
	SecondaryWeapons(0)=class'SoundMutator.ROWeap_M1939_Grenade_SM_Rifleman'
	SecondaryWeapons(1)=class'SoundMutator.ROWeap_M39_Eihandgranate_Rifleman'
	
	OtherItems.Empty
	
	OpposingTeamEquivalentClass=class'SoundMutator.SMRoleInfoAlliesRifleman'
}

do I need your Sound Mutator for this?
 
Upvote 0
do I need your Sound Mutator for this?


No, I'm suggesting you replace those references with yours. Then only one weapon can be selectable by that role, and you will know if the role is being properly swapped or if the weapon isn't being loaded etc.


Edit: Make it look like this:


Code:
defaultproperties
{
	NumPrimaryVeteranEnemyWeapons=0
	NumPrimaryVeteranWeapons=1
	NumPrimaryHeroEnemyWeapons=0
	NumPrimaryUnlimitedWeapons=0
	
	PrimaryWeapons.Empty
	
	bHasEarlyUnlockPrimaryWeapons=true

	PrimaryWeapons(0)=class'YourPackage.YourClass'
 
	SecondaryWeapons.Empty 
	OtherItems.Empty
 
}
 
Last edited:
Upvote 0
I tried it, and it didn't work, I think it might have to do with extending the roles to the original classes ie "RSRoleInfoCommander_Mk2 extends to RSRoleInfoCommander"
Mainly because I tried this, and it gave me all the weapons I'd normally have without the mutator, the M1 was an M1, and it didn't delete any of the items or weapons :(
 
Upvote 0
I tried it, and it didn't work, I think it might have to do with extending the roles to the original classes ie "RSRoleInfoCommander_Mk2 extends to RSRoleInfoCommander"
Mainly because I tried this, and it gave me all the weapons I'd normally have without the mutator, the M1 was an M1, and it didn't delete any of the items or weapons :(

Can you post the role class here? It should have gotten rid of everything even if it does extend the old role. It sounds like the role isn't being placed.

Have you brewed your map copy or are you using -useunpublished?
 
Upvote 0
Can you post the role class here? It should have gotten rid of everything even if it does extend the old role. It sounds like the role isn't being placed.

Have you brewed your map copy or are you using -useunpublished?
I've re-brewed both of them, anyways here's the code for the US SL:
class RSRoleInfoAlliedCommander_Mk2 extends RSRoleInfoAlliedCommander;


class RSRoleInfoAlliedSquadLeader_Mk2 extends RSRoleInfoAlliedSquadLeader;

defaultproperties
{
RoleType=RORIT_SquadLeader
ClassTier=3
ClassIndex=`RSRI_RSRoleInfoAlliedSquadLeader

NumPrimaryVeteranEnemyWeapons=0
NumPrimaryVeteranWeapons=1
NumPrimaryHeroEnemyWeapons=0
NumPrimaryUnlimitedWeapons=0

PrimaryWeapons.Empty

bHasEarlyUnlockPrimaryWeapons=true

PrimaryWeapons(0)=class'MutM2Carbine.RSWeap_M2_Carbine'

SecondaryWeapons.Empty
OtherItems.Empty

OpposingTeamEquivalentClass=class'MutM2Carbine.RSRoleInfoAxisSquadLeader_Mk2'
ClassicModeOverrideClass=class'MutM2Carbine.RSRoleInfoCLAlliedSquadLeader_Mk2'
ClassicEarlyWarOverrideClass=class'MutM2Carbine.RSRoleInfoCLEWAlliedSquadLeader_Mk2'
EarlyWarOverrideClass=class'MutM2Carbine.RSRoleInfoEWAlliedSquadLeader_Mk2'

bIsSquadLeader=true
}

And it's not a spelling mistake with Carbine, it's the forums glitching again.....
 
Last edited:
Upvote 0
Why are there two class definitions in your code? Or is that implying one they're identical?

I don't think that your map changes are taking.

Brewed, not just built? Have you tried copying the map from unpublished and putting it in published?

Oops, that's actually my mistake, while writing the post I accident;y copied the Commander's info, rather than the SL, I thought I selected it all and pasted over it and I guess I didn't...
ClassIndex=`RSRI_RSRoleInfoAlliedSquadLeader is valid As far as I know, I actually originally tried changing it, but the build process failed, so it can't be a typo, further more it's in every role class. I don't honestly know why it's there. I think the the ClassIndex reference itself may be the problem (not positive, but a possibility) but I can't seem to figure out where that reference comes from and edit it. It would explain why I would only be able to get weapons from the original class, and not the inserted M2, I guess. I'll do a run down of the game's source, later today, I'll see if it is or is not.
 
Last edited:
Upvote 0
Oops, that's actually my mistake, while writing the post I accident;y copied the Commander's info, rather than the SL, I thought I selected it all and pasted over it and I guess I didn't...
ClassIndex=`RSRI_RSRoleInfoAlliedSquadLeader is valid As far as I know, I actually originally tried changing it, but the build process failed, so it can't be a typo, further more it's in every role class. I don't honestly know why it's there. I think the the ClassIndex reference itself may be the problem (not positive, but a possibility) but I can't seem to figure out where that reference comes from and edit it. It would explain why I would only be able to get weapons from the original class, and not the inserted M2, I guess. I'll do a run down of the game's source, later today, I'll see if it is or is not.
What exactly do I need to edit in the RSMapInfo & RSRoleInfo?
 
Upvote 0
Hmm, so I'm not sure what's wrong, dibbler do you have any Ideas?

You gotta find the Roles in the level's map info.

I think it's View -> World Properties -> Map Info -> RSMapInfo -> TEAllies in the editor.

If you know what I mean and you've already done that, the problem may be that your map isn't the one being loaded for some reason.
 
Upvote 0
You gotta find the Roles in the level's map info.

I think it's View -> World Properties -> Map Info -> RSMapInfo -> TEAllies in the editor.

If you know what I mean and you've already done that, the problem may be that your map isn't the one being loaded for some reason.

hmmm, I brewed it and built it, and added the roles multiple times, in fact I've selected it in the game, however let me what happens if I modify something or play it in the editor
 
Upvote 0
You need to create a localization file. (.INT)

MutM2Carbine.int

Code:
[RSRoleInfoAlliedCommander_Mk2]
MyName="Commander"
ClassShortName="Cmdr"
Description="blahblahblah"


[RSWeap_M2_Carbine]
DisplayName="M2 Carbine"
CapitalizedDisplayName="M2 Carbine"
Description="blahblahblah"

The description is not used IIRC. Place this in C:\Users\<name>\Documents\My Games\RedOrchestra2\ROGame\Localization\INT

Different languages have different file extensions and go in different directories within the Localization directory. ".int" is the catch-all
 
Last edited:
Upvote 0