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!

Charms

jayates

Sorceror
I came across xxx007xxx's Charm script today that says: You can create charm of FollowersMax,Hunger,Thirst,Int,Str,VirtualArmor. Here's the code where I plugged in the values and the skill. But it won't compile without errors. Just wondering if I could create a NecroCharm if it's doable or not?
Line 29: The type or namespace 'from could not be found <are you missing a using or an assembly reference?>
Code:
using System;
using Server.Network;
using Server.Items;
 
namespace Server.Items
{
    public class NecroCharm : Item
    {       
             
          private int _20;
 
        [Constructable]
        public NecroCharm() : this(1)
        {
           
        }     
        [Constructable]
        public NecroCharm(int amount) : base( 0xE73 )
        {
                _20 =amount;
            Weight = 1.0;
            //  LootType = LootType.Blessed;
              Name = "<BASEFONT COLOR=#006300> +"+_20+" Necro Charm </b>";
        }
 
                public override bool OnDroppedInto( Mobile from, Container target, Point3D p )
                {
                    if( target is from.Backpack|| target.IsChildOf( from.Backpack) )
                  {
                      from.Necromancy += _20;
               
                      Movable = false;
                  }
                      return base.OnDroppedInto(from,target,p);
                }
                public override void OnDoubleClick( Mobile from )
        {
            if ( IsChildOf( from.Backpack ) &&  Movable == false )
            {
                from.Necromancy -= _20;
               
                Movable = true;
            }
            else
            {
                from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
            }
        }
 
/*   
//remove  Movable = false    OnDroppedInto
              public override void OnItemLifted( Mobile from, Item item )
                {
                  if( item.IsChildOf(from.Backpack)  )
                  {
                      from.Dex -=  _howmany
                  }
                      base.OnItemLifted(from,item);
                }
*/
 
        public NecroCharm( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
                      writer.Write( (int) _20 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
int _20 = reader.ReadInt();
                      /*
                        switch( version )
                        {
                          case 0:
                          {
                           
                              break;
                          }
                        } */
        }
    }
}
 

zerodowned

Sorceror
i think the problem is the script is going, Necromancy?! what's that!?

so what you need to do is at the top of the script under

using System;
using Server.Network;
using Server.Items;

add

using Server.Spells.Necromancy;
 

jayates

Sorceror
I added it where you said and got the same error: Line 30: The type or namespace name 'from' could not be found < are you mising a using directive or an assembly reference?>
Also, got this one now.
Line 32 and also Line 42: 'Server.Mobile' does not contain a definition for Necromancy'
Thank you.
 

zerodowned

Sorceror
can you post one of the other charms so i can take a look at it? in code brackets like your first post.
if there's one that also increases a skill that would be preferable. i think i know how to fix it just at work and don't have a lot of free time.
 

jayates

Sorceror
Nah, still says 'from' could not be found. Also says Server.Mobiles does not contain a definition for "SkillName"
Here's the script as of now:
Code:
using System;
using Server.Network;
using Server.Items;
using Server.Spells.Necromancy;
 
namespace Server.Items
{
    public class NecroCharm : Item
    {     
           
          private int _20;
 
        [Constructable]
        public NecroCharm() : this(1)
        {
         
        }   
        [Constructable]
        public NecroCharm(int amount) : base( 0xE73 )
        {
                _20 =amount;
            Weight = 1.0;
            //  LootType = LootType.Blessed;
              Name = "<BASEFONT COLOR=#006300> +"+_20+" Necro Charm </b>";
        }
 
                public override bool OnDroppedInto( Mobile from, Container target, Point3D p )
                {
                    if( target is from.Backpack|| target.IsChildOf( from.Backpack) )
                  {
                    from.SkillName.Necromancy += _20;
             
                      Movable = false;
                  }
                      return base.OnDroppedInto(from,target,p);
                }
                public override void OnDoubleClick( Mobile from )
        {
            if ( IsChildOf( from.Backpack ) &&  Movable == false )
            {
                from.SkillName.Necromancy -= _20;
             
                Movable = true;
            }
            else
            {
                from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
            }
        }
 
/* 
//remove  Movable = false    OnDroppedInto
              public override void OnItemLifted( Mobile from, Item item )
                {
                  if( item.IsChildOf(from.Backpack)  )
                  {
                      from.Dex -=  _howmany
                  }
                      base.OnItemLifted(from,item);
                }
*/
 
        public NecroCharm( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
                      writer.Write( (int) _20 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
int _20 = reader.ReadInt();
                      /*
                        switch( version )
                        {
                          case 0:
                          {
                         
                              break;
                          }
                        } */
        }
    }
}

This is the original code:
Code:
using System;
using Server.Network;
using Server.Items;
 
namespace Server.Items
{
    public class DexCharm : Item
    {       
             
          private int _howmany;
 
        [Constructable]
        public DexCharm() : this(1)
        {
           
        }     
        [Constructable]
        public DexCharm(int anountt) : base( 0xE73 )
        {
                _howmany =anountt;
            Weight = 1.0;
            //  LootType = LootType.Blessed;
              Name = "<BASEFONT COLOR=#006300> +"+_howmany+" Dex Charm </b>";
        }
 
                public override bool OnDroppedInto( Mobile from, Container target, Point3D p )
                {
                    if( target is from.Backpack|| target.IsChildOf( from.Backpack) )
                  {
                      from.Dex += _howmany;
               
                      Movable = false;
                  }
                      return base.OnDroppedInto(from,target,p);
                }
                public override void OnDoubleClick( Mobile from )
        {
            if ( IsChildOf( from.Backpack ) &&  Movable == false )
            {
                from.Dex -= _howmany;
               
                Movable = true;
            }
            else
            {
                from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
            }
        }
/*   
//remove  Movable = false    OnDroppedInto
              public override void OnItemLifted( Mobile from, Item item )
                {
                  if( item.IsChildOf(from.Backpack)  )
                  {
                      from.Dex -=  _howmany;
                  }
                      base.OnItemLifted(from,item);
                }
*/
        public DexCharm( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
                      writer.Write( (int) _howmany ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
int _howmany = reader.ReadInt();
                      /*
                        switch( version )
                        {
                          case 0:
                          {
                           
                              break;
                          }
                        } */
        }
    }
}
 

zerodowned

Sorceror
:confused: too busy to work on it at the moment, will need to do some testing when I get home

there is a SkillBonuses.SetValues( 0, SkillName.Necromancy, 10.0 ); but that i think will only work if the item is worn

and i'm just going to put this here for future ref for myself or whoever looks at it

C#:
public Mobile Owner
{
get
{
return m_Owner;
}
set
{
if( m_Owner != value )
{
if( m_Owner != null )
m_Owner.RemoveSkillMod( this );
m_Owner = value;
if( m_Owner != value )
m_Owner.AddSkillMod( this );
}
}
}
 
Top