PDA

View Full Version : How to change Pawn.uc or PlayerController.uc



AlfonsÅberg
11-25-2007, 10:44 AM
How do I make changes in let's say Pawn.uc?

Any ideas?

I heard something about subclassing, how do I do that?

elgourmet
11-25-2007, 11:02 AM
yeah, got the same question :) would be awesome if someone could explain it with this example :D
http://forums.epicgames.com/showthread.php?t=587521

AlfonsÅberg
11-25-2007, 11:19 AM
I found this:
http://forums.beyondunreal.com/showthread.php?t=176628&highlight=replace+xpawn

But it doesn't work becuase the SetPawnClass doesn't exist.

I know how to subclass but how do I create a mutator that replace the old with the new?

Funkenstein
11-25-2007, 12:40 PM
To subclass you just make a child of the parent class. If you are using wotgreal i think there is an option when you right click on the file you can choose create child class or create sub class.

In the old engine you would have to declare the controller class and the pawn class in one of the .ini files. Then the game would use your custom pawn and controller class. Im not sure how this works in the new game but I would think its somewhat similar.

When you subclass pawn then you get your new class that is pretty much blank. Because unreal script is OOP (object oriented programming) it inherits all its funcionality from its parent class.
You can change some of the default properties in your own class ( from copying and pasting the original default properties on the pawn class and then change them to what you want. )

Of course doing this is more how you would do a TC i guess and its not mutator friendly. Everytime you wanted to play the original game you would have to change the .ini file to the original.

I guess the best thing to do would be to search in the code for something like the SetPawnClass function. Hopefully they just changed the name of it rather than getting rid of that option.

Not sure if this helps but good luck.

AlfonsÅberg
11-25-2007, 03:13 PM
I've indexed all my .uc files in vista so i can search inside the files but there is no SetPawnClass function anymore or something with a similar name.

Thanks for the tips about Wotgreal, I will look in to that.

This is how my subclassed pawn class looks like;

class ThirdPPawn extends Pawn;


/**
* returns default camera mode when viewing this pawn.
* Mainly called when controller possesses this pawn.
*
* @param PlayerController requesting the default camera view
* @return default camera view player should use when controlling this pawn.
*/
simulated function name GetDefaultCameraMode( PlayerController RequestedBy )
{
if ( RequestedBy != None && RequestedBy.PlayerCamera != None && RequestedBy.PlayerCamera.CameraStyle == 'Fixed' )
return 'Fixed';

return 'ThirdPerson';
}

I changed the text that's in red.

Dark[NSF]
11-26-2007, 01:32 AM
extend from Pawn

I made my own Pawn class that uses alot of the UTPawn class




/**
* ROMPawn.uc
*
* author: Dark[NSF]
*/
class ROMPawn extends UTPawn



then you can override functions in UTPawn by putting it in your class.

woooo
11-26-2007, 05:29 AM
function ModifyPlayer(Pawn P)
{
if ( UTPawn(P) != None )
{
// Increase the number of times a player can jump in mid air
UTPawn(P).MaxMultiJump = 3;
UTPawn(P).MultiJumpRemaining = 3;

// Also increase a bit the amount they jump each time
UTPawn(P).MultiJumpBoost = 50;

}
Super.ModifyPlayer(P);
}

that is from the quad jump mutator, it refferes to the UTPawn.uc and changes a few ****.

{SAP}THEEDGE
11-26-2007, 09:17 AM
Can someone post how to get Wotgreal to work with UT3? I have the latest patch, but don't know how to set it up to look at the UT3 package tree instead of the UT2004 one. I also need to know how to tell it how to use the compiler...

Dark[NSF]
11-26-2007, 09:56 AM
Can someone post how to get Wotgreal to work with UT3? I have the latest patch, but don't know how to set it up to look at the UT3 package tree instead of the UT2004 one. I also need to know how to tell it how to use the compiler...

from my understanding it will "operate" with the patch, but it still doesn't understand the new file structure.

i would shoot an email at the developer and see if he is planning on releasing a new version. i temporarily switched to textpad + ut3.exe -make.

AlfonsÅberg
11-26-2007, 12:53 PM
I still haven't got an answer to my question!

How do I tell UT3 to use my new subclassed pawn class?

N0VA
11-27-2007, 11:18 AM
just for extra info, you can do the following if its a gamemode
in its defaults:

DefaultPawnClass=Class'Package.New_Pawn'

[PSI]PsySniper
11-27-2007, 11:37 AM
On your mutator class:



function InitMutator(string Options, out string ErrorMessage)
{

WorldInfo.Game.AddGameRules(GameRulesClass);

if ( UTGame(WorldInfo.Game) != None )
{
UTGame(WorldInfo.Game).defaultpawnclass=class'Pack age_Name.New_Pawn_Class';

}
Super.InitMutator(Options, ErrorMessage);
}

AlfonsÅberg
11-28-2007, 04:05 PM
Thanks PsiSniper, that seemed to do the trick.

I ended up changing the UTPlayerControllerClass instead. And I didn't use AddGameRules..., couldn't see the point of doing that.

Pfhoenix
11-28-2007, 04:27 PM
It is outside the bounds of a mutator to be changing Pawn or PlayerController or AIController classes used by the GameInfo. Mutators need to be written to be friendly with other mutators, which means by default not replacing core classes. There will naturally be mutators that affect each other, like weapon replacement mutators, but that's what mutator groups are for.

If you find yourself genuinely needing to replace Pawn or PlayerController, reconsider what you're doing and either go for a custom GameInfo (custom gametype) or change how you're approaching your problem.