Custom resource not shown on craft. [RUNUO 2.6]

Mikthebug

Citizen
Oct 29, 2018
5
0
1
So im making some custom crafting resources and everything works up untill i craft them and i dont get the "valorite plate arms" thing i only get "plate arms".

BaseArmor.cs

C#:
            switch ( m_Resource )
            {
                case CraftResource.DullCopper:        oreType = 1053108; break; // dull copper
                case CraftResource.ShadowIron:        oreType = 1053107; break; // shadow iron
                case CraftResource.Copper:            oreType = 1053106; break; // copper
                case CraftResource.Bronze:            oreType = 1053105; break; // bronze
                case CraftResource.Gold:            oreType = 1053104; break; // golden
                case CraftResource.Agapite:            oreType = 1053103; break; // agapite
                case CraftResource.Verite:            oreType = 1053102; break; // verite
                case CraftResource.Valorite:        oreType = 1053101; break; // valorite
                case CraftResource.Mythril:        oreType = 0; break; //Mythril [COLOR=rgb(184, 49, 47)]//if i change to "Mythril" insted of 0 i get a script error[/COLOR]
                case CraftResource.SpinedLeather:    oreType = 1061118; break; // spined
                case CraftResource.HornedLeather:    oreType = 1061117; break; // horned
                case CraftResource.BarbedLeather:    oreType = 1061116; break; // barbed
                case CraftResource.RedScales:        oreType = 1060814; break; // red
                case CraftResource.YellowScales:    oreType = 1060818; break; // yellow
                case CraftResource.BlackScales:        oreType = 1060820; break; // black
                case CraftResource.GreenScales:        oreType = 1060819; break; // green
                case CraftResource.WhiteScales:        oreType = 1060821; break; // white
                case CraftResource.BlueScales:        oreType = 1060815; break; // blue
                default: oreType = 0; break;
            }
 

Falkor

Squire
Apr 11, 2018
298
105
43
wpshard.com
Shard Name
Whispering Pines
There are quite a few edits required to integrate a custom resource. Attached is a merged ResourceInfo.cs (in /Scripts/Misc) to show much is required in just this file to add the OWLTR resources. Adding one custom or all is the same work!

To top it off, I can't remember if there was another edit required elsewhere to make it accept a string (changing a type to TextDefinition) as well as the cliloc number like the default materials use.

In BaseArmor.cs the OWLTR system comments out the entire switch block and replaces it with a lookup of these values.

