Did you know? All of these messages will likely be replaced before release.

Need help for a playerpawn replacement script

For questions and discussion about UnrealEd, UnrealScript, and other aspects of Unreal Engine design.

Moderators: ividyon, Semfry, zYnthetic

Skaarj Assassin Skaarj Assassin
Posts: 115
Joined: 13 Jan 2013, 18:56

Subject: Need help for a playerpawn replacement script

Post Posted: 20 May 2016, 02:22

I have a strafe bunny hop mod that has been on the shelf for a while, and I need help making it convenient for players to join as my custom playerpawn without having to use any lengthy commands. I was hoping for maybe a script that would replace a joining player's playerpawn class with the custom one. Maybe by a mutator for instance, or even if I made a custom coop game mode. Anything is fine, and I am running my server on the vanilla coop gametype. I remember a long time ago I looked into doing this, but I never got very far.

User avatar Bleeder91<NL>
Skaarj Assassin Skaarj Assassin
Posts: 146
Joined: 24 Jun 2011, 18:45

Subject: Re: Need help for a playerpawn replacement script

Post Posted: 20 May 2016, 09:42

If you are using 227, then GameRules should do the job. Adding to ServerActors should work I think:

Code: Select all

// PlayerReplacement.
class PlayerReplacement expands GameRules;

function PostBeginPlay()
   if(Level.Game.GameRules == None) Level.Game.GameRules = Self;
   else Level.Game.GameRules.AddRules(Self);

// Modify a playerpawn class to spawn with
function ModifyPlayerSpawnClass( string Options, out Class<PlayerPawn> AClass )
      Case class'MaleThree':   AClass=class'new_MaleThree'; Break;
      Case class'MaleTwo':   AClass=class'new_MaleTwo'; Break;
      Case class'MaleOne':   AClass=class'new_MaleOne'; Break;
      Case class'FemaleTwo':   AClass=class'new_FemaleTwo'; Break;
      Case class'FemaleOne':   AClass=class'new_FemaleOne'; Break;
      Default:             AClass=class'new_MaleThree'; Break;


User avatar zYnthetic
Trustee Member Trustee Member
Posts: 506
Joined: 12 Nov 2007, 00:10

Subject: Re: Need help for a playerpawn replacement script

Post Posted: 02 Jul 2016, 03:22

Late but the first mod I wrote was a security patch for ugold. The menu selectable rtnp characters introduced a huge exploit in mutiplayer. It checked the player login class and if it wasn't a valid original unreal char, changed it. I don't have the script any more but it was integrated into jcoop and probably derivatives of. It's not as neat as Bleeder's but it should work on all versions.

Who is online

Users browsing this forum: No registered users and 2 guests