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!

Item by region help

Hammerhand

Knight
We are working on a small Archeological setup. We have the region set up and I copied & modified the ShipwreckItem.cs to label the items as "Found in an Archeological Dig site". Now, the problem is this, how do we set this up so that the region is recognized by Sand Mining and then gives a chance to "discover" an ancient item? I dont want to have to use maps if at all possible. Just have it so the player can be mining for sand in this area and when moving into the Archeological region, they get a chance to dig up the items. Is there even a way to do this?
 

Thagoras

Sorceror
Well, on my shard....if I ever get around to it...I'm planning on changing the way the whole harvesting system works. And one of the big changes is (because I wish to have veins of specific metals found in specific areas) to have the tool (that's the change) check which region the user is standing in. This is completely untested as of presently, but I believe, if I understand IsPartof at all, a mobile can be a member of a number of regions at one time and the IsPartof just performs a check to see if the mobile is in one of the checked regions. If this does work, all you'd have to do is set up your archeological site(s) in Regions.xml and then set up this region check in the mining harvest script.
 

Vorspire

Knight
Code:
Region current = Region.Find( mobile );

AFAIK using this method to detect the player's Region will ultimately return the highest priority (lowest child) Region they are currently in.
You could traverse your way to the correct Region by accessing the "current" reference.

Another way you can do it is to create a new script for your Archaeological regions and register them as like any Guarded or Dungeon Region, then you can override the Region's class members directly to provide what you need.
 

Hammerhand

Knight
We have the ArcheologicalDigRegion done and its entered into the Regions.xml as well. Just not sure where to go from there. Dont want to use maps or any special tools or skills. Just sand mining with a shovel. The problem I have is hooking it all together. I've never done anything with regions before. Would I add a region check to the Sand mining and then add in the chance to get an archeological find and if so, how? I could have easily just done a new harvest script, but then it would have all the sand areas as potential archeological sites which is what I dont want.
 

Vorspire

Knight
Hmm well if you have your regions all set up and ready to go then there shouldn't be a problem in testing for the Region the Player is in, if you follow the example I posted before, you can do:
Code:
//On Archeology skill use (or some other event where they use the skill)

if( current is ArcheologicalDigRegion )
{ /* They are inside the AD Region, continue with Archeology skill use */ }

There may be isntances where you need to loop through the Region's parents or children until you hit your AD Region, if it's never found, then they are obviously not in that region and can't continue with their digging :)
 

Hammerhand

Knight
There isnt an Archeology skill exactly.. I wanted it to use the mining skill along with the sand mining. So I should just add the lines in to say... the CheckHarvest so that it says if they are in the archeological dig region, then go ahead and give them a chance to get the items. Then I just need to get it to actually mine up items with the label. This is turning into a headache. lol But also a needed lesson in scripting. I'm going to head to bed and try to sleep on this. Maybe I'll find the rest of the answers that way. The player does however register that they've entered and left the new region, so that part definetly works.
 
*gets ready to duck for dumb suggestions - you have probably been all over these *

I'm thinking the check for the region should be in the harvest file Mining.cs or wherever it is determined if Ore or Stone or Sand is the result of the targeting from the shovel/pickaxe.

If playermobile is in the region then add random chance for Item just as you would have random chance for sand or ore.

Also . . . this is from BaseHarvestTool.cs (maybe checks and random drops could go here)

Code:
public override void OnDoubleClick( Mobile from )

{

if ( IsChildOf( from.Backpack ) || Parent == from )

HarvestSystem.BeginHarvesting( from, this );

else

from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.

}

 

Hammerhand

Knight
Errors:

+ Customs/Hammerhand/Archeological/Archeology.cs:

CS0103: Line 15: The name 'mobile' does not exist in the current context

Scripts: One or more scripts failed to compile or no script files were found.

- Press return to exit, or R to try again.

Code:
        private static Archeology m_System;

        Region current = Region.Find(mobile);

        public static Archeology System
I'm trying to get this to check to see if the player is in the region or not to see whether or not they can digging up artifacts. I'm apparently missing something here.. any ideas?
 

tass23

Page
What did you declare mobile as Hammer?
I was thinking reading through this thread that it almost seems as simple as para chests dropping. The sand is the region itself (or para in this example), what determines if a chest drops, the player's fame as I recall. Seems to me that a simple thing to do would be setting the sand region and when player's go to mine it, it's an increased chance to get an archeology item from digging based on _____.
 

KHzspeed

Sorceror
I know this suggestion is taking your idea, and going another direction with it, but It's something you could try.
you could pull some notes from the GraveRobbing system " http://www.runuo.com/community/threads/runuo-svn-graverobbing.95419/ ".
tailor the concept to Archeology by tile, maybe create a new set of tools for digging. more realistic, Archeologists use brushes and picks more-so than shovels *shrugs*. setup your dig loot, and it's practically finished.

that's just my idea :confused:
my apologies if this offends your ideas, I know it's forking off of someones system, but if it works- use it :)
 

tass23

