Results 1 to 8 of 8
  1. #1
    MSgt. Shooter Person
    Join Date
    May 2011
    Posts
    206

    Default how to implement a character into UDK (code part only)

    Hi, I have been looking through tut's online all week, and cant find one that will work. I have a tiny ball character with 3 bones, and one animation. I imported it into UDK and set up his material,anim set, etc... Now I want that "ball" character to be controllable.

    So far i have

    +EditPackages=MyMod
    in the config/default engine.

    then in the below directory

    C:\UDK\UDK-2011-12\Development\Src\MyMod\Classes

    I have two files one
    for player controller and one for game type.

    "CustomGameType"

    "playercontroller"




    some example code would be great! Extending it from UT would work for me.


    If you could help me with this, you would be a huge help
    thank you for your time
    Last edited by bobtheturtle; 04-18-2012 at 06:19 PM.

  2. #2
    MSgt. Shooter Person
    Join Date
    May 2011
    Posts
    206

    Default

    I will bump this once.

  3. #3
    MSgt. Shooter Person
    Join Date
    May 2010
    Posts
    53

    Default

    http://forums.epicgames.com/threads/...0#post28652160
    Also, check out the Whizzle source code as it is similar. Also, if you search through the programming forums this has been done a lot so you should be able to find something to at least get you going in the right direction.

  4. #4

  5. #5
    MSgt. Shooter Person
    Join Date
    May 2011
    Posts
    206

    Default

    thank you both so much! I will check out Whizzle, and the forum VendorX recommended is very helpful too.

  6. #6
    Prisoner 849
    Join Date
    Nov 2010
    Location
    Loch Ness Scotland
    Posts
    955

    Cool

    Quote Originally Posted by bobtheturtle View Post
    Hi, I have been looking through tut's online all week, and cant find one that will work. I have a tiny ball character with 3 bones, and one animation. I imported it into UDK and set up his material,anim set, etc... Now I want that "ball" character to be controllable.

    So far i have

    +EditPackages=MyMod
    in the config/default engine.

    then in the below directory

    C:\UDK\UDK-2011-12\Development\Src\MyMod\Classes

    I have two files one
    for player controller and one for game type.

    "CustomGameType"

    "playercontroller"




    some example code would be great! Extending it from UT would work for me.


    If you could help me with this, you would be a huge help
    thank you for your time
    Code:
    class LexGame extends UTGame
        config(Game);
        
    
    
    
    var LexPlayerController currentPlayer;
    function RestartPlayer(Controller aPlayer)
    {
    super.RestartPlayer(aPlayer);
    `Log("Player restarted");
    currentPlayer = LexPlayerController(aPlayer);
    currentPlayer.resetMesh();
    currentPlayer.rSetBehindView(true);
    currentPlayer.rSetCameraMode('ThirdPerson');
    }
    simulated function PostBeginPlay() {
    local UTGame Game;
    Super.PostBeginPlay();
    Game = UTGame(WorldInfo.Game);
    if (Game != None)
    {
    Game.PlayerControllerClass=Class'LexLuthor.LexPlayerController';
    }
    }
    
    
    
    
    defaultproperties
    {
    
            HUDType=class'UTGame.UTHUD'
            PlayerControllerClass=class'lexLuthor.LexPlayerController'
        ConsolePlayerControllerClass=class'UTGame.UTConsolePlayerController'
        DefaultPawnClass=class'LexPawn'
        PlayerReplicationInfoClass=class'UTGame.UTPlayerReplicationInfo'
        GameReplicationInfoClass=class'UTGame.UTGameReplicationInfo'
        DeathMessageClass=class'UTDeathMessage'
            PopulationManagerClass=class'UTPopulationManager'
        BotClass=class'UTBot'
            bAllowKeyboardAndMouse=true
            bRestartLevel=False
        bDelayedStart=True
        bTeamScoreRounds=false
        bUseSeamlessTravel=true
        bWeaponStay=true
            bAutoNumBots=false
        CountDown=4
        bPauseable=False
        EndMessageWait=1
        DefaultMaxLives=0
    
        
    
            DefaultInventory(0)=class'UTWeap_LinkGun'
    
        //VictoryMessageClass=class'UTGame.UTVictoryMessage'
    
        // Voice is only transmitted when the player is actively pressing a key
        bRequiresPushToTalk=true
    
        bExportMenuData=true
    
        SpawnProtectionTime=+2.0
    
        SpeechRecognitionData=SpeechRecognition'SpeechRecognition.Alphabet'
        LastEncouragementTime=-20
        MidgameScorePanelTag=DMPanel
        bMidGameHasMap=false
    
        MaxPlayersAllowed=20
    
        //bGivePhysicsGun=true
    
        SpreeStatEvents.Add(SPREE_KILLINGSPREE)
        SpreeStatEvents.Add(SPREE_RAMPAGE)
        SpreeStatEvents.Add(SPREE_DOMINATING)
        SpreeStatEvents.Add(SPREE_UNSTOPPABLE)
        SpreeStatEvents.Add(SPREE_GODLIKE)
        SpreeStatEvents.Add(SPREE_MASSACRE)
    }
    Code:
    class LexPawn extends UTPawn;
    
    
    // members for the custom mesh
    var SkeletalMesh defaultMesh;
    var MaterialInterface defaultMaterial0;
    var AnimTree defaultAnimTree;
    var array<AnimSet> defaultAnimSet;
    var AnimNodeSequence defaultAnimSeq;
    var PhysicsAsset defaultPhysicsAsset;
    
    //Hud variables for health bar
    var float ElapsedRegenTime;
    var float RegenAmount;
    var float RegenTime;
    
    event Tick(float DeltaTime)
    {
       //calculate elapsed time
       ElapsedRegenTime += DeltaTime;
       
       //has enough time elapsed?
       if(ElapsedRegenTime >= RegenTime)
       {
          //heal the Pawn and reset elapsed time
          HealDamage(RegenAmount, Controller, class'DamageType');
          ElapsedRegenTime = 0.0f;
       }
    }
    
    simulated function SetCharacterClassFromInfo(class<UTFamilyInfo> Info)
    {
        Mesh.SetSkeletalMesh(defaultMesh);
        Mesh.SetMaterial(0,defaultMaterial0);
        Mesh.SetPhysicsAsset(defaultPhysicsAsset);
        Mesh.AnimSets=defaultAnimSet;
        Mesh.SetAnimTreeTemplate(defaultAnimTree);
    
    }
    
    
     exec function SetSpeed( int speed )
    {
        GroundSpeed = speed;
    }
    
    
    defaultproperties
    {
    
                //set defaults for regeneration properties
                    RegenAmount=2
                    RegenTime=1
    
        GroundSpeed=420
        Begin Object Name=WPawnSkeletalMeshComponent
            SkeletalMesh=SkeletalMesh'CH_IronGuard_Male.Mesh.SK_CH_IronGuard_MaleA'
                PhysicsAsset=PhysicsAsset'CH_AnimCorrupt.Mesh.SK_CH_Corrupt_Male_Physics'
            bCacheAnimSequenceNodes=FALSE
            AlwaysLoadOnClient=true
            AlwaysLoadOnServer=true
            bOwnerNoSee=false
            CastShadow=true
            BlockRigidBody=TRUE
            bUpdateSkelWhenNotRendered=false
            bIgnoreControllersWhenNotRendered=TRUE
            bUpdateKinematicBonesFromAnimation=true
            bCastDynamicShadow=true
            RBChannel=RBCC_Untitled3
            RBCollideWithChannels=(Untitled3=true)
            LightEnvironment=MyLightEnvironment
            bOverrideAttachmentOwnerVisibility=true
            bAcceptsDynamicDecals=FALSE
                AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_Human'
            bHasPhysicsAssetInstance=true
            TickGroup=TG_PreAsyncWork
            MinDistFactorForKinematicUpdate=0.2
            bChartDistanceFactor=true
            bSkipAllUpdateWhenPhysicsAsleep=TRUE
            RBDominanceGroup=20
            Scale=0.95
            bAllowAmbientOcclusion=false
    
    
    }
    Code:
    class LexPlayerController extends UTPlayerController;
    
    
    // members for the custom mesh
    var SkeletalMesh defaultMesh;
    var MaterialInterface defaultMaterial0;
    var AnimTree defaultAnimTree;
    var array<AnimSet> defaultAnimSet;
    var AnimNodeSequence defaultAnimSeq;
    var PhysicsAsset defaultPhysicsAsset;
    simulated function PostBeginPlay() {
    super.PostBeginPlay();
    SetCameraMode('ThirdPerson');
    resetMesh();
    }
    // Sets the Pawns Mesh to the resources speced in the DefaultProperties
    public function resetMesh(){
    self.Pawn.Mesh.SetSkeletalMesh(defaultMesh);
    self.Pawn.Mesh.SetMaterial(0,defaultMaterial0);
    self.Pawn.Mesh.SetPhysicsAsset(defaultPhysicsAsset );
    self.Pawn.Mesh.AnimSets=defaultAnimSet;
    self.Pawn.Mesh.SetAnimTreeTemplate(defaultAnimTree );
    }
    // Called at RestartPlayer by GameType
    public function rSetBehindView(bool view){
    SetBehindView(view);
    }
    // Called at RestartPlayer by GameType
    public function rSetCameraMode(name cameraSetting){
    SetCameraMode(cameraSetting);
    }
    
    DefaultProperties
    {
      Name="Default__LexPlayerController"
      defaultMesh=SkeletalMesh'CH_IronGuard_Male.Mesh.SK_CH_IronGuard_MaleA'
      defaultAnimTree=AnimTree'CH_AnimHuman_Tree.AT_CH_Human'
      defaultAnimSet(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman_BaseMale'
      defaultPhysicsAsset=PhysicsAsset'CH_AnimCorrupt.Mesh.SK_CH_Corrupt_Male_Physics'
    }
    This is for a third person game with regenerating health The classes folder needs to be called LexLuthor too unless you change it in the code !

  7. #7
    MSgt. Shooter Person
    Join Date
    May 2011
    Posts
    206

    Default

    Wow! thanks Lexluthor1 for this great example code. Also great tuts on youtube, watch them all the time

  8. #8
    Redeemer
    Join Date
    Jul 2011
    Location
    London, UK
    Posts
    1,748

    Default

    GO to UTFamilyInfo_Liandri_Male, override Liam Cathode Mesh with your mesh, and his animset with yours, and physics asset ( if you have one)


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.