1
\$\begingroup\$

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 ?

\$\endgroup\$
2
  • \$\begingroup\$ Are you in multiplayer or singleplayer? And I'm assuming you mean that you are using: PCOwner.GotoState('Sprinting'). \$\endgroup\$ – Phillip Oct 29 '13 at 21:53
  • \$\begingroup\$ I'm in single player. But the first answer help me \$\endgroup\$ – Jeremy Talus Nov 6 '13 at 23:22
1
\$\begingroup\$

If you are in the player controller class trying to change state the code works as

 GoToState('Fleeing');

If in Pawn, what I have gotten to work is

Controller.GotoState('PlayerClimbing');

because you are in the controller state you don't need to repeat it.

Hope that helps.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.