Author Topic: Blacksmith  (Read 334 times)

Legacy_Werkaldegim

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Blacksmith
« on: March 16, 2012, 07:23:49 pm »


               Hi everyone,

I have an idea, but there is a little problem with scripting... as always '<img'>
So, for example:
we have, let's say, Dark Iron Longsword, it is has to be made by us in a forge from other items. Prerequisites are not the problem, but, how to get this item with other name if we are much more advanced in weaponsmithing?

We have this Dark Iron Longsword in pallet, but our guy is very good in blacksmithing and when he make it, it takes an [Specialist] Dark Iron Longsword. I hope you understand a clue.



Sorry for my bad english '<img'>
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Blacksmith
« Reply #1 on: March 16, 2012, 07:47:53 pm »


               Use the GetName and SetName functions as part of your forge script.

The new sword that comes out can have different names relative to quality. HEre's some pseudo code:

object oWeapon ; // this is the weapon that we just created.
int nQuality; // this is the measure of how good the forging was
string sWeaponName = GetName(oWeapon); // name of the existing weapon

switch(nQuality)
{
    case 0:
    sWeaponName = "[Low Quality] "+sWeaponName;
    break;
    case 1:
    case 2:
    case 3:
    // average quality. no need to rename
    break;
    case 4:
    sWeaponName = "[High Quality] "+sWeaponName;
    break;
}

SetName(oWeapon, sWeaponName);
               
               

               
            

Legacy_Werkaldegim

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Blacksmith
« Reply #2 on: March 16, 2012, 10:59:32 pm »


               Thank you very much, this is exactly what I looking for '<img'>
               
               

               
            

Legacy_Werkaldegim

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Blacksmith
« Reply #3 on: March 17, 2012, 01:40:10 am »


               And now is the other problem, how to connect it with database, if your skill is > 10 item level difficulty is [Good], if >20 [Very Good] etc.?

I tried this way, but doesn't work corectly:

void ForgeItem(string sItemToCreate, object oTarget)
{
   CreateItemOnObject(sItemToCreate, oTarget);

   object oWeapon = GetObjectByTag(sItemToCreate);
   int nQuality;
   int nPWS = GetPlayerWeaponsmith(oTarget);
   string sWeaponName = GetName(oWeapon);

   switch(nQuality)
   {
   case 0:
   {
   if(nPWS >= 20)
       {
       sWeaponName = "[Very Good]"+sWeaponName;
       SetName(oWeapon, sWeaponName);
       IPSetWeaponEnhancementBonus(oWeapon, 2);
       }
   }
   break;
   case 1:
   {
   if(nPWS >= 10)
       {
       sWeaponName = "[Good]"+sWeaponName;
       SetName(oWeapon, sWeaponName);
       IPSetWeaponEnhancementBonus(oWeapon, 1);
       }
   }
   break;
   }
   SetPlayerWeaponsmith(oTarget);

}
               
               

               


                     Modifié par Werkaldegim, 17 mars 2012 - 02:12 .
                     
                  


            

Legacy_Werkaldegim

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Blacksmith
« Reply #4 on: March 18, 2012, 01:45:36 pm »


               Ok finaly I figured it out, but I have another question '<img'>
It's a little change of topic, but just a little bit. It's still connected '<img'>
Is it possible to make Custom Tokens this way, to change color of sentence and a chance to make it depending on player Weaponsmith skill?

e.g.

Hello what weapon would you like to make?
- Longsword (green) 100%
- Iron Longswodr (blue) 50%
- Dragon Longsword (red) 10%