• 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 Not working

Moffia

Active member
Mar 12, 2006
36
0
Im kinda new to UnrealScript, and trying to make a pistol only mod.
Somehow it doesnt work.

Code:
//=======================================================================
// Pistol Only mod, DUH!
// Author: Moffia
// There are copyrights and sit on here :)
//=======================================================================

class PistolOnly extends Mutator;

function ModifyPlayer(Pawn Other)
{
    Other.GiveWeapon("ROInventory.P08LugerWeapon");
    Other.GiveWeapon("ROInventory.P38Weapon");
    Other.GiveWeapon("ROInventory.TT33Weapon");
}
IF im right it actually should work, the mutator is in the list etc, only i dont have these weapons! If im correct that has to be the new inventory...
Compiler also gives no errors...
 
Moffia said:
Im kinda new to UnrealScript, and trying to make a pistol only mod.
Somehow it doesnt work.
...
IF im right it actually should work, the mutator is in the list etc, only i dont have these weapons! If im correct that has to be the new inventory...
Compiler also gives no errors...

The problem might be in how you are giving out weapons..

What you may have to do (and I'm guessing here.. so bear with me.. and I might be wholey off-base)..

Make the mutator modify the weapons loadout for the roles.

/me digs around in his UnCodeX dump from the sdk....

You can probably do this at a few points..

Mutate the RO Role Info's to force only certain weapons to be available

After a player spawns, call ROEngine.ROPlayer.changeWeapons to force all players to only have the weapons loadout you want.

and if you want to do this on a map-for-map basis, you could just open up the map, set the loadouts how you want, and save it under a different name :]



I think there was a weapons mutator for the mod.. might want to try and track that down and see how they did it.
 
Upvote 0
i think i have a better idea.
make my own 2 roles, for axis and allies and disable the other ones :O

EDIT:

all done, and i wanted to compile, but i get this strange error:

Error: C:\Program Files\Steam\SteamApps\common\red orchestra\PistolOnly\Classes\ROGERole.uc(11) : Error, PistolOnly.ROGERole's superclass must be ROEngine.RORoleInfo, not PistolOnly.RORoleInfo
Log: Compile aborted due to errors.
Log: Failure - 1 error(s), 0 warning(s)
 
Last edited:
Upvote 0
well, when i delete the RORoleInfo.uc in the pistolonly folder i get even more errors (4)

