UOA Crafting Question

I’ve been using UOAbigail’s Crafting System in my module. Documentation on it is sparse so I’ve been figuring it out myself in-game and by reviewing scripts.

My question today is with harvesting. I’ve got a character that mines the Dull, Copper, Iron nodes - However I only ever receive Iron ore. I reviewed the script _dmg_mine_rock which states Iron Ore will always be given unless another condition is met (sorry not great at scripts).

example:

if (sMyTag == “MINE_DULL”)
{
sItemResRef = “ore001”;
sOreType = “Iron”;
if (iMineChance >=650)
{
if (d10(1)>4)
{
sItemResRef = “ore002”;
sOreType = “Dull Copper”;

So it looks like I get IronOre unless I “(d10(1)>4”?

But I’m having a hard time understanding, as I never get anytihng but Iron Ore. I’m missing something - hopefully someone knows!

Thanks.

if(iMineChance >= 650)

This is first in the list of getting Copper. Where in the script is the iMineChance defined?

Looks like near the top of the script:

int iMineChance = GetCampaignInt(“UOACraft”,“iMiningSkill”,oPC);

Entire Script I’m Looking at:

//#include "_persist_01a"

void main()
{
  object oPC = GetLastAttacker(OBJECT_SELF);
  if (oPC==OBJECT_INVALID) oPC = GetLastDamager();
  if (oPC==OBJECT_INVALID) return;
  object oWeapon = OBJECT_INVALID;


  string sMyTag = GetTag(OBJECT_SELF);
  string sItemResRef = "";
  string sOreType = "";
  int iRandom = Random(1000);
  int iSkillGain = 0;
  string sOldSkill = "";
  string sOldSkill2 = "";
  int iTemp = 0;
  int iSuccess = 0;


  oWeapon = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC);
  if (GetTag(oWeapon)!= "MINERS_PICK")
   {
    oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
    if (GetTag(oWeapon)!= "MINERS_PICK")
     {
      FloatingTextStringOnCreature("You must have a pickaxe or a miner's pick equipped in order to mine!",oPC);
      return;
     }
   }
  int iTotalPickUsed = GetLocalInt(oWeapon,"iPickUsed");
  //int iMineChance = GetTokenPair(oPC,14,1);
  int iMineChance = GetCampaignInt("UOACraft","iMiningSkill",oPC);

  if (iMineChance < 350)
   {
    iTemp = GetAbilityScore(oPC,ABILITY_STRENGTH)*5;
    iTemp = iTemp + (GetAbilityScore(oPC, ABILITY_INTELLIGENCE)*2);
    iTemp = iTemp + (GetAbilityScore(oPC,ABILITY_DEXTERITY)*3);
    iTemp = iTemp*3;
    if (iTemp >350) iTemp = 350;
   }

  if (iMineChance > iTemp)
    {
     if (iRandom <= iMineChance) iSuccess = 1;
    }
   else
    {
     if (iRandom <= iTemp) iSuccess = 1;
    }

  if (iSuccess == 0)
   {
    if (d12(1) == 1)
     {
      switch (d8(1))
       {
        case 1:{FloatingTextStringOnCreature("You dig and find nothing.",oPC,FALSE);break;}
        case 2:{FloatingTextStringOnCreature("Your back aches...",oPC,FALSE);break;}
        case 3:{FloatingTextStringOnCreature("You know there has to be ore here somewhere..",oPC,FALSE);break;}
        case 4:{FloatingTextStringOnCreature("Your arms are tired...",oPC,FALSE);break;}
        case 5:{FloatingTextStringOnCreature("You dig and dig and dig...",oPC,FALSE);break;}
        case 6:{FloatingTextStringOnCreature("Fragments of stone and earth pile up at your feet...",oPC,FALSE);break;}
        case 7:{FloatingTextStringOnCreature("You pause to sharpen your digging tool...",oPC,FALSE);break;}
        default:{FloatingTextStringOnCreature("You dig and dig some more...",oPC,FALSE);break;}
       }
     }
    return;
   }

  int iRemaining = GetLocalInt(OBJECT_SELF,"iRemaining");
  if (iRemaining==0)
   {
    iRemaining = d4(3)+11;
    SetLocalInt(OBJECT_SELF,"iRemaining",iRemaining);
   }
  if (iRemaining==1) return;

  iRandom = Random(1000);
  if (iRandom >= iMineChance)
   {
    if (d10(1)+1 >= iMineChance/100) iSkillGain = 1;
   }

  //Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
      if (iSkillGain ==1)
       {
        if (GetLocalInt(oPC,"iSkillGain")!= 0)
          {
           iSkillGain = 0;
          }
         else
          {
           SetLocalInt(oPC,"iSkillGain",99);
           AssignCommand(oPC,DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0)));
          }
       }


  if (iSkillGain == 1)
   {
    iMineChance++;
    sOldSkill2 = IntToString(iMineChance);
    sOldSkill = "."+GetStringRight(sOldSkill2,1);
    if (iMineChance > 9)
      {
       sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
      }
     else
      {
       sOldSkill = "0"+sOldSkill;
      }
    if (iMineChance <= 1000)
     {
      //SetTokenPair(oPC,14,1,iMineChance);
      SetCampaignInt("UOACraft","iMiningSkill",iMineChance,oPC);
      SendMessageToPC(oPC,"=================================");
      SendMessageToPC(oPC,"Your skill in mining has gone up!");
      SendMessageToPC(oPC,"Current mining skill : "+ sOldSkill+"%");
      SendMessageToPC(oPC,"=================================");
      if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP"));
     }
   }

  if (sMyTag == "MINE_IRON")
   {
    sItemResRef = "ore001";
    sOreType = "Iron";
   }

  if (sMyTag == "MINE_DULL")
   {
    sItemResRef = "ore001";
    sOreType = "Iron";
    if (iMineChance >=650)
     {
      if (d10(1)>4)
       {
        sItemResRef = "ore002";
        sOreType = "Dull Copper";
       }
     }
   }

  if (sMyTag == "MINE_SHADOW")
   {
    sItemResRef = "ore001";
    sOreType = "Iron";
    if (iMineChance >=700)
     {
      if (d10(1)>4)
       {
        sItemResRef = "ore003";
        sOreType = "Shadow Iron";
       }
     }
   }

  if (sMyTag == "MINE_COPPER")
   {
    sItemResRef = "ore001";
    sOreType = "Iron";
    if (iMineChance >=750)
     {
      if (d10(1)>4)
       {
        sItemResRef = "ore004";
        sOreType = "Copper";
       }
     }
   }

  if (sMyTag == "MINE_BRONZE")
   {
    sItemResRef = "ore001";
    sOreType = "Iron";
    if (iMineChance >=800)
     {
      if (d10(1)>4)
       {
        sItemResRef = "ore005";
        sOreType = "Bronze";
       }
     }
   }

  if (sMyTag == "MINE_GOLD")
   {
    sItemResRef = "ore001";
    sOreType = "Iron";
    if (iMineChance >=850)
     {
      if (d10(1)>4)
       {
        sItemResRef = "ore006";
        sOreType = "Gold";
       }
     }
   }

  if (sMyTag == "MINE_AGAPITE")
   {
    sItemResRef = "ore001";
    sOreType = "Iron";
    if (iMineChance >=900)
     {
      if (d10(1)>4)
       {
        sItemResRef = "ore007";
        sOreType = "Agapite";
       }
     }
   }

  if (sMyTag == "MINE_VERITE")
   {
    sItemResRef = "ore001";
    sOreType = "Iron";
    if (iMineChance >=950)
     {
      if (d10(1)>4)
       {
        sItemResRef = "ore008";
        sOreType = "Verite";
       }
     }
   }

  if (sMyTag == "MINE_VALORITE")
   {
    sItemResRef = "ore001";
    sOreType = "Iron";
    if (iMineChance >=990)
     {
      if (d10(1)>4)
       {
        sItemResRef = "ore009";
        sOreType = "Valorite";
       }
     }
   }

  if (sMyTag == "MINE_SILVER")
   {
    sItemResRef = "ore001";
    sOreType = "Iron";
    if (iMineChance >=770)
     {
      if (d10(1)>4)
       {
        sItemResRef = "ore010";
        sOreType = "Silver";
       }
     }
   }

  if (sMyTag == "MINE_MITHRIL")
   {
    sItemResRef = "ore001";
    sOreType = "Iron";
    if (iMineChance >=950)
     {
      if (d10(1)>4)
       {
        sItemResRef = "ore011";
        sOreType = "Mithril";
       }
     }
   }

   if (sMyTag == "MINE_ADAMANTITE")
   {
    sItemResRef = "ore001";
    sOreType = "Iron";
    if (iMineChance >=990)
     {
      if (d10(1)>4)
       {
        sItemResRef = "ore012";
        sOreType = "Adamantite";
       }
     }
   }

  if (sMyTag == "MINE_PLATINUM")
   {
    sItemResRef = "ore001";
    sOreType = "Iron";
    if (iMineChance >=900)
     {
      if (d10(1)>4)
       {
        sItemResRef = "ore013";
        sOreType = "Platinum";
       }
     }
   }

  if (sMyTag == "_UOA_DepositofCoal")
   {
    sItemResRef = "item_coal";
    sOreType = "Lump of Coal";
    //if (iMineChance >=900)
    // {
    //  if (d10(1)>4)
    //   {
    //    sItemResRef = "ore013";
    //    sOreType = "Platinum";
    //   }
    // }
   }






  CreateItemOnObject(sItemResRef,oPC,1);
  iRemaining=iRemaining-1;
  SetLocalInt(OBJECT_SELF,"iRemaining",iRemaining);
  if (iRemaining==1)
   {
    ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(1000,DAMAGE_TYPE_MAGICAL,DAMAGE_POWER_NORMAL),OBJECT_SELF);
   }

  if (sOreType!="Lump of Coal")
    {
     FloatingTextStringOnCreature("You dig up some "+sOreType+" ore.",oPC,FALSE);
    }
   else
    {
     FloatingTextStringOnCreature("You dig up a "+sOreType+".",oPC,FALSE);
    }
  if (Random(1000)<=50)
   {
    int iGemType = 1;
    int iCount = 5;
    for (iCount; iCount>0; iCount--)
     {
      if (Random(1000)>200) break;
      iGemType++;
     }
    CreateItemOnObject("gemstone00"+IntToString(iGemType),oPC,1);
    AssignCommand(oPC,DelayCommand(1.0,FloatingTextStringOnCreature("... and an unknown gemstone.",oPC,FALSE)));
   }
  //AssignCommand(oPC,DelayCommand(1.5,ClearAllActions()));

  // ensure "iSkillGain" oPC variable is not perma-set to 99 thus preventing all skill gains
  if (GetLocalInt(oPC,"iSkillGain")!=0) AssignCommand(oPC,DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0)));

  iTotalPickUsed++;
  if (iTotalPickUsed >100)
    {
     FloatingTextStringOnCreature("Your pick has broken while digging..",oPC,FALSE);
     DestroyObject(oWeapon);
     iTotalPickUsed = 0;
    }
   else
    {
     SetLocalInt(oWeapon,"iPickUsed",iTotalPickUsed);
    }
}

