Page 2 of 2 FirstFirst 12
Results 41 to 57 of 57
  1. #41
    MSgt. Shooter Person
    Join Date
    Oct 2010
    Location
    Pakistan
    Posts
    313

    Default

    Quote Originally Posted by Matt Doyle View Post
    You need to read this to learn how to import a new package & SWF into UDK:

    http://udn.epicgames.com/Three/Scale...s%20into%20UE3

    Essentially - save your SWF file in a folder called TrGfx in the Flash directory of your UDK game directory. The Flash directory already exists. So create the folder TrGfx in there, then save your SWF inside that.

    Then, inside UDK Editor, press Import button in Content Browser and import the SWF file.

    \UDKGame\Flash\TrGfx

    The UnrealScript files should be saved in this folder inside your UDK install:

    \Development\Src\UTGame\Classes
    for this can you make tutorial for me please???
    Simpler Is Better

  2. #42
    MSgt. Shooter Person
    Join Date
    Dec 2010
    Posts
    193

    Default

    Quote Originally Posted by collix View Post
    Had the same problem like nemirc, but then I figured that I should edit the Actions of my scene (unselect everything and press F9) instead of editing the actions of my movieclip.
    I did exactly that, but the mouse does not move. Unless it doesn't work in PIE but in PoPC only?

  3. #43
    MSgt. Shooter Person
    Join Date
    Sep 2010
    Posts
    70

    Default

    Well, it works all the time for me, maybe you need to set the Gametype for PIE to your game in Worldproperties of your level?

  4. #44

    Default

    I cant seem to make this thing work either. Currently my code looks like this. When i run my game i cant see the cursor from flash, also the coordinates from Canvas.DrawText doesnt update either and is stuck on 0.0000, 0.0000.

    Code:
    class TDSGFx_Crosshair extends GFxMoviePlayer;
    
    var int MouseX;
    var int MouseY;
    
    function Initialize()
    {
    	Start();
    	Advance(0.0f);
    }
    
    function RecieveMouseCoordinates(float x, float y)
    {
    	MouseX = x;
    	MouseY = y;
    }
    
    
    DefaultProperties
    {
    	bDisplayWithHudOff = false;
    	bEnableGammaCorrection = false;
    
    	MovieInfo = SwfMovie'TopDownShooter.TDSHud';
    }
    Code:
    class TDSHud extends UDKHUD;
    
    var TDSGFx_Crosshair CrosshairMovie;
    
    simulated function PostBeginPlay()
    {
    	super.PostBeginPlay();
    	
    	if(CrosshairMovie == none)
    	{
    		CrosshairMovie = new class'TDSGFx_Crosshair';
    		CrosshairMovie.Initialize();
    	}
    	SizeX = 1024;
    	SizeY = 720;
    }
    singular event Destroyed()
    {
    	if(CrosshairMovie != none)
    	{
    		CrosshairMovie.Close(true);
    		CrosshairMovie = none;
    	}
    	Destroy();
    }
    function Vector2d GetMouseCoords()
    {
    	local Vector2D MouseCoords;
    
    	MouseCoords.X = CrosshairMovie.MouseX;
    	MouseCoords.Y = CrosshairMovie.MouseY;
    
    	return MouseCoords;
    }
    event PostRender()
    {
    	local Vector2D PlayerMouse;
    	local TDSPlayerController TDSPlayer;
    	
    	PlayerMouse = GetMouseCoords();
    
    	Canvas.SetDrawColor(255,255,255,255);
    	
    	Canvas.SetPos(10.0,10.0);
    	Canvas.DrawText("Mouse: X:" $ playerMouse.X $ ", Y:" $ playerMouse.Y);
    }
    
    DefaultProperties
    {
    }
    I got 2 layers in my .fla file, one "actions" and one "scene" and the AS code is posted in the first frame of "actions".

    any suggestions?

    Edit: Ive also tried to change the actionscript to what "srv" suggested but when i do the "startDrag("Crosshair", true);" i get the message "Error: StartDrag of invalid target 'Crosshair'".
    i tried to convert the object i had placed on the scene to a "symbol" movieclip and give it the name "Crosshair" but that didnt change anything.
    Last edited by Tjommi; 02-02-2011 at 04:18 PM.

  5. #45

    Default

    Figured it out. I didnt import my .swf right so the script didnt access it. works now.

  6. #46
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    405

    Default

    I've made my cursor using Doublezer0's mouse cursor class, but I've got a problem.. Since I load my movie on texture, not on hud, I want my mouse to be moved only when I'm around that BSP object. Right now cursor on that screen moves whenever I move, and clicks whenever I click, even if I'm gazillion miles away. How can I change that?

  7. #47
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    You'll need to play with bCaptureMouse in it to get that to happen
    http://www.ericbla.de http://www.dungeondefenders.com http://en.wikipedia.org/wiki/Warm_Gun http://www.rekoil.com http://www.groundbranch.com

    - Please don't send me private messages asking programming questions, those would be better asked on the Programming forum here. Thanks

  8. #48
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    405

    Default

    Adding a bCaptureMouse=false line at the defaultproperties gives me nothing. Same with bIgnoreMouseInput = true.
    Last edited by Kaldrick; 02-15-2011 at 03:05 PM.

  9. #49
    MSgt. Shooter Person
    Join Date
    Feb 2011
    Location
    Ventrilo
    Posts
    158

    Default

    Trying to make this work, but I am not sure what I should edit the error-line to be.

    [0010.34] Log: D:\UDK\UDK-2011-01\Development\Src\UDNExamples\Classes\UDNHud.uc(4 8) : Error, Unrecognized type 'Tds_PlayerController'

    What is Tds_PlayerController?

    Adding some info for easier help =D

    Got my sikte.fla and sikte.swf in: ...UDK-2011-01\UDKGame\Flash\UDNHud
    and the png in UDK-2011-01\UDKGame\Flash\UDNHud\sikte

    UDNHud.uc
    class UDNHud extends UDKHUD;

    var UDNMoviePlayer HudMovie;
    var class<UDNMoviePlayer> HudMovieClass;

    simulated function PostBeginPlay()
    {
    super.PostBeginPlay();

    HudMovie = new HudMovieClass;

    HudMovie.PlayerOwner = Tds_PlayerController(PlayerOwner);
    HudMovie.SetTimingMode( TM_Real );
    HudMovie.SetViewScaleMode( SM_NoScale );
    HudMovie.SetAlignment( Align_BottomCenter );

    HudMovie.Init( HudMovie.PlayerOwner );

    // When using scaleform these seem to be set to 0?
    SizeX = 1280.0f;
    SizeY = 720.0f;
    }

    singular event Destroyed()
    {
    if( HudMovie != none )
    {
    HudMovie.Close( true );
    HudMovie = none;
    }

    super.Destroy();
    }

    function Vector2d GetMouseCoords()
    {
    local Vector2d mousePos;

    mousePos.X = HudMovie.MouseX;
    mousePos.Y = HudMovie.MouseY;

    return mousePos;
    }

    event PostRender()
    {
    local Vector2D playerMouse;
    local Tds_PlayerController tdsPlayer;

    tdsPlayer= Tds_PlayerController(PlayerOwner);
    playerMouse = GetMouseCoords();

    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'UDNMoviePlayer'
    }
    UDNMoviePlayer.uc
    class UDNMoviePlayer extends GFxMoviePlayer;

    var int MouseX;
    var int MouseY;

    function Initialize()
    {
    Start();
    Advance(0.0f);

    //SetFocus( false, true );

    }

    function RecieveMouseCoordinates(float x, float y)
    {
    MouseX = x;
    MouseY = y;
    }


    DefaultProperties
    {
    bDisplayWithHudOff = false;
    bEnableGammaCorrection = false;

    MovieInfo = SwfMovie'UDNHud.sikte';
    }
    Last edited by HadHa; 03-03-2011 at 05:42 PM. Reason: Adding quotes

  10. #50
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    405

    Default

    Change TDS_PlayerController with your PlayerController derived class.

  11. #51
    MSgt. Shooter Person
    Join Date
    Feb 2011
    Location
    Ventrilo
    Posts
    158

    Default

    Quote Originally Posted by Kaldrick View Post
    Change TDS_PlayerController with your PlayerController derived class.
    Im fairly new to unrealscripting (Had a first glance at it 4-5 days ago) -
    Could you be more specific?

    I tried using my UDNPlayerController (which I dont think gives much sense) and the PlayerController from development/source/engine - None of them was really helping.

    Any help would be appreciated.

  12. #52
    MSgt. Shooter Person
    Join Date
    Feb 2011
    Location
    Ventrilo
    Posts
    158

    Default

    Still trying to figure this out.
    Anyone at all?

  13. #53

    Default

    Hi, Sorry to bring up an old thread but does anyone have any working examples for this? Maybe including the Game and PlayerController classes? I've got my flash working separately (using the Scaleform Mouse gem thing) but when I try to include it with my existing scripts it just doesn't seem to work. The X and Y Coordinates are in the top left but nothing actually happens with the mouse and no cursor shows.

    Thanks for your help!

  14. #54
    MSgt. Shooter Person
    Join Date
    Dec 2010
    Posts
    193

    Default

    You could try studying (or even modifying) the UDKFrontEnd flash file that ships with UDK. As I recall the entire mouse thing only requires 2 lines of code or so.

  15. #55

    Default

    Thanks, I've had a go but I still cant get it working. The Flash file I was using was from the Scaleform Mouse gem so I doubt it could be that which was stopping it running correctly.

    All I wanted was to have a mouse button move the player - I had it going last year using tutorials but now I've come back to UDK all the tutorials are out of date.

    EDIT: Is there any bugs with this? I tried using script from http://zombpir8ninja.blogspot.com/20...fixed-hud.html and got it working okay however I changed a few things and broke it so replaced my edited code back to their original one. Now the mouse will not work at all, the cursor just sits there? It was fine about 10 minutes before and I haven't touched the actual flash files?

    EDIT2: Scratch that - I needed to add the following back in:

    mousePos.X = CrosshairMovie.GetVariableNumber("_root._xmouse");
    mousePos.Y = CrosshairMovie.GetVariableNumber("_root._ymouse");

    Last edited by Rosicky; 10-12-2011 at 01:11 PM.

  16. #56

    Default

    It's me again

    Can anyone tell me if there is alot more work needed to get a mouse button working for navigation?

    Hud:
    class BattleMapHUD extends UDKHUD;
    var BattleMapGfxHud CrosshairMovie;
    var class<BattleMapGfxHud> CrosshairMovieClass;
    simulated function PostBeginPlay()
    {
    super.PostBeginPlay();
    if (CrosshairMovie == none)
    {
    CrosshairMovie = new CrosshairMovieClass;
    CrosshairMovie.Initialize();
    }
    SizeX = 1024.0f;
    SizeY = 764.0f;
    }
    singular event Destroyed()
    {
    if( CrosshairMovie != none )
    {
    CrosshairMovie.Close( true );
    CrosshairMovie = none;
    }
    Destroy();
    }
    function vector2D GetMouseCoordinates()
    {
    local Vector2D mousePos;

    mousePos.X = CrosshairMovie.GetVariableNumber("_root._xmouse");
    mousePos.Y = CrosshairMovie.GetVariableNumber("_root._ymouse");

    //mousePos.X = CrosshairMovie.MouseX;
    //mousePos.Y = CrosshairMovie.MouseY;

    return mousePos;
    }
    event PostRender()
    {
    local BattleMapPlayerController bmPlayerController;
    local vector startTrace;
    local Vector endTrace;
    local Vector mouseOrigin;
    local Vector mouseDirection;
    local string StringMessage;
    local Vector pawnEyeLocation;
    local Rotator pawnEyeRotator;

    super.PostRender();
    StringMessage = "";
    bmPlayerController = BattleMapPlayerController(PlayerOwner);
    bmPlayerController.MousePosition = GetMouseCoordinates();
    //Deproject the mouse from screen coordinate to world coordinate and store World Origin and Dir.
    Canvas.DeProject(bmPlayerController.MousePosition, mouseOrigin, mouseDirection);
    if (bmPlayerController.Pawn != none)
    {
    startTrace = bmPlayerController.Pawn.Location;
    startTrace.Z += bmPlayerController.CameraZOffset;
    endTrace = startTrace + (mouseDirection * 5000);
    Trace(mouseOrigin, mouseDirection, endTrace, startTrace, true);
    // laser sight from pawn to reticle
    bmPlayerController.Pawn.GetActorEyesViewPoint(pawn EyeLocation, pawnEyeRotator);
    Draw3DLine(pawnEyeLocation, mouseOrigin, RedColor);
    }
    bmPlayerController.SetMouseOrigin(mouseOrigin);
    StringMessage = "NetMode=" @ WorldInfo.NetMode @ "\nPlayerController=" @ PlayerOwner @ "\nControllerRotation=" @ bmPlayerController.Rotation @ "\nPawn=" @ PlayerOwner.Pawn @ "\nPawnRotation=" @ bmPlayerController.Pawn.Rotation @ "\nPawnEyeRotation=" @ pawnEyeRotator;
    //`Log(StringMessage);
    Canvas.DrawColor = GreenColor;
    Canvas.SetPos( 10, 10 );
    Canvas.DrawText( StringMessage, false, , , TextRenderInfo );
    }
    DefaultProperties
    {
    CrosshairMovieClass = class'BattleMapGfxHud'
    }
    PlayerController:
    class BattleMapPlayerController extends UTPlayerController
    config(Game);
    var int CameraZOffset;
    var Vector2D MousePosition;
    var Vector MouseOrigin;
    simulated function SetMouseOrigin(Vector NewMouseOrigin)
    {
    MouseOrigin = NewMouseOrigin;
    ServerMouseOrigin(NewMouseOrigin);
    }
    reliable server function ServerMouseOrigin(Vector NewMouseOrigin)
    {
    MouseOrigin = NewMouseOrigin;
    }

    // This basically locks the camera to the pawn's location, and adds CameraZOffset to the Z of the camera.
    simulated event GetPlayerViewPoint( out vector out_Location, out Rotator out_Rotation )
    {
    // this right here is just terrible. but after spending days trying to figure out why the server
    // thought the client was in 3rd person, but the client thought it was in 1st, I just hacked it.
    bBehindView = true;
    // let's just ignore all the fancy crap
    if(Pawn == None)
    super.GetPlayerViewPoint(out_Location, out_Rotation);
    else
    out_Location = Pawn.Location;
    out_Location.Z += CameraZOffset;
    out_Rotation = rotator(vect(0,0,-1));
    }

    // Force WASD to be NWSE, so use world rotation instead of pawn rotation
    state PlayerWalking
    {
    function PlayerMove( float DeltaTime )
    {
    local vector X,Y,Z, NewAccel;
    local eDoubleClickDir DoubleClickMove;
    local rotator OldRotation;
    local bool bSaveJump;
    if( Pawn == None )
    {
    GotoState('Dead');
    }
    else
    {
    // Changed this:
    //GetAxes(Pawn.Rotation,X,Y,Z);
    GetAxes(WorldInfo.Rotation,X,Y,Z);
    // Update acceleration.
    NewAccel = PlayerInput.aForward*X + PlayerInput.aStrafe*Y;
    NewAccel.Z = 0;
    NewAccel = Pawn.AccelRate * Normal(NewAccel);
    DoubleClickMove = PlayerInput.CheckForDoubleClickMove( DeltaTime/WorldInfo.TimeDilation );
    // Update rotation.
    OldRotation = Rotation;
    UpdateRotation( DeltaTime );
    bDoubleJump = false;
    if( bPressedJump && Pawn.CannotJumpNow() )
    {
    bSaveJump = true;
    bPressedJump = false;
    }
    else
    {
    bSaveJump = false;
    }
    if( Role < ROLE_Authority ) // then save this move and replicate it
    {
    ReplicateMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation);
    }
    else
    {
    ProcessMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation);
    }
    bPressedJump = bSaveJump;
    }
    }
    }
    // This makes our weapons aim to the pawn's rotation, not the controller's rotation
    function Rotator GetAdjustedAimFor(Weapon W, vector StartFireLoc)
    {
    local Vector pawnEyeLocation;
    local Rotator pawnEyeRotator;
    if(Pawn != None)
    {
    //return Pawn.Rotation;
    Pawn.GetActorEyesViewPoint(pawnEyeLocation, pawnEyeRotator);
    return Rotator(MouseOrigin - pawnEyeLocation);
    }
    else return Rotation;
    }
    // Turn the pawn toward the cursor
    function UpdateRotation( float DeltaTime )
    {
    local Rotator NewRotation, ViewRotation; //DeltaRot
    ViewRotation = Rotation;
    if (Pawn!=none)
    {
    ViewRotation = Rotator(MouseOrigin - Pawn.Location + (Pawn.EyeHeight * vect(0,0,1)));
    Pawn.SetDesiredRotation(ViewRotation);
    }
    //// Calculate Delta to be applied on ViewRotation
    //DeltaRot.Yaw = PlayerInput.aTurn;
    //DeltaRot.Pitch = PlayerInput.aLookUp;
    //ProcessViewRotation( DeltaTime, ViewRotation, DeltaRot );
    //SetRotation(ViewRotation);
    SetRotation(ViewRotation);
    ViewShake( deltaTime );
    NewRotation = ViewRotation;
    NewRotation.Roll = Rotation.Roll;
    if ( Pawn != None )
    Pawn.FaceRotation(NewRotation, deltatime);
    }
    // Make sure our custom HUD is used
    reliable client function ClientSetHUD(class<HUD> newHUDType)
    {
    if ( myHUD != None )
    {
    myHUD.Destroy();
    }
    //myHUD = (newHUDType != None) ? Spawn(newHUDType, self) : None;
    myHUD = (newHUDType != None) ? Spawn(class'BattleMap.BattleMapHUD', self) : None;
    }
    DefaultProperties
    {
    CameraZOffset=480
    }
    GFxMoviePlayer:
    class BattleMapGFxHud extends GFxMoviePlayer;
    var int MouseX;
    var int MouseY;
    function Initialize()
    {
    Start();
    Advance(0.0f);
    }
    // This is called from Flash.
    function ReceiveMouseCoords( float x, float y )
    {
    MouseX = x;
    MouseY = y;
    }
    DefaultProperties
    {
    bDisplayWithHudOff = false

    // Path to your package/flash file here.
    MovieInfo = SwfMovie'MouseInterfaceContent.MouseInterfaceCurso r'
    }
    The mouse works okay for the player rotation although its not central (north and south are out in x), however my main problem now is getting a mouse button to work for movement instead of WASD etc..

    Thanks for the help

  17. #57
    MSgt. Shooter Person
    Join Date
    Apr 2011
    Posts
    97

    Default

    I followed Allar's cursor tutorial and now my mouse works quite fine. Here is the tutorial: http://www.youtube.com/watch?v=6VkP7JgYH4k


    He uses startDrag function but the problem is, mouse lags a bit when imported to UDK. Anything to fix that?


 
Page 2 of 2 FirstFirst 12

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.