Announcement

Collapse
No announcement yet.

Creating a Mouse Cursor in the HUD

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

  • replied
    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

    Leave a comment:


  • replied
    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?

    Leave a comment:


  • replied
    But I also see a typo in your code:

    Your HUD class is: SkelShooterGFxHud

    But the default properties of SkelShooterHud has:

    HudMovieClass = class'SkeShooterGFxHud'

    Leave a comment:


  • replied
    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

    Leave a comment:


  • replied
    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.

    Leave a comment:


  • replied
    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.

    Leave a comment:


  • replied
    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?

    Leave a comment:


  • replied
    Nice. Whatever works I always say.

    Leave a comment:


  • replied
    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

    Leave a comment:


  • replied
    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.

    Leave a comment:


  • replied
    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.

    Leave a comment:


  • replied
    Open UDKEngine.ini
    Find the line: Suppress=DevGFxUI
    Comment it out by adding a semi-colon in front of it.

    Leave a comment:


  • replied
    Is there a way to trace something from actionscript to udk in log? Because I'm getting an error with :'obj keycode has no handler for GFxAction_Invoke_0', and I have no idea why the hell not ;P

    Leave a comment:


  • replied
    If your mouse cursor isn't moving then you need to double check that you aren't disabling it somewhere (such as with bIgnoreMouseInput = true). Also check to make sure you put the mouse cursor ActionScript that makes it move in the right place.

    Leave a comment:


  • replied
    I see. Well, nevertheless, thank you for your cooperation, you were incredibly helpful ;]

    Leave a comment:

Working...
X