| Home Page | Recent Changes

RegularEngine/RegularPlayer

RegularPlayer is the PlayerController class. Chiefly it starts the VersatileKeyBind interaction, talks to the PRI and Pawn to properly setup the player class and holds specific functions for spawning, opening menus, etc.

UT2004 :: xPlayer >> RegularPlayer
class RegularPlayer extends xPlayer;

replication
{
 // Things client should send to server
 reliable if ( Role < ROLE_Authority )
    RestartPawn,SetChosenMap,SetPlayerTeam;
}


event InitInputSystem()
{
    local int i;
    super.InitInputSystem();
    for (i = 0; i < Player.LocalInteractions.Length; i++)
    {
        if (  RegularVersatileKeyBind(Player.LocalInteractions[i]) != None )
        { Player.interactionMaster.RemoveInteraction(Player.LocalInteractions[i]);}
    }

    Player.interactionMaster.AddInteraction("RegularEngine.RegularVersatileKeyBind", Player);
}


exec function keybinds() {
 ClientOpenMenu("RegularEngine.RegularVKBTrader");
}

exec function OpenClassTrader() {  // open menu to change player classes
   Log("Opening class Trader");
   ClientOpenMenu("RegularEngine.ClassTrader");
}


function OpenMapTrader() {         // open menu for map voting
   Log("Opening Map Trader");
   ClientOpenMenu("RegularEngine.MapTrader");
}


function OpenMapViewer() {         // open menu to see current maps
   Log("Opening Map Trader");
   ClientOpenMenu("RegularEngine.MapViewer");
}

function Possess( Pawn aPawn )     // Possess attaches our PRI's info about the player class
{                                  // to the pawn
    local RegularPawn rp;

    rp = RegularPawn(aPawn);

    if (rp != none) {rp.PlayerClassName = RegularPRI(PlayerReplicationInfo).PlayerClassName;}

    Super.Possess( aPawn );
}

simulated function RestartPawn(string NewClass) {    //  restart with a new player calss
 RegularPRI(PlayerReplicationInfo).PlayerClassName = NewClass;
 RegularPRI(PlayerReplicationInfo).SaveConfig();
 Suicide();
 AskForPawn();
}

simulated function SetChosenMap(string ChosenMap) {  // place this player's vote into the PRI
    RegularPRI(PlayerReplicationInfo).ChosenMap = ChosenMap;
}


simulated function SetPlayerTeam(int i) {  // swap teams for player, allow new classes


 if(GameReplicationInfo.Teams[i] != none){

 if(PlayerReplicationInfo.Team != none){PlayerReplicationInfo.Team.RemoveFromTeam(self);}

 if(PlayerReplicationInfo.Team != GameReplicationInfo.Teams[i]) {
    GameReplicationInfo.Teams[i].AddToTeam(self);
    PlayerReplicationInfo.Team = GameReplicationInfo.Teams[i];
    }
    log("SBPlayer Set Player Team to "$PlayerReplicationInfo.Team.TeamName );
    } else{ log("ERROR NO PLAYER TEAM SET");}

}


auto state PlayerWaiting       // bored while dead or spectating?  pick a new class
{
  exec function AltFire(optional float F)
    {
        OpenClassTrader();
    }

}


state Dead
{
  exec function AltFire(optional float F)
    {
        OpenClassTrader();
    }

}

defaultproperties {
 PawnClass=class'RegularPawn'
 PlayerReplicationInfoClass=Class'RegularPRI'
}

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In