Need help for a playerpawn replacement script
Posted: 20 May 2016, 02:22
by xRedStar
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.
Re: Need help for a playerpawn replacement script
Posted: 20 May 2016, 09:42
by Bleeder91<NL>
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 )
{
Switch(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;
}
defaultproperties
{
bNotifyLogin=True
}
Re: Need help for a playerpawn replacement script
Posted: 02 Jul 2016, 03:22
by zYnthetic
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.