RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Skill bonus on crafted items

rradicob

Sorceror
I'm trying to make it so that a crafted item will have a skill bonus included in it's attributes.

I'm pretty sure that I need to add it to somewhere in these lines [Scripts\Misc\ResourceInfo...starting on line 49]. I'm using 2.1, I think this file was called OreInfo in earlier versions.

But I'm not sure how to script it properly.
I've tried: public int WeaponSkillBonuses{ get{ return m_AosSkillBonuses; } set{ m_AosSkillBonuses = value; } }
and public int WeaponSkillBonuses{ get{ return weap.m_WeaponAosSkillBonuses; } set{ weap.m_WeaponAosSkillBonuses = value; } }

Then under say, ShadowIron I add this line: shadowIron.WeaponSkillBonuses.SetValues( 0, SkillName.Magery, 10.0 );

My first attempt gives this error message: The name 'm_AosSkillBonuses' does not exist in the current
context
My second gives this: The name 'weap' does not exist in the current context

I've search through the BaseWeapon and BaseArmor files but I can't seem to get this right.
 

evany

Sorceror
I'm trying to make it so that a crafted item will have a skill bonus included in it's attributes.

I'm pretty sure that I need to add it to somewhere in these lines [Scripts\Misc\ResourceInfo...starting on line 49]. I'm using 2.1, I think this file was called OreInfo in earlier versions.

But I'm not sure how to script it properly.
I've tried: public int WeaponSkillBonuses{ get{ return m_AosSkillBonuses; } set{ m_AosSkillBonuses = value; } }
and public int WeaponSkillBonuses{ get{ return weap.m_WeaponAosSkillBonuses; } set{ weap.m_WeaponAosSkillBonuses = value; } }

Then under say, ShadowIron I add this line: shadowIron.WeaponSkillBonuses.SetValues( 0, SkillName.Magery, 10.0 );

My first attempt gives this error message: The name 'm_AosSkillBonuses' does not exist in the current
context
My second gives this: The name 'weap' does not exist in the current context

I've search through the BaseWeapon and BaseArmor files but I can't seem to get this right.

You can use this in CraftItem.cs under Engines/Craft/Core:

Code:
SkillBonuses.SetValues( 0, SkillName.Archery, 4 );

For example, under OnCompleteCraft:

Code:
if( typeRes == typeof( DullCopperOre ) || typeRes == typeof( DullCopperIngot ) )
{
    if( item is BaseWeapon )
        ((BaseWeapon)item).SkillBonuses.SetValues( 0, SkillName.Archery, 4 );
    else if( item is BaseArmor )
        ((BaseArmor)item).SkillBonuses.SetValues( 0, SkillName.Archery, 4 );
}
else if...

Didn't test the code, but this is more or less what you're looking for.
 

rradicob

Sorceror
Thank you for the help. It compiled without errors but it's not working. I can craft a DullCopper weapon or armor but it does not have the skill bonus.

I put the code you gave me into CraftItem, starting on line 17.


Code:
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Factions;
using Server.Mobiles;
using Server.Commands;
 
namespace Server.Engines.Craft
{
    public enum ConsumeType
    {
        All, Half, None
    }
   
    if( typeRes == typeof( DullCopperOre ) || typeRes == typeof( DullCopperIngot ) )
{
    if( item is BaseWeapon )
        ((BaseWeapon)item).SkillBonuses.SetValues( 0, SkillName.Archery, 4 );
    else if( item is BaseArmor )
        ((BaseArmor)item).SkillBonuses.SetValues( 0, SkillName.Archery, 4 );
}
 
 
    public interface ICraftable
    {
        int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue );
    }
 

evany

Sorceror
Thank you for the help. It compiled without errors but it's not working. I can craft a DullCopper weapon or armor but it does not have the skill bonus.

I put the code you gave me into CraftItem, starting on line 17.


Code:
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Factions;
using Server.Mobiles;
using Server.Commands;
 
namespace Server.Engines.Craft
{
    public enum ConsumeType
    {
        All, Half, None
    }
 
    if( typeRes == typeof( DullCopperOre ) || typeRes == typeof( DullCopperIngot ) )
{
    if( item is BaseWeapon )
        ((BaseWeapon)item).SkillBonuses.SetValues( 0, SkillName.Archery, 4 );
    else if( item is BaseArmor )
        ((BaseArmor)item).SkillBonuses.SetValues( 0, SkillName.Archery, 4 );
}
 
 
    public interface ICraftable
    {
        int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue );
    }

It wont affect the item there. Try put in it inside "CompletedCraft", after the item is made. Around line 1175.
 

rradicob

Sorceror
Sorry to ask for more help on this...

I've been trying since Wed. to get multiple skill bonuses to work (on one item) and it either results in error messages or only the last bonus being added to the item.

I know I've seen a post somewhere that explained how to do this properly but I cannot find it again.
 

evany

Sorceror
Try changing the number in red acordingly:

((BaseWeapon)item).SkillBonuses.SetValues( 0, SkillName.Archery, 4 );

Like:

((BaseWeapon)item).SkillBonuses.SetValues( 1, SkillName.Archery, 4 );
((BaseWeapon)item).SkillBonuses.SetValues( 2, SkillName.Archery, 4 );
((BaseWeapon)item).SkillBonuses.SetValues( 3, SkillName.Archery, 4 );

When you need to know something in particular, use the RunUo documents that come with the server. They will help you a lot:

void SetValues( int index, SkillName skill, double bonus )
 
Top