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 add the item and set what it says very quickly.
Also, this will not spam the player if they sit still in one area. It will delay for 2 minutes and if any player within 10 tiles moves, it will "speak" again.
Using the command
The quotation marks are necessary to do this.
To use
Drop it in your scripts and restart and use the command above
Notes
- Added FlipableAttribute.
- Added check to make sure that Mobile is PlayerMobile
- Add check to prevent Hidden Staff from triggering the sign. Suggestion by Dian
- Made change to script to prevent item from having a name.
Suggestion by pooka01
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 add the item and set what it says very quickly.
Also, this will not spam the player if they sit still in one area. It will delay for 2 minutes and if any player within 10 tiles moves, it will "speak" again.
Using the command
Will allow you to add the item, and set what it says with spaces.
The quotation marks are necessary to do this.
To use
Drop it in your scripts and restart and use the command above
Notes
- Added FlipableAttribute.
- Added check to make sure that Mobile is PlayerMobile
- Add check to prevent Hidden Staff from triggering the sign. Suggestion by Dian
- Made change to script to prevent item from having a name.
Suggestion by pooka01
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;
public virtual TimeSpan Delay{ get{ return TimeSpan.FromMinutes( 2.0 ); } }
[Constructable]
public SpeakingSign( string desc ) : base( 0x0BCF )
{
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 );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}