How do skills affect damage you can do

i have made a skill script and im going to make a melee magic and ranged script but i want my skills to affect how much damage my attacks can do here is my skill script and i will probably add more skills like smithing along the way but here it is:

var MeleeXP = 0;
var MeleeLevel = 0;
var MeleeLevelMultiplier = 1.5;
var NeededMeleeXP = 100;
var maxMeleeLevel = 99;

var RangedXP = 0;
var RangedLevel = 0;
var RangedLevelMultiplier = 1.5;
var NeededRangedXP = 100;
var maxRangedLevel = 99;

var MagicXP = 0;
var MagicLevel = 0;
var MagicLevelMultiplier = 1.5;
var NeededMagicXP = 100;
var maxMagicLevel = 99;

function Update() {
 MeleeLevelStuff();
 RangedLevelStuff();
 MagicLevelStuff();
}
function MeleeLevelStuff() {
  if(MeleeXP > NeededMeleeXP) {
       print ("You've Past Level" + MeleeLevel);
       MeleeLevel += (1);       
       XP = 0;
       NeededMeleeXP = (NeededMeleeXP * MeleeLevelMultiplier);
       if(MeleeLevel > maxMeleeLevel)
      MeleeLevel = 99; 
      if(MeleeLevel == 99);
           print ("You've Reached The Max Melee Level");
       }
}
function RangedLevelStuff() {
  if(RangedXP > NeededRangedXP) {
       print ("You've Past Level" + RangedLevel);
       RangedLevel += (1);       
       XP = 0;
       NeededRangedXP = (NeededRangedXP * RangedLevelMultiplier);
       if(RangedLevel > maxRangedLevel)
      RangedLevel = 99; 
      if(RangedLevel == 99);
           print ("You've Reached The Max Ranged Level");          
       }
}
function MagicLevelStuff() {
  if(MagicXP > NeededMagicXP) {
       print ("You've Past Level" + MagicLevel);
       RangedLevel += (1);       
       XP = 0;
       NeededMagicXP = (NeededMagicXP * MagicLevelMultiplier);
       if(MagicLevel > maxMagicLevel)
      MagicLevel = 99; 
      if(MagicLevel == 99);
           print ("You've Reached The Max Magic Level");          
       }
} 
function OnGUI()
{
GUI.Label (Rect (20, 45, 100, 20), "Range" );
 GUI.Label (Rect (20, 60, 100, 20), RangedLevel + "/" + maxRangedLevel);
 GUI.Label (Rect (10, 5, 100, 20), "Strength" );
   GUI.Label (Rect (20, 20, 100, 20), MeleeLevel + "/" + maxMeleeLevel);
   GUI.Label (Rect (20, 80, 100, 20), "Magic" );
 GUI.Label (Rect (20, 95, 100, 20), MagicLevel + "/" + maxMagicLevel);   
   }

i dont know how to go along making it so the skills affect how much damage can be done please just help i would make my own melee script just show me how i would go along doing so thank you to anyone that helps

You need to come up with some kind of relationship between the Melee level and the damage you want the player to be doing. That is entirely game dependent. But for example, say you want the player to do 10 points of damage plus 1 point of extra damage per every 2 melee levels. You would have a function something like this:

function int GetDamage() {
    return (10 + MeleeLevel/2);
    }

(I’m a C# programmer, not a UScript programmer, so forgive me if there are syntax errors in there, hopefully you get the idea). I hope that helps.

That’s not your code dealing with damages. That’s the code for leveling up. We need the function called when the weapon strikes / the spell hits.

Anyway, it’s probably going to be along those lines :

function OnHit( Player player )
{
    // A real formula is up to you, I keep it simple here
    life -= player.weapon.damage + player.strength;

    // Other stuffs
}