Results 1 to 3 of 3
  1. #1

    Question Need advices on MeleeComboSystem, tracing blade & synchronization.

    Hi all. I'm working on online slasher project and now im writing a combat system.
    I'm not going to talk about how to make the weapons, it was discussed on the forum many times.
    To store the names of animations, I wrote a simple class:
    Code:
    class CAAnimInfo extends Object;
    var array<name> Anims;
    var int animIndex;
    var int animCount;
    
    function addAnim(name animName)
    {
     Anims[animCount]=animName;
     animCount++;
    }
    function name getCurrentAnimName()
    {   
     
     if (!(Anims.Length==0)) {
     `log("Current anim name is "@Anims[animIndex]);
    
     animIndex = (animIndex + 1)%Anims.Length;
     return Anims[animIndex];
     }
     else return '';
    }
    
    function name getLastAnimName()
    {   
     if (!(Anims.Length==0)) 
     {
      return Anims[animIndex];
     }
     else return '';
    }
    function bool   availableNext()
    {
     if(animIndex == Anims.Length || Anims.Length==0)
      return false;
     return true;
    }
    function resetIndex()
    {
     animIndex = 0;
    }
    
    DefaultProperties
    {
     animCount=0;
     animIndex=0;
    }
    Such objects (not one) attached to the Weapon and are selected as the current combo.

    I had an idea to implement the notification of the beginning of the trace through the blade AnimNotify_Script.
    I added a Notify Anim Sequence

    and wrote in my Pawn :
    Code:
    simulated  event  MeleeStartTrace()
    {
    	`log("starttrace");
             DoStaff(); 
    }
    But this function is never called. What am I doing wrong?
    My second issue:
    How can I write an algorithm to execute series of attacks?
    My version of algorithm:
    Code:
    function Attack(byte FireModeNum)
    {
    
    	attackQueue++;
    	if (!bIsAttack)
    	{
    		bIsAttack = true;
    		PlayComboAnims();
    	}
    }
    
    simulated function PlayComboAnims()
    {  
    	local float animTime;
    	
    if (attackQueue>0)
    	{
    		animTime   = CAPawn(Instigator).PlayCustomAnim( Anims.getCurrentAnimName(),0.08f,false,,0.08f,false );
    		attackQueue--;
    	}
    	else 
    	{
    		stopAttack();
    	}
    
    if (Anims.availableNext())
    {
    			
    			SetTimer(animTime, false,'PlayComboAnims' );
    			SetTimer(animTime+0.1f,false,'resetCombo');
    			
    }
    else
          {
    			SetTimer(animTime,false,'stopAttack');
    		
    			attackQueue=0;
    			resetCombo();
    			
         }
    
    }
    
    function stopAttack()
    {
    	bIsAttack = false;
    }
    
    function resetCombo()
    {
    	if (attackQueue==0)
    	{
    		Anims.resetIndex();
    		stopAttack();
    	
    	}
    }
    But it ugly. Anybody got some ideas?


    Sorry for my english
    Last edited by Dcow; 07-11-2012 at 09:13 AM.

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

    Default

    Hey, for me the Tutorial at https://sites.google.com/a/mavrikgam...utorial-part-1 to get a full working sword system for the player.

  3. #3

    Default

    You've got the right idea with an AttackQueue, but you're going to need to store more information than just how many attacks...for example, eventually if you want a backslash, stab, etc. then you need a different identifier for each one. A better idea would be to have a dynamic array as a queue, each element storing the attack type.

    And also it depends how you set up the attack sequences. You could blend from stab anim to slash anim, but you could also make a composite stab + slash anim. In this case the attackqueue you have now would also run into problems.
    Need an online game service for your project? Check out Sagittarius! For more info you can visit the Sagittarius Wiki or the project page on my blog.

    My Blog: WillyG Productions - Your Premiere UDK Resource
    My YouTube Channel: WillyG Productions
    My Facebook Page: WillyG Productions
    My GitHub: willyg302


 

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.