OK I made a class moongate. However, it requires an update that I haven't released yet. I will be eliminating all previous modules and combining them into a PlayerModule. My class, race, level and bod systems will use the same module and will become a part of my core. I will also be adding many neat [optional] features. One will be a modification so that the Wedding Script could be used with the PlayerModule. Another example is an optional AFK command, ect. It is important that I add as many features as possible before releasing the module in order to keep the module serialization at zero upon release. We all know that future updates will make the version number climb so it is best to load it with extra serialized properties for expansion.Boulder said:licid
how can i make a gate for players that makes sure they pic a class before teleporting from a area
I'm not aware of a board script that comes with this system. Looks like you are blaming the wrong person.uo_maltese said:i've got this lame problem.
When i load the server it runs smoothly... not problems but then when it comes to loading the world i get an error that there is a board and it needs to be deleted... what am i supposed to do about that pls?
RunUO - [www.runuo.com] Version 2.0, Build 2478.36565
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (1 errors, 2 warnings)
Warnings:
+ Spells/@@Other Shit/-=+ Full Spellbook +=-/Full Spellbook/TomeOfKnowledge.cs:
CS0162: Line 589: Unreachable code detected
+ Spells/@@Other Shit/Reagent Book/RegBook.cs:
CS0162: Line 309: Unreachable code detected
Errors:
+ Spells/Staff/Ultima VII System/SleepingBody.cs:
CS0161: Line 158: 'Server.Items.SleepingBody.GetWorldPacketFor(Server.Networ
k.NetState)': not all code paths return a value
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
using System;
using System.Collections;
using Server;
using Server.Engines.PartySystem;
using Server.Misc;
using Server.Guilds;
using Server.Mobiles;
using Server.Network;
using Server.ContextMenus;
namespace Server.Items
{
public class SleepingBody : Container
{
private Mobile m_Owner;
private string m_SleepingBodyName; // Value of the SleepingNameAttribute attached to the owner when he died -or- null if the owner had no SleepingBodyNameAttribute; use "the remains of ~name~"
private bool m_Blessed;
private ArrayList m_EquipItems; // List of items equiped when the owner died. Ingame, these items display /on/ the SleepingBody, not just inside
private bool m_spell;
private DateTime m_NextSnoreTrigger;
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Owner
{
get{ return m_Owner; }
}
public ArrayList EquipItems
{
get{ return m_EquipItems; }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool Invuln
{
get{ return m_Blessed; }
}
[Constructable]
public SleepingBody( Mobile owner, bool blessed ) : this( owner, blessed, true )
{
}
[Constructable]
public SleepingBody( Mobile owner, bool blessed, bool isSpell ) : base( 0x2006 )
{
Stackable = true; // To supress console warnings, stackable must be true
Amount = owner.Body; // protocol defines that for itemid 0x2006, amount=body
Stackable = false;
m_Blessed = blessed;
Movable = false;
m_Owner = owner;
Name = m_Owner.Name;
m_SleepingBodyName = GetBodyName( owner );
Hue = m_Owner.Hue;
Direction = m_Owner.Direction;
m_spell = isSpell;
m_EquipItems = new ArrayList();
AddFromLayer( m_Owner, Layer.FirstValid, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.TwoHanded, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.Shoes, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.Pants, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.Shirt, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.Helm, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.Gloves, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.Ring, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.Neck, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.Hair, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.Waist, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.InnerTorso, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.Bracelet, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.FacialHair, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.MiddleTorso, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.Earrings, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.Arms, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.Cloak, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.OuterTorso, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.OuterLegs, ref m_EquipItems );
AddFromLayer( m_Owner, Layer.LastUserValid, ref m_EquipItems );
}
private void AddFromLayer( Mobile from, Layer layer, ref ArrayList list )
{
if( list == null )
list = new ArrayList();
Item worn = from.FindItemOnLayer( layer );
if ( worn != null )
{
Item item = new Item();
item.ItemID = worn.ItemID;
item.Hue = worn.Hue;
item.Layer = layer;
DropItem( item );
list.Add( item );
}
}
public override void OnDoubleClick( Mobile from )
{
from.SendLocalizedMessage( 1001018 ); // You cannot perform negative acts on your target.
}
public override bool HandlesOnMovement{ get{ return true; } } // Tell the core that we implement OnMovement
public override bool OnDragDropInto( Mobile from, Item item, Point3D p )
{
from.SendLocalizedMessage( 1005468, "", 0x8A5 ); // Me Sleepy.
return false;
}
public override bool OnDragDrop(Mobile from, Item dropped)
{
from.SendLocalizedMessage( 1005468, "", 0x8A5 ); // Me Sleepy.
return false;
}
public override bool CheckContentDisplay( Mobile from )
{
return false;
}
public override bool DisplaysContent{ get{ return false; } }
public override void OnAfterDelete()
{
if( m_Owner != null )
{
m_Owner.Z = this.Z;
m_Owner.Blessed = this.m_Blessed;
}
for( int i = 0; i < m_EquipItems.Count; i++ )
{
object o = m_EquipItems[i];
if( o != null && o is Item )
{
Item item = (Item)o;
item.Delete();
}
}
base.OnAfterDelete();
}
public SleepingBody( Serial serial ) : base( serial )
{
}
[COLOR="Blue"]protected override Packet GetWorldPacketFor( NetState state )[/COLOR]
{
base.SendInfoTo( state );
if ( ItemID == 0x2006 )
{
state.Send( new SleepingBodyContent( state.Mobile, this ) );
state.Send( new SleepingBodyEquip( state.Mobile, this ) );
}
}
public override void AddNameProperty( ObjectPropertyList list )
{
if ( m_SleepingBodyName != null )
list.Add( m_SleepingBodyName );
else
list.Add( 1049644, String.Format( "Sleeping {0}", Name ) );
}
public override void OnSingleClick( Mobile from )
{
LabelTo( from, m_SleepingBodyName == null ? String.Format( "Sleeping {0}", Name ) : m_SleepingBodyName );
}
public static string GetBodyName( Mobile m )
{
Type t = m.GetType();
object[] attrs = t.GetCustomAttributes( typeof( SleepingNameAttribute ), true );
if ( attrs != null && attrs.Length > 0 )
{
SleepingNameAttribute attr = attrs[0] as SleepingNameAttribute;
if ( attr != null )
return attr.Name;
}
return m.Name;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 1 );
writer.Write(m_spell); // version 1
writer.Write(m_Owner); // version 0
writer.Write(m_SleepingBodyName);
writer.Write(m_Blessed);
writer.WriteItemList( m_EquipItems, true );
}
public override void Deserialize( GenericReader reader )
{
m_spell = true;
base.Deserialize( reader );
int version = reader.ReadInt();
switch( version )
{
case 1:
{
m_spell = reader.ReadBool();
goto case 0;
}
case 0:
{
m_Owner = reader.ReadMobile();
m_SleepingBodyName = reader.ReadString();
m_Blessed = reader.ReadBool();
m_EquipItems = reader.ReadItemList();
break;
}
}
m_NextSnoreTrigger = DateTime.Now;
// Delete on Server restart if spell action
if( m_spell )
this.Delete();
}
public bool CheckRange( Point3D loc, Point3D oldLoc, int range )
{
return CheckRange( loc, range ) && !CheckRange( oldLoc, range );
}
public bool CheckRange( Point3D loc, int range )
{
return ( (this.Z + 8) >= loc.Z && (loc.Z + 16) > this.Z )
&& Utility.InRange( GetWorldLocation(), loc, range );
}
public override void OnMovement( Mobile m, Point3D oldLocation )
{
base.OnMovement( m, oldLocation );
if ( m.Location == oldLocation )
return;
if ( CheckRange( m.Location, oldLocation, 5 ) && DateTime.Now >= m_NextSnoreTrigger )
{
m_NextSnoreTrigger = DateTime.Now + TimeSpan.FromSeconds(Utility.Random(5,10));
if(this != null&&this.Owner!=null)
{
this.PublicOverheadMessage(0,Owner.SpeechHue,false,"zZz");
Owner.PlaySound( Owner.Female ? 819 : 1093);
}
}
}
}
}
I didn't write those spells. I only wrote the undead and avatar spells. The others were written by other people and then added to this system.Malaperth said:I seem to have a problem with the Sleep spell.
When the spell is cast, the original body has it's Z set -100 (I assume that's so noone including staff can see the body), however, when either the spell wears off, or the Awaken spell is cast, the original body is still at -100 of it's original Z.
I've looked over and over that code and can't for the life of me figure out how/why that's happening.
I haven't made any edits to any of the spells.
Any idea?
using System;
using System.Collections;
using Server;
using Server.Targeting;
using Server.Items;
namespace Server.Spells.Third
{
public class SleepSpell : Spell
{
private SleepingBody m_Body;
private bool m_Blessed;
private static SpellInfo m_Info = new SpellInfo(
"Sleep", "In Zu",
SpellCircle.Third,
206,
9002,
Reagent.SpidersSilk,
Reagent.BlackPearl,
Reagent.Nightshade
);
public SleepSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
public void Target( Mobile m )
{
if ( !Caster.CanSee( m ) )
{
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
}
else if(m.Blessed || m.AccessLevel != AccessLevel.Player)
{
Caster.SendMessage("You cannot put that to sleep.");
}
else
{
SpellHelper.Turn( Caster, m );
if(this.Scroll!=null)
Scroll.Consume();
Effects.SendLocationParticles( EffectItem.Create( new Point3D( m.X, m.Y, m.Z + 16 ), Caster.Map, EffectItem.DefaultDuration ), 0x376A, 10, 15, 5045 );
m.PlaySound( 0x3C4 );
m.Hidden = true;
m.Frozen=true;
m.Squelched=true;
ArrayList sleepequip = new ArrayList();
Item hat = m.FindItemOnLayer(Layer.Helm);
if(hat!=null)
{
sleepequip.Add(hat);
}
SleepingBody body = new SleepingBody(m, m_Blessed);
body.Map=m.Map;
body.Location=m.Location;
m_Body=body;
m.Z-=100;
m.SendMessage("You fall asleep");
RemoveTimer( m );
TimeSpan duration = TimeSpan.FromSeconds( Caster.Skills[SkillName.Magery].Value * 1.2 ); // 120% of magery
Timer t = new InternalTimer( m, duration, m_Body);
m_Table[m] = t;
t.Start();
}
}
private static Hashtable m_Table = new Hashtable();
public static void RemoveTimer( Mobile m )
{
Timer t = (Timer)m_Table[m];
if ( t != null )
{
t.Stop();
m_Table.Remove( m );
}
}
private class InternalTimer : Timer
{
private Mobile m_Mobile;
private Item m_Body;
public InternalTimer( Mobile m, TimeSpan duration, Item body ) : base( duration )
{
m_Mobile = m;
m_Body=body;
}
protected override void OnTick()
{
m_Mobile.RevealingAction();
m_Mobile.Frozen=false;
m_Mobile.Squelched=false;
if(m_Body!=null)
{
m_Mobile.SendMessage("You wake up!");
m_Mobile.Z = m_Body.Z;
m_Body.Delete();
m_Mobile.Animate(21, 6, 1, false, false, 0);
}
RemoveTimer( m_Mobile );
}
}
public class InternalTarget : Target
{
private SleepSpell m_Owner;
public InternalTarget( SleepSpell owner ) : base( 12, false, TargetFlags.Beneficial )
{
m_Owner = owner;
}
protected override void OnTarget( Mobile from, object o )
{
if ( o is Mobile )
{
m_Owner.Target( (Mobile)o );
}
}
protected override void OnTargetFinish( Mobile from )
{
m_Owner.FinishSequence();
}
}
}
}
K thank you. I don't have the time to fix other people's scripts at the moment. I only have one day off a week now and I am dedicating that time to my own scripts.Malaperth said:Well, thanks to David and Mortis, there is a simple fix for the problem with the Sleep spell. I also noticed that players can cast the spell on staff and it would do horrible things to Blessed mobiles/NPCs, so I added a fix for those as well.
Replace your Sleep.cs with this one if you want to fix those two issues I mentioned.
Code:using System; using System.Collections; using Server; using Server.Targeting; using Server.Items; namespace Server.Spells.Third { public class SleepSpell : Spell { private SleepingBody m_Body; private bool m_Blessed; private static SpellInfo m_Info = new SpellInfo( "Sleep", "In Zu", SpellCircle.Third, 206, 9002, Reagent.SpidersSilk, Reagent.BlackPearl, Reagent.Nightshade ); public SleepSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info ) { } public override void OnCast() { Caster.Target = new InternalTarget( this ); } public void Target( Mobile m ) { if ( !Caster.CanSee( m ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if(m.Blessed || m.AccessLevel != AccessLevel.Player) { Caster.SendMessage("You cannot put that to sleep."); } else { SpellHelper.Turn( Caster, m ); if(this.Scroll!=null) Scroll.Consume(); Effects.SendLocationParticles( EffectItem.Create( new Point3D( m.X, m.Y, m.Z + 16 ), Caster.Map, EffectItem.DefaultDuration ), 0x376A, 10, 15, 5045 ); m.PlaySound( 0x3C4 ); m.Hidden = true; m.Frozen=true; m.Squelched=true; ArrayList sleepequip = new ArrayList(); Item hat = m.FindItemOnLayer(Layer.Helm); if(hat!=null) { sleepequip.Add(hat); } SleepingBody body = new SleepingBody(m, m_Blessed); body.Map=m.Map; body.Location=m.Location; m_Body=body; m.Z-=100; m.SendMessage("You fall asleep"); RemoveTimer( m ); TimeSpan duration = TimeSpan.FromSeconds( Caster.Skills[SkillName.Magery].Value * 1.2 ); // 120% of magery Timer t = new InternalTimer( m, duration, m_Body); m_Table[m] = t; t.Start(); } } private static Hashtable m_Table = new Hashtable(); public static void RemoveTimer( Mobile m ) { Timer t = (Timer)m_Table[m]; if ( t != null ) { t.Stop(); m_Table.Remove( m ); } } private class InternalTimer : Timer { private Mobile m_Mobile; private Item m_Body; public InternalTimer( Mobile m, TimeSpan duration, Item body ) : base( duration ) { m_Mobile = m; m_Body=body; } protected override void OnTick() { m_Mobile.RevealingAction(); m_Mobile.Frozen=false; m_Mobile.Squelched=false; if(m_Body!=null) { m_Mobile.SendMessage("You wake up!"); m_Mobile.Z = m_Body.Z; m_Body.Delete(); m_Mobile.Animate(21, 6, 1, false, false, 0); } RemoveTimer( m_Mobile ); } } public class InternalTarget : Target { private SleepSpell m_Owner; public InternalTarget( SleepSpell owner ) : base( 12, false, TargetFlags.Beneficial ) { m_Owner = owner; } protected override void OnTarget( Mobile from, object o ) { if ( o is Mobile ) { m_Owner.Target( (Mobile)o ); } } protected override void OnTargetFinish( Mobile from ) { m_Owner.FinishSequence(); } } } }
Oh no. I just wanted to explain to you why I couldn't help you with this one. I'm sry. This is my one night off and hoping to update Advanced Archery to eliminate the serilization issue.Malaperth said:Sorry, Lucid, I didn't mean to make that sound like anything against you at all. I apologize if it sounded that way. I just wanted to help.
I will except all the help I can get . And I don't have any issues with them being posted, but if there are a lot of fixes it is best to email them too me so I can provide everyone with an update. I greaty appreciate you telling me of the fixes cause most of the time I have to pull away from my projects to do the fixes myself . Yeah, my PM box is very full..........I will try to empty it real quick. Sorry bout that a ton of people message me for help and I give it most of the time. BRB...............Malaperth said:Well, if your systems weren't so large and so popular, you wouldn't have that problem
Anyway. I'm going through all the spells and have noticed some other things. Some might call them bugs, others personal preference choices, but I'm going to address them. I'd have PM'ed all this to you, but your PM box is full
Type: [add fullranBoulder said:how do i get full ranger spell book to players the also is no cafting scrolls to add to book im i missing somthing