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!

[RunUO 2.0 SVN] Universal Storage Keys

Iraq-

Sorceror
Hm it looks to me like you can try changing:
Code:
entry.Add( new ToolEntry( typeof( Hatchet ), "Lumberjacking", 0, 30, -5, 0 ) );
to
Code:
entry.Add( new ToolEntry( typeof( Hatchet ), new Type[]{ typeof( Axe ), typeof( Hatchet) }, "Lumberjacking", 0, 30, -5, 0 ) );
because that's how Pickaxe does it..

the
Code:
typeof( Hatchet )
is what image will be used, and the
Code:
new Type[]{ typeof( Axe ), typeof( Hatchet) }
is the types of BaseAxe items it will store.


* EDIT: It appears that the reason Hatchet wont store is because, while BaseWeapon has a UsesRemaining property, it does not implement the IUsesRemaining interface. Take a look at Pickaxe.cs where it says
Code:
public class Pickaxe : BaseAxe, IUsesRemaining
while Hatchet.cs says only
Code:
public class Hatchet : BaseAxe
 

sexylady

Sorceror
ok the hatch will go in but the axe what itt say that quantity cannot fit in this
 

Attachments

  • ToolKey.cs
    3.3 KB · Views: 4
  • Axe.cs
    1.4 KB · Views: 5
  • Hatchet.cs
    1.4 KB · Views: 3

sexylady

Sorceror
i got the hatchet and axe to go in but when i what to take 100 out eg it say there was an error creating that item. please page gm
 

prplbeast

Sorceror
if you can"t find it.. you can always just go crazy with null checks..

make sure the store that you're calling the FillFromBackpack( from, false ) isn't null, make sure from isn't null, make sure the from has a backpack.. etc.
Could u give an example?
 

Iraq-

Sorceror
Could u give an example?
Yes, looking at the CrashLog.txt you posted a few posts up I've gone in and altered my MasterKey class's FindConsumableEntry( Type[], int ) method to the following:
Code:
public StoreEntry FindConsumableEntry( Type[] types, int amount )
        {
            if( _Stores == null ) return null; // obvious null check to avoid attempting to iterate through a null collection
   
            foreach( ItemStore store in _Stores )
            {
                if( store == null )
                    continue;    // "continue" will skip the current element and continue the foreach loop, "break" would end the entire foreach loop, and "return" would end the entire method call.
           
                //find a match in this key's store
                int index = StoreEntry.IndexOfType( store.StoreEntries, types, true );
           
                //check if there was a match, and there is a sufficient amount
                if( index > -1 )
                {
                    StoreEntry entry = store.StoreEntries[index];
           
                    if( entry != null && entry.Amount >= amount ) // breaking this section up like i've done will ensure that you're not trying to access the property "Amount" if "entry" is null
                    {
                        //return a reference to this
                        return store.StoreEntries[index];
                    }
                }
            }
   
            //nothing suitable found, return null
            return null;
        }
 

sexylady

Sorceror
iraq- it work on one part but now when i what to take 100 out eg it say there was an error creating that item. please page gm
 

Iraq-

Sorceror
sexylady, the only time it should say "Please page a GM" is when Withdraw returns a null Item.

This shouldn't happen assuming that the item you're withdrawing is IUsesRemaining in the class file, and is stored as a ToolEntry type of StoreEntry.

Verify that the tools are being stored as ToolEntry, and that the returning type of the Item has IUsesRemaining inherited in it's class file.
 

sexylady

Sorceror
ok on the pickaxe weapon it says
public override HarvestSystem HarvestSystem{ get{ return Mining.System; } }

should i put the same on the axe and hatchet because it ant go it in them
what do u think
 

Attachments

  • Axe.cs
    1.4 KB · Views: 2
  • Hatchet.cs
    1.4 KB · Views: 3
  • Pickaxe.cs
    1.7 KB · Views: 1

sexylady

Sorceror
hi just to let u now i got it to work thx Iraq- for all ur help i have do this on line 4 and 11.
and it work thx for all ur help
 

Attachments

  • Axe.cs
    1.5 KB · Views: 10
  • Hatchet.cs
    1.5 KB · Views: 8

sexylady

Sorceror
hi i have 2 question
1) how can i make the keys blessed because when u a player dies and dont get to body quike they loss the keys so if i make them blessed they what losse them.
2) how can i change in the script so when u are making box or postion you dont have to take the stuff out it takes it out then u make the stuff
plz can any one help me
 

AdminA

Sorceror
1) Easiest way is to open the individual key files and add:

LootType = LootType.Blessed;

To the constructable section.
 

AdminA

Sorceror
Meant to ask, has anyone got the power/stat scroll key to work right? I notice it accepts the scrolls, but you can't withdraw them again.

Another problem is with potions, when you set the amount to withdraw to higher than 1, it doesn't save it, even when you click the green/red button to freeze the amount.

As soon as you click to withdraw a potion, it sets it back to 1.
 
Top