Page 1 of 2 12 LastLast
Results 1 to 40 of 65
  1. #1

    Lightbulb Creating a Mouse Cursor in the HUD

    UPDATED 9/2/2011

    This intermediate level tutorial will explain how to add a toggle-able mouse cursor to an already existing HUD. The mouse cursor will not exist on the stage of the Flash file, but only in the library. It will be instantiated and attached to the _root Flash timeline at runtime by UnrealScript when the user presses and holds the Left Shift key on the keyboard.

    NOTE: Using this method, it is best to place all your UI content such as buttons, dropdowns, checkboxes, etc. (with the exception of the mouse cursor) inside a container movie clip that lives at _root. The mouse cursor will also live at _root. This will ensure the mouse is always on top, even when a popup UI element opens (such as that found in a drop down menu widget). These popup elements normally set themselves above everything else when they are created dynamically at runtime. Without being inside a container movie clip, the popup widget would appear above the mouse cursor.

    Step 1 - Flash

    • Open your HUD FLA file, and create a new mouse cursor graphic on the stage, either with a bitmap image or using Flash drawing tools. Be sure the tip is pointing to the top-left corner, like most cursors.
    • Now Select the cursor graphic, right click, and choose 'Convert to Symbol'.
    • In the Name field, enter MouseContainer.
    • Type should be Movie Clip.
    • Registration should be set to top-left.
    • Enable Export for ActionScript and Export in frame 1.
    • In the Identifier field, enter MouseContainer.
    • Press OK.
    • Now, double click the cursor on stage to enter the MouseContainer movie clip.
    • Select the graphic again, right click, and choose 'Convert to Symbol' again.
    • Name it MouseImage
    • Type should again be Movie Clip.
    • Registration should again be top-left.
    • Press OK.
    • Select the cursor movie clip on stage, and give it an instance name of mouseCursor_mc.

      You should now have the following hierarchy:

      MouseContainer movieclip (no instance name)
      -MouseImage movieclip (instance name: mouseCursor_mc)
      --mouse cursor bitmap image

    • Add any filters you like to this movie clip (mouseCursor_mc), such as a drop shadow filter.
    • Now, unselect mouseCursor_mc, add a new layer to the timeline (the timeline inside MouseContainer), and call it actions.
    • On frame 1 of the actions layer enter this code:


    ActionScript 2.0 Code Sample

    Code:
    import flash.external.ExternalInterface;
    
    Mouse.hide();
    
    var mouseListener:Object = new Object();
    
    mouseListener.onMouseMove = function ()
    {
        mouseCursor_mc._x = _root._xmouse;
        mouseCursor_mc._y = _root._ymouse;
    	
        ExternalInterface.call("UpdateMousePosition", _root._xmouse, _root._ymouse);
       
        updateAfterEvent();
    };
    
    Mouse.addListener(mouseListener);
    • Now return to the _root timeline of your Flash file, and delete the cursor movie clip (MouseContainer) form the stage. Don't worry, it still exists in the library. NOTE: You should have two movie clips in the library: MouseContainer & MouseImage, plus the mouse cursor bitmap image.
    • Save, Publish, and Import your modified HUD file into UDK.


    Step 2 - UnrealScript - HUD Class Changes (extends GFxMoviePlayer)

    First, add these vars to your HUD class (which extend GFxMoviePlayer):

    Code:
    // Standard Flash Objects
    var GFxObject RootMC, MouseContainer, MouseCursor;
    
    var array<ASValue> args;
    Add this code to your Start() or Init() function.

    Code:
    RootMC = GetVariableObject("_root");
    AddFocusIgnoreKey('LeftShift'); // Tells HUD to ignore Left Shift keyboard presses
    Add these functions to your class:

    Code:
    event UpdateMousePosition(float X, float Y)
    {
        local MouseInterfacePlayerInput MouseInterfacePlayerInput;
    
        MouseInterfacePlayerInput = MouseInterfacePlayerInput(GetPC().PlayerInput);
    
        if (MouseInterfacePlayerInput != None)
        {
            MouseInterfacePlayerInput.SetMousePosition(X, Y);
        }
    }
    Code:
    /** Toggles mouse cursor on/off */
    function ToggleCursor(bool showCursor, float mx, float my)
    {	
        if (showCursor)
        {
    	MouseContainer = CreateMouseCursor();
    	MouseCursor = MouseContainer.GetObject("my_cursor");
    	MouseCursor.SetPosition(mx,my);
    	MouseContainer.SetBool("topmostLevel", true);
        }
        else
        {
    	MouseContainer.Invoke("removeMovieClip", args);
    	MouseContainer = none;	
        }
    	
        self.bIgnoreMouseInput = !showCursor;		
    }
    Code:
    function GFxObject CreateMouseCursor()
    {
        return RootMC.AttachMovie("MouseContainer", "MouseCursor");
    }
    The CreateMouseCursor function attaches the Movie Clip in Flash that has the Identifier of MouseContainer to the _root timeline (the Stage), and gives it an instance name of MouseCursor.

    In the defaultproperties, be sure to include:

    Code:
    defaultproperties
    {
        bIgnoreMouseInput = true
    }

    Step 3 - UnrealScript - HUD Wrapper Class Changes

    First, add these variables to your HUD Wrapper class (the class that instantiates the HUD class above):

    Code:
    var GFxObject 			HudMovieSize;
    var MouseInterfacePlayerInput MouseInterfacePlayerInput;
    var float MouseX, MouseY;
    Next, add this line of code (in red) to your PostBeginPlay() function:

    Code:
    simulated function PostBeginPlay()
    {
        super.PostBeginPlay();
        
        // Your HUD instantiation code here...
    
        // Stage.originalRect contains the original width and height of the SWF file.
        // Replace HudMovie with the name of your instantiated HUD.
        HudMovieSize = HudMovie.GetVariableObject("Stage.originalRect");
    
        MouseInterfacePlayerInput = MouseInterfacePlayerInput(PlayerOwner.PlayerInput);
    }
    Next, add this function, which will be fired off (executed) when the user presses the Left Shift key. This function calls the ToggleCursor() function in the HUD class, and passes it true if the left shift key is pressed down, or false if it is released. It also passes the X & Y position of the mouse.

    Code:
    exec function SetShowCursor(bool showCursor)
    {
        // Replace HudMovie with the name of your instantiated HUD.
        HudMovie.ToggleCursor(showCursor, MouseX, MouseY);
    }
    Now, add these lines of code to the PostRender() event function, just above the HudMovie.TickHud(0) call. These two lines of code are used to get the current X & Y position of the mouse cursor.:

    Code:
    event PostRender()
    {	
        super.PostRender();
    
        MouseX = MouseInterfacePlayerInput.MousePosition.X;
        MouseY = MouseInterfacePlayerInput.MousePosition.Y;
    
        // Tick HUD
        if (HudMovie != none)
        {
    	HudMovie.TickHud(0);
        }
    }

    Step 4 - UnrealScript - MouseInterfacePlayerInput Class

    Create this new class and save it as MouseInterfacePlayerInput.uc. Be sure to replace all instances of SFHudWrapper (marked in red in the code) with the name of your HUD Wrapper class:

    Code:
    class MouseInterfacePlayerInput extends PlayerInput;
    
    // Stored mouse position. Set to private write as we don't want other classes to modify it, but still allow other classes to access it.
    var PrivateWrite IntPoint MousePosition; 
    var SFHudWrapper SFHudWrapper;
    var float HudX, HudY;
    
    event PlayerInput(float DeltaTime)
    {
        GetHudSize();
    	
        if (myHUD != None) 
        {
    	// Add the aMouseX to the mouse position and clamp it within the viewport width
    	MousePosition.X = Clamp(MousePosition.X + aMouseX, 0, HudX); 
    	// Add the aMouseY to the mouse position and clamp it within the viewport height
    	MousePosition.Y = Clamp(MousePosition.Y - aMouseY, 0, HudY); 
        }
        Super.PlayerInput(DeltaTime);
    }
    
    // This function gets the original width and height of the HUD SWF and stores those values in HudX and HudY.
    function GetHudSize()
    {
        // First store a reference to our HUD Wrapper and get the resolution of the HUD
        SFHudWrapper = SFHudWrapper(myHUD);
        HudX = SFHudWrapper.HudMovieSize.GetFloat("width");
        HudY = SFHudWrapper.HudMovieSize.GetFloat("height");
    }
    
    function SetMousePosition(int X, int Y)
    {
        GetHudSize();
    	
        if (MyHUD != None)
        {
    	MousePosition.X = Clamp(X, 0, HudX);
    	MousePosition.Y = Clamp(Y, 0, HudY);
        }
    }
    
    defaultproperties
    {
    }
    Step 5 - UnrealScript - PlayerController Class Changes

    Add this line to the defaultproperties of your PlayerController class:

    Code:
    defaultproperties
    {
        InputClass=class'MouseInterfacePlayerInput'
    }


    Step 6 - Config Files

    Then, add this line to your DefaultInput.ini file:
    Code:
    .Bindings=(Name="LeftShift",Command="SetShowCursor true | Onrelease SetShowCursor false")


    • Save and compile scripts.
    • Test your new cursor by running the game!



    Alternative: A good custom mouse cursor class written by UDK developer Marc Rogerson, can be found here: http://www.f00n.com/unreal/2010/06/3...r-class-as2-0/
    Last edited by Matt Doyle; 09-06-2011 at 01:31 PM.

  2. #2

    Default

    mmm one question Lets say i have a flash movie im rendering to a BSP wall

    is it possible to hide the mouse in this HUD and then set it to true once i interact with the BSP wall?

    sorry if my question wasnt clear enough spanish is my native lenguage so its a bit hard for me talk on english

  3. #3

    Default

    Sure.

    Set your mouse cursor's _visible flag to false by default when it is created. Place a trigger object in the game world next to your BSP object that tells your HUD to toggle the _visible flag of the mouse true or false by executing an UnrealScript function in the HUD class.

  4. #4

    Default

    got it thanks

  5. #5
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    405

    Default

    I'm not sure how to trigger it in Kismet. I mean, I've got function like this inside my actionscript:
    Code:
    import gfx.controls.Cursor;
    
    var myCursor = new Cursor("cursorMC");
    Mouse.hide();
    myCursor.disable();
    function showCursor(MyBool:Number)
    {
    	if(MyBool == 1)
    	{
    		myCursor.enable();
    	}
    	else
    	{	
    		myCursor.disable()
    	}
    }
    It uses Deadlyzer0's mouse class. Enable simply turns visibility to true, and disable to false. Then I try to invoke actionscript in Kismet, by using showCursor, and I've got nothing.

  6. #6

    Default

    I can't speak to a user created mouse class, but all you have to do to enable a movie clip's visibility in AS is:

    myCursor._visible = false;
    myCursor._visible = true;

    And, in UnrealScript it is:

    myCursor.SetBool("_visible", false); // or true

  7. #7
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    405

    Default

    I've made a function showCursor, which gets a bool, and if it's true, sets myCursor._visible to true, if not, to false. But when I call it from kismet invoke, nothing really happens.

  8. #8

    Default

    This should be your setup.

    1. Open GFx Movie in Kismet opens the SWF in question.
    2. Open GFx Movie's Player Owner is linked to a Player Variable.
    3. Open GFx Movie's Movie Player is linked to an Object Variable.
    4. Invoke's Movie Player is linked to the same Object Variable.
    5. Invoke's Method (Function) Name has the fully qualified path to your AS method. (e.g. my method is in a movie clip called 'myMovieClip' on the _root timeline so I would put _root.myMovieClip.MyMethodName in the Method Name field.)
    6. Add an Argument.
    7. Set it to AS_Boolean type.
    8. check or uncheck the B.

    If the Invoke AS node is being called by Open GFx Movie, try adding a Delay (Action->Misc->Delay) between Open GFx Movie and Invoke, and put at least a 0.1 second delay. The Invoke might be happening before the movie is actually finished loading. That shouldn't be the case, but I've seen it happen.



    Uploaded with ImageShack.us
    Last edited by Matt Doyle; 02-16-2011 at 02:26 PM.

  9. #9
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    405

    Default

    Well, that's almost exactly what I had in my Kismet, except for delay, and yet, it won't work. I guess I'll try Your way of showing mouse cursor, maybe it will work better.
    EDIT: Nope, no help either. Right now, using your way, my cursor won't update it's position, but I can still click blindly on the movie. I guess I'll have to find different approach. Can I enable input only on trigger event? And only mouse input, too. Using ignore keys in Kismet crashes my UDK.
    EDIT2: Ok, I got it working, it finally shows and hides my cursor - but there is still one more problem. Even though cursor is not visible, it still intercepts LMB clicks - and as I said, focus ignore keys in Kismet won't work for me. Any ideas?
    EDIT3: I've got it working in AS, using simple if (myCursor._disabled==false) [which means basically the same, as myCursor._visible==true]), and then throwing every button.onRelease function. But when I import it to UDK, it won't intercept clicks, no matter if the cursor is enabled or not.
    EDIT4: Ok, got it off at the beginning, turning on after stepping on trigger, via using two invoke actionscripts. One turning bool in function setting mouse cursor visible or not, and one running function that listen for button clicks. But, it still won't work to turn off the mouse clicks after I step off the trigger. Mouse cursor dissappears as it should, but the clicks are still intercepted. Any ideas? ;P
    Last edited by Kaldrick; 02-17-2011 at 03:56 AM.

  10. #10

    Default

    Ok, first of all - focus ignore keys are for keyboard and gamepad input, not mouse.

    If you're doing your scripting with ActionScript, you can remove the cursor movie clip using:

    ActionScript 2.0 Code Sample

    Code:
    function RemoveCursor()
    {
        _root.MouseCursor.removeMovieClip();
        ExternalInterface.call("IgnoreMouse", true);
    }
    This completely removes the cursor movie clip, not just hiding it. Then just use Invoke in Kismet to call RemoveCursor(). The RemoveCursor() function above assumes you have attached the mouse to the _root timline, and that it has an instance name of MouseCursor.

    Then, in your UnrealScript HUD class, you'll want a function like this, to intercept the ExternalInterface call:

    UnrealScript

    Code:
    function IgnoreMouse(bool toggle)
    {
        // Use me in UDK versions starting with Sept 2010
        self.bIgnoreMouseInput = toggle; 
    
        // Or use me in UDK versions May 2010 through Oct 2010
        SetFocus (toggle, toggle)
    }
    Keep in mind there are two aspets to mouse input - the cursor graphic, which is just an image, and really has nothing to do with input, and the mouse input, which is the part that actually listens for and intercepts mouse clicks, etc.

    And this won't keep your mouse from left clicking. The game itself intercepts mouse clicks.

    So, if you want to stop those mouse clicks from being interecepted by the Flash file, you can do this:

    Add a boolean variable to your HUD class:

    Code:
    var bool bNoMouse;
    Then, modify your IgnoreMouse() function:

    Code:
    function IgnoreMouse(bool toggle)
    {
        // Use me in UDK versions starting with Sept 2010
        self.bIgnoreMouseInput = toggle; 
    
        // Or use me in UDK versions May 2010 through Oct 2010
        SetFocus (toggle, toggle)
    }
    Finally, Create this function:

    Code:
    event bool FilterButtonInput(int ControllerId, name ButtonName, EInputEvent InputEvent)
    {
    	/* Test if a button has been moused over and the left mouse button has been pressed. */
    	if (self.bNoMouse == true && ButtonName == 'LeftMouseButton')
    	{
    		return true; // Do not intercept LeftMouseButton clicks.
    	}
    	return false; // Intercept LeftMouseButton clicks.
    }
    Last edited by Matt Doyle; 02-17-2011 at 01:34 PM.

  11. #11
    Palace Guard
    Join Date
    Jan 2010
    Location
    Germany
    Posts
    3,939

    Default

    Is the whole intercepting of keys and mouse movement something that is by default set up to propagate only to the SWF or to the GFxHUD? Or is such functionality also available in the base HUD class without using Flash?
    Our Loop, which art in source code, hallowed be thy keyword.
    Thy condition come, thy instruction be done, in RAM as it is in cache.
    Increment us this day our daily counter,
    and forgive us our typos, as we also have forgiven our compilers.
    And lead us not to the nullpointer but deliver us from bugs.
    For thine is the API, the GUI, and the CLI while(true).
    Semicolon;
    Please don't send me questions about how to do something in the UDK via PM. That is better discussed in the forums and we only have limited PM storage.

  12. #12

    Default

    Unreal intercepts all input. Handling it is usually done with binding in DefaultInput.ini

    When you have a GFx Movie Player being shown though, you can tell it to intercept input.

  13. #13
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    405

    Default

    I've got an error: 'Unrecognized member 'bIgnoreMouseInput' in class <GFxUI_Keycode>'

  14. #14

    Default

    Where did you put bIgnoreMousInput? What class? What does that class extend?

  15. #15
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    405

    Default

    GFxUI_keycode class, extending GFxMoviePlayer. It's right at the end of the file, just before defaultproperties.

  16. #16

    Default

    Can you show me your exact code?

  17. #17
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    405

    Default

    Code:
    /**
     * Shows Interaction options to the User; One can define upto six selectable options for the Interaction
     */
    class GFxUI_Keycode extends GFxMoviePlayer;
    
    var GFxObject MyContainer;
    
    var int MouseX;
    var int MouseY;
    
    function bool Start(optional bool StartPaused=false)
    {
            super.Start();
    	// Start at the first frame
    	Advance(0.f);  
    	// Flush PlayerInput and stop the Pawn
    	PlayerOwner.PlayerInput.ResetInput();
    	PlayerOwner.Pawn.ZeroMovementVariables();
    	`log("Start the keycode movie, hell yeah");
    	return true;
    }
    
    // This is called from Flash.
    function ReceiveMouseCoords( float x, float y )
    {
    	MouseX = x;
    	MouseY = y;
    }
    function RightCode()
    {
             `log("###### ExternalInterface Call Received #####");
        TriggerRemoteKismetEvent('MyEvent');
    }
    
    //function to trigger a remote kismet event
    function TriggerRemoteKismetEvent( name EventName )
    {
        local array<SequenceObject> AllSeqEvents;
        local Sequence GameSeq;
        local MyPlayerController PC;
        local int i;
        PC = MyPlayerController(PlayerOwner);
        GameSeq = PC.WorldInfo.GetGameSequence();
        if (GameSeq != None)
        {
            // find any Level Reset events that exist
            GameSeq.FindSeqObjectsByClass(class'SeqEvent_RemoteEvent', true, AllSeqEvents);
    
            // activate them
            for (i = 0; i < AllSeqEvents.Length; i++)
            {
    	    if(SeqEvent_RemoteEvent(AllSeqEvents[i]).EventName == EventName)
    	    SeqEvent_RemoteEvent(AllSeqEvents[i]).CheckActivate(PC.WorldInfo, None);
    	}
        }
    }
    function IgnoreMouse(bool toggle)
    {
        self.bIgnoreMouseInput = toggle;
    }
    DefaultProperties
    {
    //	bGammaCorrection=false // Remove this line for UDK June version onwards
            bIgnoreMouseInput = false;
    	MovieInfo=SwfMovie'GFx_Interaction.keycode'
    }
    UnrealScript.
    Code:
    var number:String = "";
    var index:Number = 0;
    /* when a key is pressed, execute this function. */
    runfunction();
    function runfunction()
    {
    	if(myCursor._disabled==false)
    	{
    	//ShowCursor(MyBool);
    	trace(myCursor._disabled);
    	B1.onRelease = function()
    	{
    		number = number + "1";
    		keycode.text = number;
    	}
    	B2.onRelease = function()
    	{
    		number = number + "2";
    		keycode.text = number;
    	}
    	B3.onRelease = function()
    	{
    		number = number + "3";
    		keycode.text = number;
    	}
    	B4.onRelease = function()
    	{
    		number = number + "4";
    		keycode.text = number;
    	}
    	B5.onRelease = function()
    	{
    		number = number + "5";
    		keycode.text = number;
    	}
    	B6.onRelease = function()
    	{
    		number = number + "6";
    		keycode.text = number;
    	}
    	B7.onRelease = function()
    	{
    		number = number + "7";
    		keycode.text = number;
    	}
    	B8.onRelease = function()
    	{
    		number = number + "8";
    		keycode.text = number;
    	}
    	B9.onRelease = function()
    	{	
    		number = number + "9";
    		keycode.text = number;
    	}
    	B0.onRelease = function()
    	{	
    		number = number + "0";
    		keycode.text = number;
    	}
    	BCE.onRelease = function()
    	{
    		number = number.substr(0,number.length-1);
    		keycode.text = number;
    	}
    	ButtonPush.onRelease = function()
    	{
    		if(number != "1337151337")
    		{
    			number = "";
    			keycode.text = number;
    		}
    		else
    		{
    			import flash.external.ExternalInterface;
    		    ExternalInterface.call("RightCode");
    		}
    	}
    }
    }
    ActionScript, main part.
    Code:
    import gfx.controls.Cursor;
    import flash.external.ExternalInterface;
    
    var myCursor = new Cursor("cursorMC");  
    myCursor.enable();
    function ShowCursor(MyBool:Boolean)
    {
    	if(MyBool==true)
    	{
    		myCursor.enable();
    		ExternalInterface.call("IgnoreMouse", true);
    	}
    	else
    	{
    		myCursor.disable();
    		ExternalInterface.call("IgnoreMouse", true);
    	}
    }
    ActionScript, cursor layer.
    And mousecursor class

  18. #18

    Default

    What version of UDK are you using?

  19. #19
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    405

    Default

    May 2010 version.

  20. #20

    Default

    The code looks fine. I have no idea why bIgnoreMouseInput is giving you an error. Maybe it wasn't implemented in May 2010 UDK? I"m working in February 2011. I'll have to do some research on the May version.

  21. #21
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    405

    Default

    I'd be grateful. I'm not sure if I'll be able to convert everything to newer UDK version.

  22. #22

    Default

    Give me a little time, and I'll get back to you. Hopefully today. I'm downloading May 2010 now.

  23. #23

    Default

    Ok, in May, bCaptureInput is not available; however, you can use SetFocus(bool, bool)

    http://files.arbi.trari.us/Doc/gfxui...tml#_SetFocus-

    So, to tell your movie to capture or not capture input, try this:

    Code:
    function IgnoreMouse(bool toggle)
    {
        SetFocus(toggle, toggle);
        bNoMouse = toggle;
    }
    And - be sure to use the FilterButtonInput() function I gave you above as well.
    Last edited by Matt Doyle; 02-17-2011 at 01:27 PM.

  24. #24
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    405

    Default

    I've got an 'Object keycode has no handler for GFxAction_Invoke_0', even though everything is correct.
    I'm not sure why, but I'm still failing at making it work. ;P I guess I need to rework it from the ground.
    Last edited by Kaldrick; 02-18-2011 at 02:37 PM.

  25. #25
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    405

    Default

    I've got mouse cursor set up the way you did it in first post. I've got an actionscript ShowCursor function, that shoots an external interface of ignoremouse, set the way you said here before. I've got that FilterButtonInput in place, too. In Kismet, I call ShowCursor function when the movie is loaded, and when trigger is touched. Yet, it still doesn't work - after game start the cursor appears in top right corner and wouldn't move.
    I was wondering... Is there a way of disabling mouse capturing in every scaleform movie inside a level, if it's not in focus?
    Last edited by Kaldrick; 02-21-2011 at 04:48 PM.

  26. #26

    Default

    Well, I've given you everything I know to give. You're going to have to go over your code and Flash file and look for errors.

  27. #27
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    405

    Default

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

  28. #28

    Default

    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.

  29. #29
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    405

    Default

    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

  30. #30

    Default

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

  31. #31
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    405

    Default

    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.
    Last edited by Kaldrick; 02-24-2011 at 01:46 AM.

  32. #32

    Default

    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.

  33. #33
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    405

    Default

    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

  34. #34

    Default

    Nice. Whatever works I always say.

  35. #35
    MSgt. Shooter Person
    Join Date
    Mar 2010
    Location
    United Kingdom
    Posts
    268

    Default

    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?

  36. #36

    Default

    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.

  37. #37
    MSgt. Shooter Person
    Join Date
    Jan 2011
    Posts
    83

    Default

    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.

  38. #38

    Default

    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

  39. #39

    Default

    But I also see a typo in your code:

    Your HUD class is: SkelShooterGFxHud

    But the default properties of SkelShooterHud has:

    HudMovieClass = class'SkeShooterGFxHud'

  40. #40
    MSgt. Shooter Person
    Join Date
    Jan 2011
    Posts
    83

    Default

    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?
    Last edited by bravery; 03-10-2011 at 02:13 AM.


 
Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.