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!

Finding the Resource type of an item.

Karna

Wanderer
Finding the Resource type of an item.

Just looking for how to find a resource type here.

I'm trying to add magic resistances to platemail.

I've been trying to do it judging by some other scripts, and this is what I have although it's obviously wrong:

Code:
private CraftResource m_Resource;

m_Resource = this.CraftResource;

This gives me the error:

Server.Items.PlateChest does not contain a definition for 'CraftResource'..

I had assumed the definition for it was somewhere in one of the includes, but I've tried all the ones in BaseArmor.cs and I'm still having this error.

I'm just trying to get it to work with a switch statement. Almost exactly like how it works in BaseArmor.cs with determining Armor Rating.
 

Sep102

Page
I would say, cast this to BaseArmor type and then try it and I think it might work, otherwise...no other ideas at this time
 

Karna

Wanderer
My first post was a bit overcomplex..

All I want to do is find a way to get the resource type of a peice of armor. In this case, a plate chest. In of PlateChest.cs
 

Sep102

Page
Like I said, I'm not too sure but try either
Code:
m_Resource = (BaseArmor)this.ResourceType;
or
Code:
BaseArmor armor = (BaseArmor)this;

m_Resource = armor.ResourceType;

same thing pretty much
 

Karna

Wanderer
Ugh. Sorry. It was confusion on my part, here..

The property is 'Resource' not 'CraftResource'. CraftResource is the data type.

It worked when I changed

this.CraftResource

to

this.Resource

Thanks for your help anyways.
 

Sep102

Page
Oh, Damn, can't believe I missed that, I looked right at that property in basearmor before posting that too
 
Top