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!

Resource icon

[2.x] Speaking Sign Ver. 3

No permission to download

zerodowned

Sorceror
zerodowned submitted a new resource:

Speaking Sign (version V. 1) - Sign that will speak when a player is nearby

What is it?
A sign that will speak it's own name when a player is nearby.
For things like gaterooms, sending important messages to players when they enter an area, etc.

There are other scripts that do something similar, but this allows you to easily add item and set what it says very quickly.

Using the command
[add SpeakingSign set name "enter custom name"
Will allow you to add the item, set it's name and also supports setting names...

Read more about this resource...
 

Dian

Sorceror
Just a thought, you might also make it check access level, so any staff going by wont trip it. or maybe better yet, hidden staff wont trip it, giving themselves away if lurking around the players.

Ive done that with most my items like this, specially the vett reward statues in houses :)
 

pooka01

Sorceror
Haha, randomly opening doors, signs of telepatic triggered visions of a sign inscription, abnormal statues making noises away from people, clear signs of ghost haunting! xD

Also what about:

Code:
public SpeakingSign(string desc) : base(0x0BCF)
{
    Movable = false;
    Name = desc;
}

so you can do [add SpeakingSign "do not enter this zone!"
instead of adding a "set name <name>" after the command

this could also block people from creating a sign that has no name, as you would not have an empty sign constructor.

could also compress this:
Code:
public virtual void HeedWarning()
        {
            //PublicOverheadMessage: type, hue, number, message
            PublicOverheadMessage( MessageType.Regular, 0x3B2, false, String.Format( "{0}", Name) );
        }
as this.Name just refers to Name, the this keyword refers to the instance of the item itself.
In this case it is shorter to use Name directly instead of setting that to a local variable and using it once.

Just thought i could contribute. :p
 

zerodowned

Sorceror
Just a thought, you might also make it check access level, so any staff going by wont trip it. or maybe better yet, hidden staff wont trip it, giving themselves away if lurking around the players.

Ive done that with most my items like this, specially the vett reward statues in houses :)

Hadn't thought of that, I'll add it on when I can :)


Haha, randomly opening doors, signs of telepatic triggered visions of a sign inscription, abnormal statues making noises away from people, clear signs of ghost haunting! xD

I was thinking about making a hidden item that would play a sound when a player is nearby. Hadn't considered using it to "scare" players. :rolleyes:

Also what about:

Code:
public SpeakingSign(string desc) : base(0x0BCF)
{
    Movable = false;
    Name = desc;
}

so you can do [add SpeakingSign "do not enter this zone!"
instead of adding a "set name <name>" after the command

this could also block people from creating a sign that has no name, as you would not have an empty sign constructor.

could also compress this:
Code:
public virtual void HeedWarning()
        {
            //PublicOverheadMessage: type, hue, number, message
            PublicOverheadMessage( MessageType.Regular, 0x3B2, false, String.Format( "{0}", Name) );
        }
as this.Name just refers to Name, the this keyword refers to the instance of the item itself.
In this case it is shorter to use Name directly instead of setting that to a local variable and using it once.

Just thought i could contribute. :p

Thank you for the idea, I'll add it in as well. :)
 

Macil

Sorceror
Any chance we can add a flag in the properties to modify the cooldown timer on the fly without having to edit the script? That way certain signs can repeat messages more frequently than others, depending on their importance and player traffic volume?

*** ADDED ***

Credit to Rasmenar for helping me set this up. He added my above suggestion so the time delay on the signs can be adjusted on the fly in-game without having to code separate ones.

I hope someone finds this addition useful. Great script zerodowne! =)

Code:
using System;
using System.Collections;
using Server;
using Server.Mobiles;
using Server.Network;
 
 
/*
Use < [add SpeakingSign "enter custom name"  > command to set name of item when creating it.
This allows you to set name with spaces between words,
 
*/
 
namespace Server.Items
{
[FlipableAttribute( 0x0BCF, 0x0BD0, 0x0BD1, 0x0BD2, 0x1F28, 0x1F29 , 0x1297, 0x1298, 0x1299, 0x129A, 0x129B, 0x129C, 0x129D, 0x129E )]
 
public class SpeakingSign : Item
{
private DateTime LastUse;
 
private TimeSpan m_Delay;
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan Delay
{
get { return m_Delay; }
 
set {m_Delay = value; }
}
 
private double m_CooldownTime;
 
[Constructable]
public SpeakingSign( string desc ) : base( 0x0BCF )
{
Delay = TimeSpan.FromSeconds( 10.0 );
Movable = false;
Name = desc;
 
}
 
public virtual void HeedWarning()
{
//PublicOverheadMessage( type, hue, number, "" );
PublicOverheadMessage( MessageType.Regular, 0x3B2, false, String.Format( "{0}", Name) );
}
 
public override bool HandlesOnMovement { get { return true; } }
 
public override void OnMovement( Mobile m, Point3D oldLocation )
{
if ( m.AccessLevel > AccessLevel.Player && m.Hidden )
return;
 
if ( m is PlayerMobile && m.InRange( this, 10 ) )
{
if ( LastUse + Delay > DateTime.Now  )
{
return;
}
else
{
HeedWarning();
LastUse = DateTime.Now;
}
}
 
}
 
public SpeakingSign( Serial serial ) : base( serial )
{
}
 
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 );
writer.Write( (TimeSpan)m_Delay);
}
 
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
m_Delay = reader.ReadTimeSpan();
}
}
}
 

zerodowned

Sorceror
Any chance we can add a flag in the properties to modify the cooldown timer on the fly without having to edit the script? That way certain signs can repeat messages more frequently than others, depending on their importance and player traffic volume?
*** ADDED ***

Credit to Rasmenar for helping me set this up. He added my above suggestion so the time delay on the signs can be adjusted on the fly in-game without having to code separate ones.

nice addition! :)
 
Top