I found UOA and opened it up. It looks like this is your Mining skill. The system takes your skill and compares it to a base chance of 350 out of 1000. Then it compares it against 1000 again for a random chance. Once you get to Dull Mine, you need a score above 650 to get a 6 out of 10 chance for copper. Without actually crunching the numbers, you need to mine quite a bit until it might produce dull copper.

Yeah I’m going to need to tweak them a bit I think.

I guess I need to figure out what in-game would reflect the chance #. I can only see my skill level in game, and that tells me my mining is skill level 24.8.

Maybe the original values are way out of place? I adjusted the Dull Node from 350 down to 24, and I now get Dull Copper every now and then. I’m only at mining skill level 24.8 as mentioned, and that appears to mean I’m 24% completed with leveling the Mining skill. I can’t see how I would ever reach 350 let alone the higher chances for the harder nodes.

int iMineChance = GetCampaignInt(“UOACraft”,“iMiningSkill”,oPC);

So if I understand correctly, it pulls the value stored in the database iMiningSkill which for me in-game = 24

Might there be an additional value for “UOACraft” in that code that it’s adding onto iMiningSkill? Or might that ust be the reference location in the DB that houses iMiningSkill?

For help with formatting code, see here. Note the June 2018 update.

2 Likes

I am thinking your 24 is actually 240 in the programming, so you were only 11% away from acquiring the copper in your mining.

Ugh that makes so much more sense… Thanks.