|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#2 (permalink) |
|
Forum Novice
Join Date: Apr 2006
Posts: 188
|
I'm not sure how a player would fall in water, however you can check Strandedness.cs to see how it handles transporting a player to the neares shore when they log out in water.
__________________
http://www.crypticrealms.com |
|
|
|
|
|
#4 (permalink) | |
|
Forum Novice
Join Date: Sep 2007
Posts: 367
|
Quote:
Here's what I would suggest... I would create a new Item called CrashSitePlaceHolder and put them around the world in some valid crash site spots. Then, instead of using every single available coastal tile as a valid site for shipwrecks... once you have those spawned, whenever a ship sinks, you can run code that would check for the nearest shipwreck site (just example code to give you ideas... ): notice below that you'll need to pass shipDestructionLocation (Point3D) as an arugment to this method... Code:
public void CrashSiteLocation( Point3D shipDestructionLocation)
{
local Point3D nearestCrashSite = null; // local variable
local int DistanceToSite = null;
foreach ( Item CrashSitePlaceHolder in this.GetItemsInRange( 4000 ) )
{
if (nearestCrashSite == null)
{
if (CrashSitePlaceHolder != nulll) // always automatically assign the first site in range by default.
nearestCrashSite = CrashSitePlaceHolder.GetWorldLocation();
DistanceToSite = Math.Sqrt( Math.Pow( nearestCrashSite.Y - shipDestructionLocation.Y , 2 ) + Math.Pow( nearestCrashSite.X - shipDestructionLocation.X , 2 )); // distance from the boat sinking location to the fist crash site we assign.
else
return // no valid crash sites -- no CrashSitePlaceHolder is spawned
}
if ( Math.Sqrt( Math.Pow( CrashSitePlaceHolder.GetWorldLocation().Y - shipDestructionLocation.Y , 2 ) + Math.Pow( CrashSitePlaceHolder.GetWorldLocation().X - shipDestructionLocation.X , 2 )) <= DistanceToSite) // here we compare all of the distances of the crash sites and find the nearest one, continually assigning nearer sites until we assign the closest site
{
nearestCrashSite = CrashSitePlaceHolder.GetWorldLocation();
}
else
{} // we keep the previously assigned location if it is closer to the place where the ship sank
}
return nearestCrashSite;
}
Code:
m.Kill(); m.X = nearestCrashSite.X; m.Y = nearestCrashSite.Y; m.Z = nearestCrashSite.Z; Oh... and every time a player gets "on" a boat, you could append or edit the roster of players currently on the boat. When the boat "sinks", it would be easy to use that list or roster to find the eligible players to kill and transport. /ideas Last edited by Tassyon T; 09-04-2008 at 11:45 AM. |
|
|
|
|
|
|
#6 (permalink) | |
|
Forum Novice
Join Date: Sep 2007
Posts: 367
|
Quote:
People use the plank to "board" a ship. So... You could create an OnMoveOver() or OnDoubleClick() override for the plank that creates a serialized list of players that are currently "aboard" the ship -- adds new players to the list when they enter the ship, and subtracts them from the list when they leave. Then... whenever the ship "sinks" you could write something like... Code:
foreach (Mobile m in ShipRoster[])
{
m.kill
}
Last edited by Tassyon T; 09-06-2008 at 07:28 PM. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|