Results 1 to 15 of 15
  1. #1

    Post UDK Melee Weapon Video Tutorial

    Hi everyone,

    I made a tutorial on how to make a melee weapon in UDK using trace sockets. I thought it would be good to post it here so everyone can look at it, it's a video as well as having a PDF companion to it.

    It tells you:
    • How to rig the model in blender
    • Export it as an FBX
    • Import it into UDK
    • Setting it up in UDK
    • Scripting the melee weapon with X-Editor


    Here is the Video:


    The PDF Companion:
    http://draxov.com/UDKMeleeWeaponTutorial.pdf

    The Programs used in this are all free and license free as well:
    Blender 2.63a - http://www.blender.org/dl/http://dow...lender2.63/ble...
    UDK May 2012 - http://download.udk.com/UDKInstall-2012-05-BETA.exe
    Unreal X-Editor - http://unrealxeditor.wordpress.com/downloads/

    Also if you wish to download the files used, they are here - http://draxov.com/UDKMeleeWeaponTutorial.zip

    Please enjoy and give me any feedback you can. Thanks for reading!
    Last edited by draxov; 06-24-2012 at 08:08 AM.

  2. #2
    MSgt. Shooter Person
    Join Date
    Feb 2012
    Posts
    265

    Default

    A helpful tutorial for the users who don't like text. Good work on it, I'm happy to see it isn't a short video as well,

  3. #3

    Default

    Thanks for the feedback! I'm glad you like the length of it, I was worried it was too long.

  4. #4

    Default

    Thanks for the tutorial, just what I was looking for.

  5. #5

    Default

    Hey Mate i posted on the Youtube version but i try to get you here.
    These errors are a bit odd.

    (79) FinishAnim is not allowed here

    (43) 'IF' is not allowed here

    Thanks man helps a lot!
    Last edited by UbisoftMega; 11-19-2012 at 10:50 PM.

  6. #6
    Redeemer
    Join Date
    Jul 2011
    Location
    London, UK
    Posts
    1,789

    Default

    Quote Originally Posted by UbisoftMega View Post
    Hey Mate i posted on the Youtube version but i try to get you here.
    These errors are a bit odd.

    (79) FinishAnim is not allowed here

    (43) 'IF' is not allowed here

    Thanks man helps a lot!
    I'm pretty sure you've done something wrong, i've watched a bit of his video and the if statements are properly placed inside a function.

  7. #7

    Default

    I had no Idea Blenders FBX export was now compatible with UDK. Thanks, that info alone will help me a great deal.
    Last edited by bluemoon6; 11-20-2012 at 04:08 AM. Reason: missed a spelling error

  8. #8
    Deathless
    Join Date
    May 2012
    Location
    Barcelona
    Posts
    2,167

    Default

    Your code could be 2 times smaller , and accomplish absolutely the same.

    You don't really have to use " ammo " neither " FireStates array " , that's just not needed.
    Last edited by Neongho; 11-20-2012 at 05:48 PM.

  9. #9
    Deathless
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,293

    Default

    good tutorial, nice for anyone that wants to get started on this. just a few pointers:
    - you run a trace from the blade start to end. if the attack is really fast (or the player is experience low framerate) the attack could go right through the enemy and miss him (one frame the sword is before him, next frame it's already past him). consider doing more traces along the blade that instead, go from their current position to their last frame's position (and so, you run a trace along the blade's trajectory instead)
    - if you follow my advice on the previous point consider the following: running traces per tick could be overkill if there's a lot of Pawns attacking on-screen at once. better run a Timer.
    - I find it weird that you remove ammo from the weapon if it hits multiple enemies on the same swing. debatable though

  10. #10

    Default

    Quote Originally Posted by reinrag View Post
    I'm pretty sure you've done something wrong, i've watched a bit of his video and the if statements are properly placed inside a function.
    I really don't want to be a bother but if you wouldn't mind helping me that would be great can you look over my attempted script THANK YOU!

    class BarWeapon extends UTWeapon;

    var array<Actor> HitArray;

    var name StartSocket, EndSocket;

    simulated state WeaponFiring{
    simulated event BeginState ( name PreviousStateName ){
    if ( !HasAmmo(CurrentFireMode ) ) {
    WeaponEmpty();
    Return;
    }

    `LogInv("PreviousStateName:" @ PreviousStateName);

    PlayFireEffects(CurrentFireMode);
    SetTimer(GetFireinterval(CurrentFireMode), false, 'RefireCheckTimer');
    }

    simulated simulated event EndState ( name NextStateName )
    {
    HitArray.Length = 0;
    `LogInv("NextStateName:" @ NextStateName);
    ClearTimer('RefireStateTimer');
    NotifyWeaponFinishedFiring ( CurrentFireMode );
    return;
    }

    simulated function RefireCheckTimer()
    {
    if (bWeaponPutDown);
    `LogInv("Weapon put down requested during fire, put down now");
    PutDownWeapon();
    return;
    }

    if ( ShouldRefire() ){
    HitArray.Length = 0;
    PlayFireEffects(CurrentFireMode);
    SetTimer(GetFireInterval(CurrentFireMode), false, 'RefireCheckTimer');
    }

    HandleFinishedFiring();
    return;
    }

    function Tick( Float DeltaSeconds ){
    local vector Start, End;

    SkeletalMeshComponent(Mesh).GetSocketWorldLocation AndRotation(StartSocket, Start);
    SkeletalMeshComponent(Mesh).GetSocketWorldLocation AndRotation(EndSocket, End);

    WeaponTrace(End, Start);
    }

    simulated event WeaponTrace(vector End, vector Start)
    {
    Local vector HitLocation, Hitnormal;
    local Actor HitActor;

    HitActor = Trace(HitLocation, HitNormal, End, Start, true);

    if (HitActor != none){
    if (HitArray.Find(HitActor) == INDEX_NONE && HitActor.bCanBeDamaged){
    HitActor.TakeDamage(InstantHitDamage[CurrentFireMode], Pawn(Owner).Controller, HitLocation, Velocity * 100.f, class 'Bar_Damage');
    AmmoCount -= ShotCost[CurrentFireMode];
    HitArray.AddItem(HitActor);
    }

    }

    }

    Begin:
    FinishAnim(AnimNodeSequence(SkeletalMeshComponent( Mesh).FindAnimNode(WeaponFireAnim[CurrentFireMode])));

    }



    sorry about the formating i have no idea what im doing
    Last edited by UbisoftMega; 11-21-2012 at 12:15 AM.

  11. #11
    Redeemer
    Join Date
    Jul 2011
    Location
    London, UK
    Posts
    1,789

    Default

    That's the code that you were trying to write, I was right you missed a few bits, hence why you had issues,
    You can download the codes above, that's what I did.
    I would also advice you to go on UDN, and unreal wiki, those two sites should be helpful, I've got some unrealscript videos on youtube, but those may not be helpful to you, at this stage.

    Code:
    class BarWeapon extends UTWeapon;
    
    var array<Actor> HitArray;
    
    var name StartSocket, EndSocket;
    
    simulated state WeaponFiring
    {
        simulated event BeginState( name PreviousStateName )
    	{
            if ( !HasAmmo(CurrentFireMode) ) 
            {
                WeaponEmpty();
                return;   
            }
            
            `LogInv("PreviousStateName:" @ PreviousStateName);
            
            PlayFireEffects(CurrentFireMode);
            SetTimer(GetFireInterval(CurrentFireMode), false, 'RefireCheckTimer');
        }    
        
        simulated simulated event EndState( name NextStateName )
        {
            HitArray.Length = 0;
            `LogInv("NextStateName:" @ NextStateName);
            ClearTimer('RefireCheckTimer');
            NotifyWeaponFinishedFiring( CurrentFireMode );
            return;
        }
        
        simulated function RefireCheckTimer()
        {
            if (bWeaponPutDown)
            {
                `LogInv("Weapon put down requested during fire, put it down now");
                PutDownWeapon();
                return;   
            }
            
            if ( ShouldRefire() )
            {
                HitArray.Length = 0;
                PlayFireEffects(CurrentFireMode);
                SetTimer(GetFireInterval(CurrentFireMode), false, 'RefireCheckTimer');  
            }
            
            HandleFinishedFiring();
            return;
        }
        
        function Tick( FLOAT DeltaSeconds )
    	{
            local vector Start, End;
            
            SkeletalMeshComponent(Mesh).GetSocketWorldLocationAndRotation(StartSocket, Start);
            SkeletalMeshComponent(Mesh).GetSocketWorldLocationAndRotation(EndSocket, End);
            
            WeaponTrace(End, Start);
        }
        
        simulated event WeaponTrace(vector End, vector Start)
        {
            local vector HitLocation, HitNormal;
            local Actor HitActor;
            
            HitActor = Trace(HitLocation, HitNormal, End, Start, true);
            
            if (HitActor != none){
                if (HitArray.Find(HitActor) == INDEX_NONE && HitActor.bCanBeDamaged){
                    HitActor.TakeDamage(InstantHitDamage[CurrentFireMode], Pawn(Owner).Controller, HitLocation, Velocity * 100.f, class'Stick_Damage');
                    AmmoCount -= ShotCost[CurrentFireMode];
                    HitArray.AddItem(HitActor);
                }   
            }
        }
        
        begin:
        FinishAnim(AnimNodeSequence(SkeletalMeshComponent(Mesh).FindAnimNode(WeaponFireAnim[CurrentFireMode])));
    }
    
    
    DefaultProperties
    {
        ShotCost(0)=0
        ShotCost(1)=0
        
        WeaponFireTypes(0)=EWFT_Custom
        WeaponFireTypes(1)=EWFT_Custom
        
        StartSocket = StartSocket
        EndSocket = EndSocket
    
        PlayerViewOffset=(X=20.000000,Y=0.00000,Z=-8.000000)
    
        Begin Object class=AnimNodeSequence Name=MeshSequenceA
            bCauseActorAnimEnd=true
        End Object
    
        Begin Object Name=FirstPersonMesh
            SkeletalMesh=SkeletalMesh'tutorial.SkeletalMesh.SK_Stick'
            FOV=60
            Animations=MeshSequenceA
            AnimSets(0)=AnimSet'tutorial.SkeletalMesh.Cylinder'
            bForceUpdateAttachmentsInTick=True
            Scale=0.9000000
        End Object
    
        Begin Object Name=PickupMesh
            SkeletalMesh=SkeletalMesh'tutorial.SkeletalMesh.SK_Stick'
            Scale=0.9000000
        End Object
    
        WeaponEquipSnd=SoundCue'A_Weapon_Link.Cue.A_Weapon_Link_RaiseCue'
        WeaponPutDownSnd=SoundCue'A_Weapon_Link.Cue.A_Weapon_Link_LowerCue'
        WeaponFireSnd(0)=SoundCue'A_Weapon_RocketLauncher.Cue.A_Weapon_RL_GrenadeFire_Cue'
        WeaponFireSnd(1)=SoundCue'A_Weapon_RocketLauncher.Cue.A_Weapon_RL_GrenadeFire_Cue'
    
        PickupSound=SoundCue'A_Pickups.Weapons.Cue.A_Pickup_Weapons_Shock_Cue'
    
        PivotTranslation=(Y=0.0)
    
        MaxAmmoCount=0
        AmmoCount=0
    
        InventoryGroup=4
    
        bInstantHit=True
        InstantHitDamage(0)=50
        InstantHitDamage(1)=20
        InstantHitMomentum(0)=300
        InstantHitMomentum(1)=500
        InstantHitDamageTypes(0)=Class'Stick_Damage'
        InstantHitDamageTypes(1)=Class'Stick_Damage'
    
        //CrosshairImage=Copy texture from Content Browser
        CrossHairCoordinates=(U=384,V=0,UL=64,VL=64)
    
        FireInterval(0)=1
        FireInterval(1)=1
    
        //<DO NOT MODIFY>
        ArmsAnimSet=AnimSet'tutorial.SkeletalMesh.Cylinder'
        Mesh=FirstPersonMesh
        DroppedPickupMesh=PickupMesh
        PickupFactoryMesh=PickupMesh
        AttachmentClass=Class'Stick_Attach'
    
    }
    Last edited by reinrag; 11-21-2012 at 04:01 AM.

  12. #12
    MSgt. Shooter Person
    Join Date
    Sep 2010
    Posts
    138

    Default

    Not sure if this is still alive?
    Brilliant code and tutorial btw, just awesome!!!

    Just a question, I have a custom class, extending from UT code, and it is 3rd person, any idea how to get the weapon to show?
    When I run the command in UDK I hear the weapon 'arm' but not appear =[

  13. #13
    Redeemer
    Join Date
    Dec 2012
    Location
    Deep in the core of endless energy
    Posts
    1,538

    Default

    There's a boolean called something like bOwnerVisible, bHidden or something like that. Maybe you have to add a 3rd person mesh, check linkgun code for that it's in the defaultproperties.

  14. #14
    MSgt. Shooter Person
    Join Date
    Sep 2010
    Posts
    138

    Default

    Cheers bud, got it working in the end, it was a combo of using the inventory, and something else in the weapons file...
    If I remember what it was ill post the result =]

  15. #15
    Skaarj
    Join Date
    May 2013
    Location
    China
    Posts
    8

    Default

    THX my friend. I am in a plan of making a game using Melee Weapon. What if I wanna make Magic Attack? Just Like ordinary bullet with a animation tree? I wanna to have a discussion with u. Wish your Feedback. Thx


 

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.