Page
I was just getting ready to come here and suggest something very similar KHz, but from the Fire Rock Crafting system lol
I do believe, ideally, using a tile recognition would be the easiest way to go.
Here's a snippet of code from Fire Rock Crafting corresponding to the tile to mine:
Code:
  #region Tile lists
        private static int[] m_LavaTiles = new int[]
                    {
                 500, 501, 502, 503,
                 
                 0x12EE, 0x12EF, 0x12F0, 0x12F1, 0x12F2, 0x12F4, 0x12F5, 
                 0x12F6, 0x12F7, 0x12F8, 0x12F9, 0x12FA, 0x12FB, 0x12FC,
                 0x12FD, 0x12FE, 0x1300, 0x1301, 0x1302, 0x1304, 0x1306,
                 0x1307, 0x1308, 0x1309, 0x130A, 0x130C, 0x130D, 0x130E,
                 0x130F, 0x1310, 0x1312, 0x1313, 0x1314, 0x1315, 0x1316,
                 0x1318, 0x1319, 0x131A, 0x131B, 0x131C, 0x131E, 0x131F,
                 0x1320, 0x1321, 0x1322, 0x1323, 0x1324, 0x1325, 0x1326,
                 0x1327, 0x1328, 0x1329, 0x132A, 0x132B, 0x132C, 0x132D,
                 0x312E, 0x132F, 0x1330, 0x1331, 0x1332, 0x1333, 0x1334,
                 0x1335, 0x1336, 0x1337, 0x1338, 0x1339, 0x133A, 0x133B,
                 0x133C, 0x133D, 0x133E, 0x133F, 0x1340, 0x1341, 0x1342,
                 0x1343, 0x1344, 0x1345, 0x1346, 0x1347, 0x1348, 0x1349,
                 0x134A, 0x134B, 0x134C, 0x134D, 0x136E, 0x137E, 0x1380,
                 0x1382, 0x3286, 0x3287, 0x3288, 0x3289, 0x328B, 0x328C,
                 0x328D, 0x328E, 0x328F, 0x3290, 0x3291, 0x3292, 0x3293,
                 0x3294, 0x3295, 0x3296, 0x3297, 0x3298, 0x3299, 0x329A,
                 0x329B, 0x329C, 0x329D, 0x329E, 0x329F, 0x32A0, 0x32A1,
                 0x32A2, 0x32A3, 0x32A4, 0x32A5, 0x32A6, 0x32A7, 0x32A8,
                 0x32A9, 0x32AA, 0x32AB, 0x32AC, 0x32AD, 0x32AE, 0x32AF,
                 0x32B0, 0x32B1
            };
  #endregion
 

Hammerhand

Knight
Both are decent suggestions, but not quite what I'm needing. I have it working completely, the artifacts mine as they are supposed to. The problem is this, we have a pre-defined region already set up for it and this needs to work only in that region. I only want it to mine from sand tiles in that region. We have a custom map with an area that looks like an archeological dig, similiar to, but more detailed than the one by Malas lost pyramid.
 

tass23

Page
Then it sounds like you need to specify the exact area that people can dig in, which would be the sand tiles.
 

Hammerhand

Knight
The whole area, both inside and out of the archeological region is sand, which is why I'm trying to do this by region. I only want that one area to be usable for the finding of the artifacts. I cant specify only those sand tiles since its in the middle of a large sand covered area. The region itself works, the player is notified that they have entered or left it, the digging of the artifacts works as well... but on ANY sand tiles, anywhere on the server. I only want them to be dug up in that particular region, like guards are only in guarded regions. I just need it to check to see if the player is in that region and then allow them to dig, otherwise if they arent, they cant.
 

tass23

Page
Okay, so go into regions and set the exact coords just for that area. I'm guessing you might have this setup similar to the way t map areas are?
Something you can do as a reference is use Regions In A Box to draw out the area, the input those coords into your regions.xml file. That should take care of it.
 

Hammerhand

Knight
No, it is not set up like t-maps, so a single set of co-ords is useless. Its an entire area (ArcheologicalDigRegion) within a much larger area (desert area on map). The region is already done and works. I need a functioning region check. Example: You have your archeological tool and are traveling through the desert area, occasionally checking to see if you can dig there with the tool and cant. Suddenly, you see "You have entered the Archeological Dig region" on your screen and discover that you CAN dig for artifacts with the tool. I need someway for the Archeology script to check to see if the player is in the correct region (ArcheologicalDigRegion) or not and if so, then to allow the digging. If not, then the player is informed that they cant dig there.
 

Hammerhand

Knight
Not really.. they check to see if you are at the exact co-ords of the chest as defined by Treasure.cfg. Single location X & Y co-ords. They only allow you to dig for the chest right there. I need more than that. I'm not exactly sure what the full size of the new region is tile wise, but as an example, say its 20x30 tiles in a much larger area. I need that 20x30 square tile area as defined by the archeological dig region to be minable for the artifacts, not a single point in it. It isnt a treasure hunt, its a system. So I need a region check, not a single point co-ord. T-maps have a region, yes and they notify you that you entered it, but it has little to do with the digging up of the chest. The chest is in a pre-defined location. My artifacts are to be found anywhere within the region.
 

Vorspire

Knight
How about simply checking the region when the player uses the tool?
I see what you're trying to achieve and it looks like you're taking the long road :p

OnDoubleClick... If Player.Region is DigRegion ... allow the digging and handle the fail/success or whatever
 

Pure Insanity

Sorceror
How about simply checking the region when the player uses the tool?
I see what you're trying to achieve and it looks like you're taking the long road :p

OnDoubleClick... If Player.Region is DigRegion ... allow the digging and handle the fail/success or whatever

Lol, reading all the replies one by one. I was thinking the same thing. You can add the check in the double click/menu usage of the tool that is needed to dig up w/e it is. Just check the region there, since your region is programmed in as a real region. The check is even easier, like Vorspire just said.

Remember KISS when programming in the future. Keep it simple stupid.
 
Top