Announcement

Collapse
No announcement yet.

[SOLVED] access GFXMoviePlayer / GFXUI_PauseMenu from PlayerController

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    well your error message says it all...You don't have the function registerMenu in your player Controller. Not to be rude, but I guess you did not fully understand on how the classes work together and how to call functions.

    Let me explain to you uitilizing my code:

    Code:
    class myPlayerController extends UDKPlayerController;
    //Or class definition has the Name  "myPlayerController" this is also the actual name of the file. It extends the existing UDKPlayerCOntroller. It COULD also extend UTPlayerCOntroller for example.
    
    var VirtualFHMain pauseMenu;
    //THIS is an uninitialized variable of the type VirtualFHMain with the name pausemenu. VirtualFHMain in my case xtends the utPauseMenu, but this could also be y gfxmovieplayer instead, it would work the same way (the logic is the same)
    
    
    function registerMenu(VirtualFHMain regThisMenu){
    	pauseMenu = regThisMenu;
    }
    //THIS function is called form the gfxmovieplayer, in my case from my pause menu, to be precise my pauseMenu is form the type "VirtualFHMain". This is why I am able to assign this variable here to my predefined Variable "PauseMenu" as they are of the same type. You can no access variables and functions via "pauseMenu.anyVariableOrFunction" as pauseMenu now has a reference to the class I want to work with.
    Now the pausemenu or the gfxmovieplayer in your case:

    Code:
    function bool Start(optional bool StartPaused = false){
               //thisController is a variable of the type myPlayerController.
    	thisController = myPlayerController(GetPC());
                //Now this is paramount: GetPC() returns the actual PlayerController in form of "PlayerController" but i have to cast it to myPlayerCOntroller as my variable expects this type. Aslo, Only "myPlayerController" has the defined function "registerMenu"
    	thisController.registerMenu(self);
    //And here we assign ourselfes to the variable in our playercontroller so we have a reference to it.
    Understand?

    Leave a comment:


  • replied
    Originally posted by Nanovarium View Post
    maybe it helps.

    Thank you so much!


    But I'm stuck of this.


    Code:
    var PlayerController thisController;
    
    function bool Start(optional bool StartPaused)
    {
    	thisController = MyPlayerController(GetPC());
    	thisController.registerMenu(self);
    
    	return false;
    }
    
    : Cannot find 'registerMenu' function in 'PlayerController'.

    Code:
    var PlayerController thisController;
    
    function bool Start(optional bool StartPaused)
    {
    	thisController = GetPC();
    	thisController.registerMenu(self);
    
    	return false;
    }
    
    : Cannot find 'registerMenu' function in 'PlayerController'.

    Code:
    var PlayerController thisController;
    var MyPlayerController anotherController;
    
    function bool Start(optional bool StartPaused)
    {
    	thisController = GetPC();
    	anotherController.registerMenu(self);
    
    	return false;
    }
    
    : My Test variable is 'null' to call.

    How do I fix it?

    Leave a comment:


  • replied
    ok I got this solved on my own with a little bit of workaround.

    Code:
    class myPlayerController extends UDKPlayerController;
    
    var TargetArrow NavArrow;
    var Rotator navrot;
    var VirtualFHMain pauseMenu;
    
    simulated event PostBeginPlay()
    {	
        super.PostBeginPlay();	
        NavArrow = Spawn(class'VirtualFH.TargetArrow',self);
    	NavigationHandle = new(self) class'NavigationHandle';
    	
    }
    
    function registerMenu(VirtualFHMain regThisMenu){
    	pauseMenu = regThisMenu;
    }
    and in the movie class:

    Code:
    function bool Start(optional bool StartPaused = false){
    	thisController = myPlayerController(GetPC());
    	thisController.registerMenu(self);
    maybe it helps.

    Leave a comment:


  • [SOLVED] access GFXMoviePlayer / GFXUI_PauseMenu from PlayerController

    Me again!

    Finally i managed to call functions in my playercontroller out of gfxmovieplayer. however, how do I get acess the other way round?

    To be precise:

    Code:
    class VirtualFHMain extends GFxUI_PauseMenu;
    
    var PlayerController thisController;
    
    (....)
    
    function bool Start(optional bool StartPaused = false){
    	thisController = GetPC().GetALocalPlayerController();
    	super.Start();
    	Advance(0);
    
    	return true;
    
    }
    
    (...CLIK initialization etc. .... )
    
    function OnbtnGoHover(GFxClikWidget.EventData ev){
    	GoalLbl.SetText("Go Hovered");
    	thisController.SetTimer(0.75f,false,GoHover);
    }
    and then, in PlayerController:

    Code:
    function GoHover(){
    //here i want to call a function located in my "class VirtualFHMain extends GFxUI_PauseMenu;"
    }
    I all do this stuff to get access to the timer which seems only to be avialable in PlayerController. If I am not wrong.

    Help?
Working...
X