how should i go along making a melee system

im making a mmo i have some scripting language knowledge i can make some scripts, anyway how should i go along making a melee system what i thought i should do is make a function OnCollisionEnter and make it so when you press fire1 if an enemy with the tag enemy gets hit with the collider it gets damage taken from it i started a script but got lost can anyone please help

Well for one, you will need a bit more than what you have said unless you already have some of this done ! Here is a good starting point that should at least detect collision, and then notify the enemy that it has been hit by something . . . .

On the Player weapon/hand/etc:

function Update ( ){

   DoAttack  ( ) ;

}

function OnTriggerEnter ( collision : Collision)
{
   if ( collision.collider.tag == "MonsterTag" )
   {

      collision.collider.SendMessage ( "DamageFactor", 83 ) ;
   
   }
}

On the enemy:
class EnemyClass{
   var Health : float = 100 ;
   var Defense : flaot = 1.7 ;
}

var Enemy : EnemyClass ;
function DamageFactor ( damage )
{
   Enemy.Health -= damage * ( Enemy.Defensee / 10 ) ;
}

function Update ( )
{
   //..your update code..
}

As far as adding in multi-combat, you should start with setting up a multi-button press system. I created a basic script to detect multiple presses within X time, located here .

Something to know is that the script resets to 0.5 after every key press. You may or may not want to change that depending on your requirements.

PS: Please bare with me if the script here ( not the link ) doesn’t compile. I just wrote that, and am not near Unity to test compile it, but, it’s so simple that any error should be fixable if even one … Good luck, and let me know if this does not work for you.