Experience Points + Level up for RPG?

I need your help.

do you know how to make a script for Xp and how to make each level up add variables to the character status so for ex.

LEVEL UP

  • magic
  • armor
  • item lvl (for items that require a lvl)

Make XP a member variable of the character script. Then increase that value when appropriate and alter other variables when the character level ups.

pseudocode:

var currentXP = 0;
var nextLevelUp = 100;

gainExperience(int amount)
{
    currentXP += amount;
    if (currentXP >= nextLevelUp)
    {
        levelUp();
    }
}

levelUp()
{
    nextLevelUp += 100;
    maxHealth += 10;
}

See the tutorials: Burg Arcade Zerg, he teaches how to create an RPG that and also complete step-by-step check out this link:

http://www.burgzergarcade.com/hack-slash-rpg-unity3d-game-engine-tutorial

  1. Unity3d Tutorial - Character Statistics 1/7
  2. Unity3d Tutorial - Character Statistics 2/7
  3. Unity3d Tutorial - Character Statistics 3/7
  4. Unity3d Tutorial - Character Statisics 4/7
  5. Unity3d Tutorial - Character Statisics 5/7
  6. Unity3d Tutorial - Character Statisics 6/7
  7. Unity3d Tutorial - Character Statisics 7/7

in this case is easier just to watch your lvl and experience also having an "available status points" variable

    var currentXP =0;
    var currentLVL=1;
    var maxHealth=0;
    var maxMagic=0;

    //most RPG games use formulas to get the next lvl experience, thats why each lvl you need more experience
    newExperience(int exp)
    {
       currentXP+=exp;
       if(currentXP >= nextLvlExp(currentLVL))
       {
          currentLVL+=1;
          getNewStats();
       }
    }

   getNewStats()
   {
       getHealth(currentLVL);
       getMagic(currentLVL);
   }

   getHealth(int lvl)
   {
      //this is an example it will be 42 lvl1, 50 lvl2, 58 lvl3, 72 lvl4, etc...
      maxHealth = 40 + lvl*lvl*2;
   }

   getMagic(int lvl)
   {
      //some games depend on lvl + magic stats(or intelligence) + items
      maxMagic = 10 + lvl*lvl + stats.magic*3 + gear.weapon.magic*2;
   }

   //trying to equip an item is verified on the moment you try to use it
   newGear(gear item)
   {
      if(item.minLvl < currentLVL)
      {
         //if cannot be equipped dont allow the usage of the item
         denyNewGear();
      }
   }

this is common scripting on RPG games, hopes this helps you