Changing State in PlayerControler from PlayerInput

Posted by Jeremy Talus on Game Development See other posts from Game Development or by Jeremy Talus
Published on 2013-10-27T10:36:34Z Indexed on 2013/10/27 16:01 UTC
Read the original article Hit count: 327

Filed under:
|

In my player input I wanna change the the "State" of my player controller but I have some trouble to do it

my player input is declared like that :

class ResistancePlayerInput extends PlayerInput within ResistancePlayerController
    config(ResistancePlayerInput);

and in my playerControler I have that :

class ResistancePlayerController extends GamePlayerController;

var name PreviousState;

DefaultProperties
{
    CameraClass = class 'ResistanceCamera' //Telling the player controller to use your custom camera script
    InputClass = class'ResistanceGame.ResistancePlayerInput'
    DefaultFOV = 90.f //Telling the player controller what the default field of view (FOV) should be
}

simulated event PostBeginPlay()
{
    Super.PostBeginPlay();
}

auto state Walking {
    event BeginState(name PreviousStateName) {
        Pawn.GroundSpeed = 200;
        `log("Player Walking");
    }
}

state Running extends Walking {
    event BeginState(name PreviousStateName) {
        Pawn.GroundSpeed = 350;
        `log("Player Running");
    }
}

state Sprinting extends Walking {
    event BeginState(name PreviousStateName) {
        Pawn.GroundSpeed = 800;
        `log("Player Sprinting");
    }
}

I have tried to use

PCOwner.GotoState(); and ResistancePlayerController(PCOwner).GotoState(); but won't work.

I have also tried a simple GotoState, and nothing happen

how can I call GotoState for the PC Class from my player input ?

© Game Development or respective owner

Related posts about udk

Related posts about unreal