Announcement

Collapse
No announcement yet.

Creating a Mouse Cursor in the HUD

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

    #31
    Warning: Failed to load 'SwfMovie ?INT?GFxUI.IME.MoviePath?': Failed to find object 'SwfMovie ?INT?GFxUI.IME.MoviePath?'
    Is it bad? ;P
    And still it tells me there is no handle for GFxAction_Invoke_0.

    Comment


      #32
      I wouldn't worry too much about the IME warning. Your SWFs should still work with that warning. IME stands for Input Method Editor, and it is a Scaleform product that is used for Asian Language keyboard support.

      But honestly, I don't know what the no handler error is.

      I take it you have an Invoke ActionScript in Kismet? Maybe it pertains to that? It's hard to know what is wrong without seeing your code, AND your Kismet and Flash setup.

      Comment


        #33
        Well, I think that there are some problems in May version of UDK, which cannot be outsmarted without full source code. So instead of hitting repeatedly my head against a wall I've made a workaround solution. I have empty swf movie that I display on my material, then, when trigger is touched, I change it for my real .swf material, and then back again to blank. And because it's foolproof, it works ;P

        Comment


          #34
          Nice. Whatever works I always say.

          Comment


            #35
            Hey there, is it possible to toggle the mouseCursor_mc on and off with a keybinding using the concepts discussed earlier in the thread, or would I have to take a different approach?

            Comment


              #36
              Certainly. One approach would be to have your mouse toggled visible/invisible via a keybind. And setting self.bCaptureInput = true on the HUD movie when you toggle it visible.

              Another approach would be to create the mouse as a separate GFxMoviePlayer and create/destroy it on keybind.

              Comment


                #37
                Hello Matt,

                very nice tutorial, thanks

                I have follow the tutorial exactly as you mentioned on the first post, however I can't see my cursor at all

                I can't find any error, where I can import the .swf correctly, and I got no error at all at while importing it, also I'm compiling my script and there is no errors while compiling.

                Note: I'm using Jan-2011 UDK version.

                Please find my code below and advice about how to progress:

                HUD class:

                Code:
                class SkelShooterHud extends UTHUD;
                
                var SkelShooterGFxHud           HudMovie;
                var class<SkelShooterGFxHud> HudMovieClass;
                
                simulated function PostBeginPlay()
                {
                	super.PostBeginPlay();
                
                
                
                        if (HudMovie == None)
                        {
                	  HudMovie = new class'SkelShooter.SkelShooterGFxHud';
                	  //HudMovie.PlayerOwner = SkelShooterPlayerController(PlayerOwner);
                
                	  HudMovie.SetTimingMode( TM_Real );
                	  HudMovie.SetAlignment( Align_BottomCenter );
                	  HudMovie.Start();
                
                        }
                        
                        SizeX = 1024;
                	SizeY = 768;
                }
                
                function Vector2d GetMouseCoords()
                {
                	local Vector2d mousePos;
                
                	mousePos.X = HudMovie.MouseX;
                	mousePos.Y = HudMovie.MouseY;
                
                	return mousePos;
                }
                
                event PostRender()
                {
                	local Vector2D playerMouse;
                	local SkelShooterPlayerController tdsPlayer;
                
                	tdsPlayer= SkelShooterPlayerController(PlayerOwner);
                	playerMouse = GetMouseCoords();
                
                	//ClientMessage("mouse values: "$playerMouse);
                	Canvas.SetDrawColor( 255, 255, 255, 255 );
                
                	Canvas.SetPos( 10.0, 10.0 );
                	Canvas.DrawText( "Mouse: X:" $ playerMouse.X $ ", Y:" $ playerMouse.Y );
                
                         // ** Can do the deproject etc. as shown in tutorials here on the values from GetMouseCoords().
                }
                
                
                DefaultProperties
                {
                	HudMovieClass = class'SkeShooterGFxHud'
                }
                GFxMoviePlayer class:

                Code:
                class SkelShooterGFxHud extends GFxMoviePlayer;
                
                var int MouseX;
                var int MouseY;
                
                // Standard Flash Objects
                var GFxObject RootMC, MouseCursor;
                
                function bool Start (optional bool StartPaused = false)
                {
                	super.Start();
                	Advance(0);
                
                	RootMC = GetVariableObject("_root");
                	MouseCursor = CreateMouseCursor();
                	MouseCursor.SetBool("topmostLevel", true); // This ensures the mouse is drawn at the top most level, above all other UI widgets.
                }
                
                // This is called from Flash.
                function ReceiveMouseCoords( float x, float y )
                {
                	MouseX = x;
                	MouseY = y;
                }
                
                function GFxObject CreateMouseCursor()
                {
                    return RootMC.AttachMovie("mouseCursor", "MouseCursor");
                }
                
                DefaultProperties
                {
                	bDisplayWithHudOff = false
                	bEnableGammaCorrection=FALSE
                	bIgnoreMouseInput = false
                
                	
                        // Path to your package/flash file here.
                	MovieInfo = SwfMovie'SkelShooter.MouseHUD'
                }
                Please advice.

                Comment


                  #38
                  Ah, very sorry - I had some incorrect names.

                  Your UnrealScript code should be:

                  Code:
                  function GFxObject CreateMouseCursor()
                  {
                      return RootMC.AttachMovie("MouseContainer", "MouseCursor");
                  }
                  And...the Identifier of your MouseContainer movie clip should be: MouseContainer

                  ...not mouseCursor

                  Comment


                    #39
                    But I also see a typo in your code:

                    Your HUD class is: SkelShooterGFxHud

                    But the default properties of SkelShooterHud has:

                    HudMovieClass = class'SkeShooterGFxHud'

                    Comment


                      #40
                      Thanks Matt for the information, I did the correction as you mentioned above:
                      1- MouseContainer in my code and in my movie clip.
                      2- I fix the typo (thanks for finding it).

                      then what I did was:
                      1- Re-import the swf file (after publishing it).
                      2- Recompile the code and put it in the scripts folder.

                      However I still can't see the mouse?
                      and the problem is that I can't see any errors at all neither in recompiling the code nor while importing the .swf, this is really strange?

                      Any advice?

                      Comment


                        #41
                        Hello Matt,

                        I was looking in the log file and I found the following warning can this help?


                        [0029.53] Log: GFxMoviePlayer::Start called with no movie loaded
                        [0029.53] ScriptWarning: Accessed None 'RootMC'
                        SkelShooterGFxHud Transient.SkelShooterGFxHud_0
                        Function SkelShooter.SkelShooterGFxHud:CreateMouseCursor:00 0B
                        [0029.53] ScriptWarning: Accessed None 'MouseCursor'
                        SkelShooterGFxHud Transient.SkelShooterGFxHud_0
                        Function SkelShooter.SkelShooterGFxHud:Start:0059
                        [0029.53] ScriptWarning: Control reached the end of non-void function (make certain that all paths through the function 'return <value>'
                        SkelShooterGFxHud Transient.SkelShooterGFxHud_0
                        Function SkelShooter.SkelShooterGFxHud:Start:007F
                        [0029.53] ScriptWarning: Accessed None 'OnlineSub'
                        SkelShooterPlayerController UEDPIEIsometricTest.TheWorld:PersistentLevel.SkelS hooterPlayerController_0
                        Function UTGame.UTPlayerController:ClientSetOnlineStatus:00 33

                        Comment


                          #42
                          Hi Matt,

                          I solve the problem, now I can see the mouse cursor.

                          Thanks.

                          Comment


                            #43
                            Hello Matt,

                            When I'm trying to do a deproject for the mouse position that get collected from the mouse cursor (SWF), the result will be unrealistic and thus my player will not rotate toward my cursor location correctly?

                            Sorry forgot to say that I'm doing an Isometric camera game and I want the player to look at the cursor position.

                            But it seams that I can't directly deproject the values that I'm getting from the SWF mouse position

                            Is there any solution for this problem?

                            Thanks in advance.

                            Comment


                              #44
                              Hi all

                              I am having some trouble following the first mouse cursor tutorial posted by Matt.

                              I followed the instructions to the letter to implement the mouse in flash, as well as to get it working in the UDK.

                              However, the mouse doesn't appear when testing the swf in the FxMediaPlayer, I can click the buttons, the mouse just isn't visible. Also when I test the file in game, the menu doesn't appear at all.

                              Now if I remove all of the mouse stuff from the flash file, the menu works fine, both in the FxMediaPlayer, and ingame.

                              I am getting this error in the log file when I run the game:
                              Code:
                              Log: FGFxEngine::LoadMovieDef Error - failed to get info about / package/Folder1/Folder2/MenuFile
                              
                              Log: FGFxEngine::LoadMovie Error - failed to create a movie from 'Folder1/Folder2/MenuFile'
                              
                              ScriptWarning: Accessed None 'RootMC'
                              
                              //this warning is refering to the CreateMouseCursor function in my GFxMoviePlayer file
                              
                              Script Warning: Accessed None 'MouseCursor'
                              // refering to my start function in my GFxMoviePlayer class
                              Any suggestions would be much appreciated, its driving me crazy!!!!

                              Comment


                                #45
                                I followed your tutorial but dont have a visible mouse. Do i need to do anything else that u didnt happen to mention in the tutorial to get my mouse to show up? Do i need to call it in another class or use Kismet or something like that?

                                Comment

                                Working...
                                X