Results 1 to 3 of 3

Thread: Need advices on MeleeComboSystem, tracing blade & synchronization.

  1. #1
    Dcow
    Guest

    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

  2. #2
    Arthr702
    Guest
    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
    willyg302
    Guest
    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •