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!

Working Tillerman with Treasuremap fix

Danyeal

Wanderer
Working Tillerman with Treasuremap fix Version 1.1

Summary:
Tillerman that follows a plotted course and Treasuremaps that don't require that the treasuremap and ground both be targeted

Description:
Version 1.1:
Fixed Crash bug with "Single #" command. Ya'll can flame me now because it was the same problem with the "Goto #" command, I should have seen that and fixed it along with the 1st crash bug report. I'm an idiot.

Version 1.0:
Crash bug reported by madjoejoe is fixed. There was a mistake in the parsing of the command of "Goto #". Thanks madjoejoe, shows that no matter how much troubleshooting you do there's always another condition you didn't think to test for.


This script is a modification from an earlier tillerman script that I did not write. I'm sorry but I do not remember the original author, as I downloaded it quite some time ago.

It's updated to work with 1.0 RC0.

Works with both the purchased preset maps and crafted Cartography maps.

Harvest system changed so that digging treasure maps doesn’t require that the treasure map is targeted first then the ground.

Fixes:
Ship oscillation is fixed (doesn't flip back and forth across a coordinate). WARNING: do not set the boats slowspeed to anything greater than one, the BaseBoat.cs script drops the boat to slowspeed when it is within one fastspeed of either the destination X or Y coordinate, if slowspeed is greater than one the boat can jump the coordinate which causes the oscillation.

HarvestTarget.cs searches the player’s backpack for treasuremaps and if it finds one inrange then mining digs for treasure instead of mining ore.

Special fishingnet’s validation doesn’t return a false “not deep water†if fishing is done next to the end of the map.

Doesn’t crash when a map with one pin less than the current “Goto†pin is dropped on the tillerman while following a course.

Use:
Just drag and drop a plotted map onto the tillerman to transfer its course to him. Then use the "Goto "#"" (where “#†is the pin number to start at) command to send the boat to the pins coordinate, the boat will then proceed to the rest of the pin's coordinates in order.

Behavior:
Use the “Goto #†(where # = the pin number on the map) command to set the course to the “#†that corresponds to the map pin. The ship will go in a diagonal until either the X or Y coordinate is 0 then proceed in a straight line to the pin location. The ship will not go around land, you’ll have to plot a clear course.

If the boat’s destination coordinate is within 2 tiles of the edge of the map, it is treated as being 2 tiles from the edge (boats cannot be placed less than 2 tiles from the edge or part of it will be off the map).

Added Enhancements:
If a course if plotted that is greater than 75% of the maps height or width then the tillerman travels in the opposite direction and wraps across the map, instead of taking the long route across the entire map.

When wrapping across the map the tillerman says “arrrr, rough waters aheadâ€

The maps with this are enlarged for easier use and yield the correct coordinates.

The script wraps the boat coordinates in Trammel and Felucca when the boat reaches the end of the map (instead of at 16 tiles from the end).




Installation:
Replace
BaseBoat.cs
Tillerman.cs
in Scripts\Multis\Boats

Replace
BlankMap.cs
CityMap.cs
LocalMap.cs
MapItem.cs
PresetMap.cs
Seachart.cs
TreasureMap.cs
WorldMap.cs
in \Scripts\Items\Maps

Replace
HarvestTarget.cs
in \Scripts\Engines\Harvest\Core

Replace
SpecialFishingNet.cs
in \Scripts\Items\Skill Items\Fishing\Misc
 

Attachments

  • Tillerman 1.1.zip
    23.9 KB · Views: 306

Horde_Pil

Wanderer
an idea

hmm just a thought.. could not an AI be set to use a similar system (not the map aspect) to script in pirate ships that hunt players, and spawn pirates?
 

Danyeal

Wanderer
Horde_Pil said:
hmm just a thought.. could not an AI be set to use a similar system (not the map aspect) to script in pirate ships that hunt players, and spawn pirates?


Interesting indeed,

Tillerman is an item not a moblie. Maybe have the pirate instead of moving towards the player issue commands (Forward, Forward Right, Turn Left. etc..)

Or some other link between the pirate and the pirate's tillerman wherein the players coordinates are passed to it and then sets a course.
Possibly key in pirate's backpack points to boat, boat points to tillerman, tillerman holds players coordinates, pirate updates coordinates when it would have noramaly moved towards the player

Definate future project here.
 

madjoejoe

Wanderer
I like the script however i wrote "go to 1" on the boat by accident and crasehd the server. It also crashed when i wrote "goto1"

this is the crash log

Code:
Exception:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Server.Multis.BaseBoat.OnSpeech(SpeechEventArgs e)
   at Server.Mobile.DoSpeech(String text, Int32[] keywords, MessageType type, Int32 hue)
   at Server.Network.PacketHandlers.UnicodeSpeech(NetState state, PacketReader pvSrc)
   at Server.Network.MessagePump.HandleReceive(NetState ns)
   at Server.Network.MessagePump.Slice()
   at Server.Core.Main(String[] args)
 

Danyeal

Wanderer
madjoejoe said:
I like the script however i wrote "go to 1" on the boat by accident and crasehd the server. It also crashed when i wrote "goto1"

this is the crash log

Code:
Exception:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Server.Multis.BaseBoat.OnSpeech(SpeechEventArgs e)
   at Server.Mobile.DoSpeech(String text, Int32[] keywords, MessageType type, Int32 hue)
   at Server.Network.PacketHandlers.UnicodeSpeech(NetState state, PacketReader pvSrc)
   at Server.Network.MessagePump.HandleReceive(NetState ns)
   at Server.Network.MessagePump.Slice()
   at Server.Core.Main(String[] args)

Fixed and thanks madjoejoe.

It had a mistake in the parsing of the "Goto #" command where it didn't check for the existance of a number, just that "goto" and a space was present.
 

Danyeal

Wanderer
*ReVeNaNt* said:
I have a problem: whan i say to the tillerman the command "single" the server crash!

Fixed, new version released (1.1)

I should have seen that one, it's the same problem that "Goto #" had, you needed to say "Single #" where "#" is the pin number on the map. The script didn't check to see if you had typed in a number it just split the string into an array of strings delimited by spaces, and then passed the 2nd part to a procedure that convereted it into a number. When the array only had one element (such as the case when GOTO1, GOTO, or Single is typed) then it passed an illegal array element.

Both the Goto and Single commands now check that the array of parsed strings have at least 2 elements before passing the 2nd element. So, you must type in the word "single" or "goto" then a space then a number for it to work, and it should not crash anymore.

Thank you ReVeNaNt for finding and posting this bug.
 

Danyeal

Wanderer
SandStorm said:
Ok, all installed fine, one problem, now cant dig up treasure maps.. says you cannot mine that!

Are you targeting the treasure map itself? with this script you only need to have a map decoded by the character doing the digging in his/her backpack. use a shovel or pickaxe and then target the ground.

The you cannot mine that message is when you target something other than ground or rock.
 

weaselboy246

Wanderer
I love this script! It's been so long since i've been on the open sea in a working boat with some sort of "planned" trip. Thank you.
 

weaselboy246

Wanderer
SandStorm said:
Ok, all installed fine, one problem, now cant dig up treasure maps.. says you cannot mine that!

Are you the one who decoded that map? I've noticed that is a problem in attempting to mine treasure.
 

Danyeal

Wanderer
weaselboy246 said:
Are you the one who decoded that map? I've noticed that is a problem in attempting to mine treasure.

Actually if you attempt to dig with a map not decoded by the digger then the meassage is "You cannot mine there". The "You cannot mine that" comes from targeting something other than ground or rock.
I'm thinking that he's still targeting the treasure map like before when you had to first target the map then target the ground, this script not only lets you just dig ground to dig up treasure but it now requires it.

I got the idea from the SOS script in fishing, where you don;t need to do anything else but fish in water to get your SOS, it checked your backpack for valid SOS's when fishing and used the SOS instead. So I inserted simular code in targetharvest.cs to check for valid treasuremaps when mining. If it finds one (not already dug-up, miner is the decoder, and your inrange) it calls the ondig procedure in treasuremap.cs. I then changed it's internal call from a targeting procedure to a regular void procedure to stop the second targeting, the rest is the same.
This of course has nothing to do with the post I'm replying to, just thought that other scripting newbies might like to hear about some of the things done to achieve this. And if anyone would like I'd be glad to try to explain some or all the things I did in the baseboat.cs to get it to work, if there's any interest.
Also I do not mind anyone posting what I should have done instead, I'm from the It's always best to learn school myself and I do not get offended by suggestions or comments.
 

Phant219

Wanderer
Can you tell me what would be involved in getting this to work with a custom map? We have a custom map installed and the tillerman keeps running us to the edge of the map or stopping in the wrong locations. We did redo the multimap.rle file with the appropriate maps, but I know that there must be some mods that need made in the scripts I just installed as well. The custom map is in place of Felucca map and it is very different. I believe the wrap to be all wrong and god knows what else. I did try to modify them to work and quickly got lost. Heh.

Any help would be appreciated since my players are screaming for the ability to use the maps and tillermen to find treasures and navigate the world.

Phant219 : Admin @ A'Ciotach As Dan
 

Danyeal

Wanderer
At the very beginning of baseboat.cs is this line:

private static Rectangle2D m_BritWrap = new Rectangle2D( 0, 0, 5119 , 4095 );

this defines the maps size,
and throughout baseboat.cs you'll find these lines:

Rectangle2D rect = m_BritWrap;

this is where am procedure uses the maps rectangle in itself.
If your custom map is a different size then you'll need another private static Rectangle2D define at the beginning and then at each occurance of Rectangle2D rect in the procedures you'll need the pick which rect to use depending on which map you're in.


But that's the easy part. Creating the in game maps of two worlds is a different challenge.

Are your maps being generated correctly? (when you make a World, Seachart, Local, or City map which map is it showing? your custom one or the original?)

If your in game maps are correct and your custom map is the same size as Felucca then it should work.
 
Top