Hammerhand

Squire
ServUO Version
Publish 57
Ultima Expansion
Endless Journey
I'm trying to add the Anchor, Porthole, AnchorChain & ShipInABottle into my Fishing.cs https://www.uoguide.com/Message_in_a_Bottle
I have scripts done for them, I've added all but the AnchorChain, but so far I haven't fished any up. What I've done however has reduced the amount of bones & body parts that I normally get while increasing the fails. The reduced bones & body parts are nice, but the increased fails are not so much. I could use a bit of help with this if possible. Included is my Fishing.cs & the 4 item scripts. Please tell me I didn't break it too badly.
 

Attachments

  • Fishing.cs
    40.4 KB · Views: 3
  • Anchor.cs
    715 bytes · Views: 3
  • AnchorChain.cs
    722 bytes · Views: 3
  • Porthole.cs
    745 bytes · Views: 2
  • ShipinaBottle.cs
    760 bytes · Views: 2

manwitch

Citizen
The only thing I can see that might help is adding this part,

public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();

switch (version)
{
case 1:
{
m_IsShipwreckedItem = reader.ReadBool();
break;
}
}
}

public override void AddNameProperties(ObjectPropertyList list)
{
base.AddNameProperties(list);

if (m_IsShipwreckedItem)
list.Add(1041645); // recovered from a shipwreck
}

#region IShipwreckedItem Members

private bool m_IsShipwreckedItem;

[CommandProperty(AccessLevel.GameMaster)]
public bool IsShipwreckedItem
{
get
{
return m_IsShipwreckedItem;
}
set
{
m_IsShipwreckedItem = value;
}
}
#endregion

to your items scripts?

that's the only difference I see from your new items and the candelabra (that's already in there and works), so maybe adding that to your items scripts will make them work more like you want?

I'm no expert coder so I don't know for sure, just throwing it out there lol.
 
Last edited:

manwitch

Citizen
Yea, but the statement you use for the new items seems to be the same as the one for candelabra in case 13, so I thought it would make sense that the new ones have the same item script. Like I said, I'm not much more than a "copy and paste to fix stuff" coder, so no clue if this would make a difference.

I'm thinking of adding these as you are though, so please let me know if this helps or you find a correct fix. :) I already had the items in there but I've changed them to match the candelabra, but haven't edited my fishing.cs yet.
 

Hammerhand

Squire
Turns out they DO fish up, or at least the anchor does, so the others should as well. They seem to fall mid way between common & semi-rare, but that works for me. No sense in overloading a server with anchors & bottled ships lol. I did end up having to add in the shipwreck coding after all, so good call on that @manwitch. Adding the new item scripts & the ShipwreckedItem.cs for the flippable items. Still don't have the AnchorChain in the Fishing.cs, but I'll work on that next. :)
 

Attachments

  • ShipinaBottle.cs
    1.3 KB · Views: 3
  • Porthole.cs
    1.3 KB · Views: 3
  • AnchorChain.cs
    1.3 KB · Views: 3
  • Anchor.cs
    1.3 KB · Views: 3
  • ShipwreckedItem.cs
    3.4 KB · Views: 3

manwitch

Citizen
Good stuff! TY! one little thing, you could change your cliloc for the shipinabottle from 1125755 (ship) to 1125785 (ship in a bottle).
 

Hammerhand

Squire
Only issue so far is the Porthole doesn't open & close on dbl click. Treating it as a door throws errors & won't compile, so I need to try to sort out another route.
 

manwitch

Citizen
Treat it like the brass orrery maybe?? I didn't know it was supposed to open LOL

namespace Server.Items
{
public class BrassOrrery : Item
{
public override int LabelNumber => 1125363; // orrery

[CommandProperty(AccessLevel.GameMaster)]
public bool Active { get; set; }

[Constructable]
public BrassOrrery()
: base(0xA17C)
{
}

public override void OnDoubleClick(Mobile m)
{
if (m.InRange(GetWorldLocation(), 2))
{
ToggleActivation(m);
}
}

public void ToggleActivation(Mobile m)
{
if (Active)
{
ItemID = 0xA17C;
m.PlaySound(0x1E2);

Active = false;
}
else
{
ItemID = 0xA17B;
m.PlaySound(480);

Active = true;
}
}

public BrassOrrery(Serial serial)
: base(serial)
{
}

public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write(Active);
}

public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
Active = reader.ReadBool();
}
}
}
 

Hammerhand

Squire
No, that's an animation that runs continuously. The Porthole just has a 2 piece animation like a door & functions in a similar manner. Dbl click to open, dbl click to close.. But door coding throws an error due to the Shipwreck coding.
 

manwitch

Citizen
That makes sense, I'll keep looking around for an example that fits lol.
This porthole script compiles and works as intended but, I don't know if changing it to furniture will effect it dropping???

namespace Server.Items
{
[Furniture]//changed from flip atribute
public class Porthole : FurnitureContainer/*changed from item*/, IShipwreckedItem, IFlipable
{
public override int LabelNumber => 1125790;
[Constructable]
public Porthole()
: base(0xA327)
{
Movable = true;
Stackable = false;
}
//start manwitch edit
public void OnFlip(Mobile from)
{
switch (ItemID)
{
case 0xA327://south closed
ItemID = 0xA325;//east closed
break;
case 0xA325://eastclosed
ItemID = 0xA327;//southclosed
break;
case 0xA328://south open
ItemID = 0xA326;//east open
break;
case 0xA326://south open
ItemID = 0xA328;//east open
break;
}
}

public override void DisplayTo(Mobile m)
{
if (ItemID == 0xA327 /*south closed*/|| ItemID == 0xA325)//east closed
ItemID++;
else
ItemID--;
}
//end manwitch edit

public Porthole(Serial serial)
: base(serial)
{
}

public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(1);

writer.Write(m_IsShipwreckedItem);
}

public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();

switch (version)
{
case 1:
{
m_IsShipwreckedItem = reader.ReadBool();
break;
}
}
}
public override void AddNameProperties(ObjectPropertyList list)
{
base.AddNameProperties(list);

if (m_IsShipwreckedItem)
list.Add(1041645); // recovered from a shipwreck
}

#region IShipwreckedItem Members

private bool m_IsShipwreckedItem;

[CommandProperty(AccessLevel.GameMaster)]
public bool IsShipwreckedItem
{
get
{
return m_IsShipwreckedItem;
}
set
{
m_IsShipwreckedItem = value;
}
}
#endregion
}
}

It does show the contents 0/125 on mouse over though... that kind of sucks lol

Maybe change furniturecontainer to craftablefurniture?? eta- I tried that it didn't work lol
 
Last edited: