Pawn replacement!!!

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

Ordinary soldier

FNG / Fresh Meat
Sep 28, 2011
126
24
0
Hi guys I need to replace the pawn with my custom pawn.
I am running custom game type and I need to change the players pawn to my custom pawn.

So what I need is a mutator.

1) that will replace the default pawn class in the default properties of My Custom Game Type.

2)that will replace a default property in a class

3) that will add a default property in a class to tell the game to use different SPECIES.

I will appreciate any help.

Actually I don't know if I need mutator, may be all of this above can be executed in the gametype itself?
 

FluX

Grizzled Veteran
Oct 26, 2010
5,394
234
63
www.fluxiserver.co.uk
Pawn is easy to do with a default changed to another.
Same as pawn code to be used.
Can't change species without making a new character entirely (different classes).
 

TheMutant

FNG / Fresh Meat
May 31, 2012
562
4
0
Germany
Actually, changing the Pawn has been made an unnecessary hard process.
Sadly, you cannot just change the gametype's DefaultPlayerClassName, because in KFPlayerController the pawnclass is forced to be KFHumanPawn.
Do never overwrite default variables as they stay like this until you close KF (correct me here if I am wrong).

The easiest fix I can think of is overriding GameInfo.Login().
This should hopefully work:
Code:
event PlayerController Login
(
    string Portal,
    string Options,
    out string Error
)
{
     local PlayerController PC;

     PC = Super.Login(Portal, Options, Error);

     if ( PC != None )
          PC.PawnClass = class'MyPawnClass'; //Force to use your pawn class instead.

     return PC;
}
I think you can replace the species on the fly as well, but I am not into that right now.
xPawn.Species seems to be the thing you consider to replace. As you are using your own pawn class just replace the corresponding functions that load the species type.
 
Last edited:

Ordinary soldier

FNG / Fresh Meat
Sep 28, 2011
126
24
0
Hello heres the quotes.
Ordinary soldier said:
OK then I am pasting 2 quotes for you: first is from the Original gametype the original and second is the one I am trying to to
You can choose to tell me if what I am trying to do looks silly stupid or whatever lol :D


Code:
//-----------------------------------------------------------------------------
// SetCharacter - Sets the appropriate model for the player
//-----------------------------------------------------------------------------
function SetCharacter(Controller aPlayer)
{
 local RORoleInfo RI;
 if( ROPlayerReplicationInfo(aPlayer.PlayerReplicationInfo).RoleInfo != none )
  RI = ROPlayerReplicationInfo(aPlayer.PlayerReplicationInfo).RoleInfo;
 if (ROPlayer(aPlayer) != None && RI != None)
  ROPlayer(aPlayer).ChangeCharacter(RI.static.GetModel(),RI.static.GetPawnClass());
 else if (ROBot(aPlayer) != None && RI != None)
  ROBot(aPlayer).ChangeCharacter(RI.static.GetModel(),RI.static.GetPawnClass());
}
Code:
////////////////////////////
 
function SetCharacter(Controller aPlayer)
{
    local RORoleInfo RI;
    local RORoleInfo RI;
    local array<string> Args;
    local class<actor> aClass;
    if( ROPlayerReplicationInfo(aPlayer.PlayerReplicationInfo).RoleInfo != none )
        RI = ROPlayerReplicationInfo(aPlayer.PlayerReplicationInfo).RoleInfo;
 
    if (ROPlayer(aPlayer) != None && RI != None)
        ROPlayer(aPlayer).ChangeCharacter(RI.static.GetModel(),"MyCustomPawnClassName"());
    else if (ROBot(aPlayer) != None && RI != None)
        ROBot(aPlayer).ChangeCharacter(RI.static.GetModel(),RI.static.GetPawnClass());
}
 

TheMutant

FNG / Fresh Meat
May 31, 2012
562
4
0
Germany
Well this is the KF coding section, actually.

If I guess this correctly, RI.static.GetPawnClass() either returns class'ROGEPawn' or class'ROSUPawn'. So you check them in a condition and set the respective subclass you have created for.