Code:
        public override void AddNameProperty(ObjectPropertyList list)
        {
        //daat99 OWLTR start - add custom resources to name
            string oreType = CraftResources.GetName(m_Resource);
            int level = CraftResources.GetIndex(m_Resource) + 1;
            //int oreType;

            /*switch ( m_Resource )
            {
                case CraftResource.DullCopper: oreType = 1053108; break; // dull copper
                case CraftResource.ShadowIron: oreType = 1053107; break; // shadow iron
                case CraftResource.Copper: oreType = 1053106; break; // copper
                case CraftResource.Bronze: oreType = 1053105; break; // bronze
                case CraftResource.Gold: oreType = 1053104; break; // golden
                case CraftResource.Agapite: oreType = 1053103; break; // agapite
                case CraftResource.Verite: oreType = 1053102; break; // verite
                case CraftResource.Valorite: oreType = 1053101; break; // valorite
                case CraftResource.SpinedLeather: oreType = 1061118; break; // spined
                case CraftResource.HornedLeather: oreType = 1061117; break; // horned
                case CraftResource.BarbedLeather: oreType = 1061116; break; // barbed
                case CraftResource.RedScales: oreType = 1060814; break; // red
                case CraftResource.YellowScales: oreType = 1060818; break; // yellow
                case CraftResource.BlackScales: oreType = 1060820; break; // black
                case CraftResource.GreenScales: oreType = 1060819; break; // green
                case CraftResource.WhiteScales: oreType = 1060821; break; // white
                case CraftResource.BlueScales: oreType = 1060815; break; // blue
                case CraftResource.OakWood: oreType = 1072533;  break; // oak
                case CraftResource.AshWood: oreType = 1072534; break; // ash
                case CraftResource.YewWood: oreType = 1072535; break; // yew
                case CraftResource.Heartwood: oreType = 1072536; break; // heartwood
                case CraftResource.Bloodwood: oreType = 1072538; break; // bloodwood
                case CraftResource.Frostwood: oreType = 1072539; break; // frostwood
                default: oreType = 0; break;
            }*/
Your best bet is to grab the OWLTR package and use its install instructions as a template for adding your material(s).
 

Attachments

Mikthebug

Citizen
Oct 29, 2018
5
0
1
Thanks Falkor for your answer.

I did a scan of the scripts again and saw what i missed it was in the BaseArmor.cs
I forgot to comment out the section that normaly handles the material info.

C#:
//Hank's Custom Leather Code
    public override void AddNameProperty(ObjectPropertyList list)
     {
       string resourceName = CraftResources.GetName(m_Resource);

       if (string.IsNullOrEmpty(resourceName) || resourceName.ToLower() == "none" || resourceName.ToLower() == "normal" || resourceName.ToLower() == "iron")
  resourceName = "";
     
       list.Add(1053099, ((m_Quality == ArmorQuality.Exceptional) ? "Exceptional " : "") + "{0}\t{1}", resourceName, GetNameString());
     }
/*  public override void AddNameProperty(ObjectPropertyList list)
  {
  int oreType;
       string oreName;

  switch ( this.m_Resource )
  {
  case CraftResource.DullCopper:
  oreType = 1053108;
  break; // dull copper
  case CraftResource.ShadowIron:
  oreType = 1053107;
  break; // shadow iron
  case CraftResource.Copper:
  oreType = 1053106;
  break; // copper
  case CraftResource.Bronze:
  oreType = 1053105;
  break; // bronze
  case CraftResource.Gold:
  oreType = 1053104;
  break; // golden
  case CraftResource.Agapite:
  oreType = 1053103;
  break; // agapite
  case CraftResource.Verite:
  oreType = 1053102;
  break; // verite
  case CraftResource.Valorite:
  oreType = 1053101;
  break; // valorite
  case CraftResource.SpinedLeather:
  oreType = 1061118;
  break; // spined
  case CraftResource.HornedLeather:
  oreType = 1061117;
  break; // horned
  case CraftResource.BarbedLeather:
  oreType = 1061116;
  break; // barbed
  case CraftResource.RedScales:
  oreType = 1060814;
  break; // red
  case CraftResource.YellowScales:
  oreType = 1060818;
  break; // yellow
  case CraftResource.BlackScales:
  oreType = 1060820;
  break; // black
  case CraftResource.GreenScales:
  oreType = 1060819;
  break; // green
  case CraftResource.WhiteScales:
  oreType = 1060821;
  break; // white
  case CraftResource.BlueScales:
  oreType = 1060815;
  break; // blue
  case CraftResource.OakWood:
  oreType = 1072533;
  break; // oak
  case CraftResource.AshWood:
  oreType = 1072534;
  break; // ash
  case CraftResource.YewWood:
  oreType = 1072535;
  break; // yew
  case CraftResource.Heartwood:
  oreType = 1072536;
  break; // heartwood
  case CraftResource.Bloodwood:
  oreType = 1072538;
  break; // bloodwood
  case CraftResource.Frostwood:
  oreType = 1072539;
  break; // frostwood
  default:
  oreType = 0;
  break;
  }

  if (this.m_Quality == ArmorQuality.Exceptional)
  {
  if (oreType != 0)
  list.Add(1053100, "#{0}\t{1}", oreType, this.GetNameString()); // exceptional ~1_oretype~ ~2_armortype~
  else
  list.Add(1050040, this.GetNameString()); // exceptional ~1_ITEMNAME~
  }
  else
  {
  if (oreType != 0)
  list.Add(1053099, "#{0}\t{1}", oreType, this.GetNameString()); // ~1_oretype~ ~2_armortype~
  else if (this.Name == null)
  list.Add(this.LabelNumber);
  else
  list.Add(this.Name);
  }
  }
*/
I got most of the info on how to do this from a really good guide by a guy named Hank Custom leather guide which should be pined tbh. And it seems to work for the other materials as well if you are careful and think about what they are used for.
 

Attachments