Log: Analyzing...
Log: FactoryCreateText: Class with ClassFactoryUC (0 1 ..\PistolOnly\Classes\ROGEPistolGuy.uc)
Log: Class: ROGEPistolGuy extends ROGE_Standard_Heer
Log: Imported: Class PistolOnly.ROGEPistolGuy
Log: FactoryCreateText: Class with ClassFactoryUC (0 1 ..\PistolOnly\Classes\ROGERole.uc)
Log: Class: ROGERole extends RORoleInfo
Log: Imported: Class PistolOnly.ROGERole
Log: FactoryCreateText: Class with ClassFactoryUC (0 1 ..\PistolOnly\Classes\ROGE_Heer_Units.uc)
Log: Class: ROGE_Heer_Units extends ROGERole
Log: Imported: Class PistolOnly.ROGE_Heer_Units
Log: FactoryCreateText: Class with ClassFactoryUC (0 1 ..\PistolOnly\Classes\ROGE_Standard_Heer.uc)
Log: Class: ROGE_Standard_Heer extends ROGE_Heer_Units
Log: Imported: Class PistolOnly.ROGE_Standard_Heer
Log: FactoryCreateText: Class with ClassFactoryUC (0 1 ..\PistolOnly\Classes\ROSUPistolGuy.uc)
Log: Class: ROSUPistolGuy extends ROSU_Standard_RKKF
Log: Imported: Class PistolOnly.ROSUPistolGuy
Log: FactoryCreateText: Class with ClassFactoryUC (0 1 ..\PistolOnly\Classes\ROSURole.uc)
Log: Class: ROSURole extends ROEngine.RORoleInfo
Log: Imported: Class PistolOnly.ROSURole
Log: FactoryCreateText: Class with ClassFactoryUC (0 1 ..\PistolOnly\Classes\ROSU_RKKF_Units.uc)
Log: Class: ROSU_RKKF_Units extends ROSURole
Log: Imported: Class PistolOnly.ROSU_RKKF_Units
Log: FactoryCreateText: Class with ClassFactoryUC (0 1 ..\PistolOnly\Classes\ROSU_Standard_RKKF.uc)
Log: Class: ROSU_Standard_RKKF extends ROSU_RKKF_Units
Log: Imported: Class PistolOnly.ROSU_Standard_RKKF
Log: Parsing ROGERole
Log: Parsing ROGE_Heer_Units
Log: Parsing ROGE_Standard_Heer
Log: Parsing ROGEPistolGuy
Log: Parsing ROSURole
Log: Parsing ROSU_RKKF_Units
Log: Parsing ROSU_Standard_RKKF
Log: Parsing ROSUPistolGuy
Log: Compiling ROGERole
Log: Compiling ROGE_Heer_Units
Log: Compiling ROGE_Standard_Heer
Log: Compiling ROGEPistolGuy
Log: Compiling ROSURole
Log: Compiling ROSU_RKKF_Units
Log: Compiling ROSU_Standard_RKKF
Log: Compiling ROSUPistolGuy
Log: Importing Defaults for ROGERole
Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.SeveredArmGerTunic': Can't resolve package name
Error: ClassProperty ROEngine.RORoleInfo.DetachedArmClass: unresolved reference to 'class'SeveredArmGerTunic''
Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.SeveredLegGerTunic': Can't resolve package name
Error: ClassProperty ROEngine.RORoleInfo.DetachedLegClass: unresolved reference to 'class'SeveredLegGerTunic''
Log: Importing Defaults for ROGE_Heer_Units
Log: Importing Defaults for ROGE_Standard_Heer
Log: Importing Defaults for ROGEPistolGuy
Log: Importing Defaults for ROSURole
Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.SeveredArmSovTunic': Can't resolve package name
Error: ClassProperty ROEngine.RORoleInfo.DetachedArmClass: unresolved reference to 'class'SeveredArmSovTunic''
Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.SeveredLegSovTunic': Can't resolve package name
Error: ClassProperty ROEngine.RORoleInfo.DetachedLegClass: unresolved reference to 'class'SeveredLegSovTunic''
Log: Importing Defaults for ROSU_RKKF_Units
Log: Importing Defaults for ROSU_Standard_RKKF
Log: Importing Defaults for ROSUPistolGuy
Log: Compile aborted due to errors.
Log: Failure - 4 error(s), 0 warning(s)
 
Upvote 0
Moffia said:
well, when i delete the RORoleInfo.uc in the pistolonly folder i get even more errors (4)

Err...

No.. the error is simple.. the class you wrote has to Inheirt (extend) a different class..

Deleting a local version of your source RO classes won't help.. and as you saw, it's just making it worse.


In a nutshell, I'd guess you are trying to extend the wrong class... at least according to the compiler.
 
Upvote 0
FYI, I don't think you can add or remove the existing RORoleInfo objects in
existing maps because RORoleInfo has bStatic=True.

If someone knows a way around this I would like to see it.

It would be nice if the RO Dev team would change how the role system works
so that mutators can modify the available roles.
Maybe use an array in the ROLevelInfo.
 
Upvote 0
Well, posting code would help find the error, however I think you're going about it wrong anyway.

This is what you need to do to create a pistol only mod.

1. iterate though each of the RORoleInfo objects in the PostBeginPlay() function of you Pistolonly class.
example:

foreach AllActors( class'ROEngine.RORoleInfo', A )

2. In each RORoleInfo, clear out the PrimaryWeapons SecondaryWeapons arrays.

Example:
for( i=0; i < 3; i++)
{
A.SecondaryWeapons.Item = none;
A.SecondaryWeapons.Amount = 0;
A.SecondaryWeapons.AssociatedAttachment = none;


3. Add the Pistol class to the PrimaryWeapons of each

A.PrimaryWeapons[0].Item = class'ROInventory.P38Weapon';
A.PrimaryWeapons[0].Amount = 1;
 
Upvote 0