Announcement

Collapse
No announcement yet.

Accessing a variable questions?

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

    Accessing a variable questions?

    Hey guys,

    Goal: Im trying to have two different camera angles, 1 that uses default point of view and a 2nd that uses my custom top down point of view. That is the easy part (for some reason )

    Problem: I have a ui scene open as soon as the game stats eventually it will become a character selection screen, this scene needs to be in the normal point of view. When i click on the back button to close i want it to switch to my custum top down point of view. Problem is i cant seem to get htat working.

    What i was trying to do is when the uiscene closes set a bool to true... in my case bIsClosed. Then somehow in my playercontroller where i have my function for GetPlayerViewPoint have in if statement that checks to see if bIsClosed == true. But im having some trouble getting a pointer to that variable. Any suggestions?

    Thanks

    //Character Select Screen
    Code:
    class IOUI_CharacterSelect extends UTUIFrontEnd;
    
    var transient UIButton button;
    
    var bool bIsClosed; // only true if uiscene is closed.
    
    event SceneActivated(bool bInitialActivation)
    {
        Super.SceneActivated(bInitialActivation);
    
    if (bInitialActivation)
    {
        ActivateLevelEvent('CharacterSelectionEnter_Garage');
    }
    }
    
    
    
    function SetupButtonBar()
    {
         ButtonBar.AppendButton(" <Strings:UTGameUI.ButtonCallouts.Back> ", OnButtonBar_Back);
    }
    
    function bool OnButtonBar_Back(UIScreenObject InButton, int InPlayerIndex)
    {
         ActivateLevelEvent('CharacterSelectionExit');
         bIsClosed=true;
         CloseScene(self);
    
         return true;
    }
    
    DefaultProperties
    {
       bIsClosed = false
    }

    //Function in my playercontroller
    Code:
    simulated function GetPlayerViewPoint(out vector POVLocation, out rotator POVRotation)
    {
    	local vector X, Y, Z;
    	//local IronOutlawsGame Game;
            //Game = IronOutlawsGame(WorldInfo.Game);
    
            if(bIsClosed == true) // need pointer to bIsClosed from IOUI_CharacterSelect
            {
    	if (bDebugView)
    	{
    		Super.GetPlayerViewPoint(POVLocation, POVRotation);
    		return;
    	}
    
    	if (ViewTarget != None && ViewTarget != self)
    	{
    		POVLocation = ViewTarget.Location;
    	}
    	else
    	{
    		POVLocation = vect(0,0,0);
    	}
    	POVLocation.Z += CameraZOffset;
    	POVRotation = rotator(vect(0,0,-1));
    
    
    	// add camera shake
    	GetAxes(POVRotation, X, Y, Z);
    	POVRotation = Normalize(POVRotation + ShakeRot);
    	POVLocation += ShakeOffset.X * X + ShakeOffset.Y * Y + ShakeOffset.Z * Z;
            }
    
            else
            {
             super.GetPlayerViewPoint(POVLocation, POVRotation);
            }
    }

    #2
    When you open a scene it returns the scene:
    Code:
    var UIScene MyScene;
    
    MyScene = OpenUIScene(MyScene);
    
    if(MyScene != none && MySceneClass(MyScene).bIsClosed)
        Something();
    
    defaultproperties
    {
        MyScene="MyPackage.MyUIScene"
    }

    Comment


      #3
      Thanks for the reply Angel. Something doesnt to be working. Doesnt look like im opening my scene:

      Warning: OpenScene called with NULL Scene!
      ScriptLog: MyScene = None


      This is how i set up what u gave me. MyScene is delcared at top of class. and MyScene="IO_UI_HUD.charSel" delcared in default properties.

      Dont know if this is important or not... but im using kismet to open the scene on level loaded and visible.

      Code:
      simulated function GetPlayerViewPoint(out vector POVLocation, out rotator POVRotation)
      {
      	local vector X, Y, Z;
      	//local IronOutlawsGame Game;
              //Game = IronOutlawsGame(WorldInfo.Game);
      
              MyScene = OpenUIScene(MyScene);       
              `Log("MyScene = "@OpenUIScene(MyScene));
      
              if(MyScene != none && IOUI_CharacterSelect(MyScene).bIsClosed)        
                  {
             	if (bDebugView)
      	{
      		Super.GetPlayerViewPoint(POVLocation, POVRotation);
      		return;
      	}
      
      	if (ViewTarget != None && ViewTarget != self)
      	{
      		POVLocation = ViewTarget.Location;
      	}
      	else
      	{
      		POVLocation = vect(0,0,0);
      	}
      	POVLocation.Z += CameraZOffset;
      	POVRotation = rotator(vect(0,0,-1));
      
      
      	// add camera shake
      	GetAxes(POVRotation, X, Y, Z);
      	POVRotation = Normalize(POVRotation + ShakeRot);
      	POVLocation += ShakeOffset.X * X + ShakeOffset.Y * Y + ShakeOffset.Z * Z;
              }
              else
              {
               super.GetPlayerViewPoint(POVLocation, POVRotation);
              }
      }

      //My uiscene class

      Code:
      class IOUI_CharacterSelect extends UTUIFrontEnd;
      
      var transient UIButton button;
      
      var bool bIsClosed; // only true if uiscene is closed.
      
      event SceneActivated(bool bInitialActivation)
      {
          Super.SceneActivated(bInitialActivation);
      
      if (bInitialActivation)
      {
          ActivateLevelEvent('CharacterSelectionEnter_Garage');
      }
      }
      
      
      
      function SetupButtonBar()
      {
           ButtonBar.AppendButton(" <Strings:UTGameUI.ButtonCallouts.Back> ", OnButtonBar_Back);
      }
      
      function bool OnButtonBar_Back(UIScreenObject InButton, int InPlayerIndex)
      {
           ActivateLevelEvent('CharacterSelectionExit');
           bIsClosed=true;
           CloseScene(self);
           `Log("bIsClosed = "@bIsClosed);
           return true;
      }
      
      DefaultProperties
      {
         bIsClosed = false
      }

      Comment


        #4
        This probably sounds stupid, but have you actually defined 'myscene'?

        Comment


          #5
          Thanks for your reply ambershee.

          all code resides in my custom playercontroller

          Am i missing anything?

          Thanks again.

          //declartion
          Code:
          var UIScene MyScene;

          //Default Properties
          Code:
          DefaultProperties
          {
          
             MyScene="IO_UI_HUD.charSel"
          
          }

          //GetPlayerViewPoint Function
          Code:
          simulated function GetPlayerViewPoint(out vector POVLocation, out rotator POVRotation)
          {
          	local vector X, Y, Z;
          	//local IronOutlawsGame Game;
                  //Game = IronOutlawsGame(WorldInfo.Game);
          
                  MyScene = OpenUIScene(MyScene);       
                  `Log("MyScene = "@OpenUIScene(MyScene));
          
                  if(MyScene != none && IOUI_CharacterSelect(MyScene).bIsClosed)        
                      {
                 	if (bDebugView)
          	{
          		Super.GetPlayerViewPoint(POVLocation, POVRotation);
          		return;
          	}
          
          	if (ViewTarget != None && ViewTarget != self)
          	{
          		POVLocation = ViewTarget.Location;
          	}
          	else
          	{
          		POVLocation = vect(0,0,0);
          	}
          	POVLocation.Z += CameraZOffset;
          	POVRotation = rotator(vect(0,0,-1));
          
          
          	// add camera shake
          	GetAxes(POVRotation, X, Y, Z);
          	POVRotation = Normalize(POVRotation + ShakeRot);
          	POVLocation += ShakeOffset.X * X + ShakeOffset.Y * Y + ShakeOffset.Z * Z;
                  }
                  else
                  {
                   super.GetPlayerViewPoint(POVLocation, POVRotation);
                  }
          }

          Comment


            #6
            For the MyScene Variable you dont want to use "s as that says that its a String, however you can't open a string. Use 's. Not sure what type that file is but put that file type before the name. ex:

            Code:
            defaultproperties
            {
                 TheMesh=StaticMesh'MeshyGoodness.Mesh'
            }

            Comment


              #7
              Thanks for your reply PhoenixWing.

              That does make sense and it compiles fine. But still not working correctly.


              Code:
              Warning: OpenScene called with NULL Scene!
              ScriptLog: MyScene =  None

              Any suggestions?

              Thanks for any help

              Comment


                #8
                You need to put the file type before the actual package name like I did in the above example

                Comment


                  #9
                  On second thought let me rephrase that and correct myself. You will want to add this now

                  Code:
                  var class<UIScene> MSClass;
                  
                  MyScene = OpenUIScene(MSClass);
                  
                  defaultproperties
                  {
                      MSClass=UIScene'IO_UI_HUD.charSel'
                  }
                  That should then work

                  Comment


                    #10
                    Yeah i realized that after i posted it and you responded very quickly that i couldnt edit the post fast enough... Thanks for the help....


                    Edited post:
                    "Thanks for your reply PhoenixWing.

                    That does make sense and it compiles fine. But still not working correctly.



                    Code:
                    Warning: OpenScene called with NULL Scene!
                    ScriptLog: MyScene = None
                    Any suggestions?

                    Thanks for any help "

                    Comment


                      #11
                      ahh ur fast responding... i was responding to ur respond blah... let me go try that

                      Comment


                        #12
                        Looks like I did it again

                        Comment


                          #13
                          .... so tried that...

                          thanks for all the help i appreciate it

                          it doesnt like param 1 :
                          Code:
                          C:\Program Files (x86)\Unreal Tournament 3\Development\Src\IronOutlaws\Classes\IronOutlawsPlayerController.uc(76) : Error, Type mismatch in Call to 'OpenUIScene', parameter 1

                          declartions
                          Code:
                          var UIScene MyScene;
                          var class<UIScene> MSClass;
                          GetPlayerViewPoint
                          Code:
                          simulated function GetPlayerViewPoint(out vector POVLocation, out rotator POVRotation)
                          {
                          	local vector X, Y, Z;
                          	//local IronOutlawsGame Game;
                                  //Game = IronOutlawsGame(WorldInfo.Game);
                          
                                  MyScene = OpenUIScene(MSClass);
                                  `Log("MyScene = "@OpenUIScene(MyScene));
                          
                                  if(MyScene != none && IOUI_CharacterSelect(MyScene).bIsClosed)
                                  {
                                 	if (bDebugView)
                          	{
                          		Super.GetPlayerViewPoint(POVLocation, POVRotation);
                          		return;
                          	}
                          
                          	if (ViewTarget != None && ViewTarget != self)
                          	{
                          		POVLocation = ViewTarget.Location;
                          	}
                          	else
                          	{
                          		POVLocation = vect(0,0,0);
                          	}
                          	POVLocation.Z += CameraZOffset;
                          	POVRotation = rotator(vect(0,0,-1));
                          
                          
                          	// add camera shake
                          	GetAxes(POVRotation, X, Y, Z);
                          	POVRotation = Normalize(POVRotation + ShakeRot);
                          	POVLocation += ShakeOffset.X * X + ShakeOffset.Y * Y + ShakeOffset.Z * Z;
                                  }
                                  else
                                  {
                                   super.GetPlayerViewPoint(POVLocation, POVRotation);
                                  }
                          }
                          defaultproperties

                          Code:
                          MSClass=UIScene'IO_UI_HUD.charSel'

                          Comment


                            #14
                            Hey guys i really appreciate all your help. still not working... C:\Program Files\Unreal Tournament 3\Development\Src\IronOutlaws\Classes\IronOutlawsP layerController.uc(76) : Error, Type mismatch in Call to 'OpenUIScene', parameter 1

                            Bump

                            ajporter

                            Comment


                              #15
                              OpenUIScene(MSClass);
                              Doesn't that need to be something like Controller or Instigator etc. I don't think you can specify it like that.

                              Btw, what does MyClass extend, you could try

                              Code:
                              MyScene = OpenUIScene(MSClass(UIScene));
                              for example, but I'm not sure if that would work.

                              Comment

                              Working...
                              X