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!

Account bound items

Baralis

Sorceror
I am wishing to start all new accounts with a set of soul stones. This I can do, however I cannot figure out how to bind them to their accounts. Any pointers would be appreciated!
 

KnitePrince

Sorceror
I have several weapons and other things that I make bond to the player.. this is just an example for the Ancient battle blades, but you might be able to mod it to do what you want, hope it helps;

public override void OnDoubleClick(Mobile from)
{

if (m_Owner == null)
{
m_Owner = from;
this.Name = m_Owner.Name.ToString() + "'s Ancient BattleBlades";
from.SendMessage("These Ancient BattleBlades are now Bound to you! You feel the warmth spread through your body.");
}
else
{
if (m_Owner != from)
{
from.SendMessage("The Blades will not allow you to wield them.");
return;
}
}
}
 

Baralis

Sorceror
Ok scratch that. I dont have it. I was trying to add them like I did with the personal bless deeds..

PackItem( new BlueSoulstone(m) );

But that does not work for SS.
 

milva

Sorceror
Have you checked the SoulStone script? Scripts/Items/Special- you should be able to
find a code in there to test around with ;)
 

Hammerhand

Knight
Try
PackItem(new SoulStone());
The SoulStone needs both parts in caps, you had Soulstone, also, not sure you can call a hue on it that way...
 

Baralis

Sorceror
Thanks for the replies.

I can add the soul stones on character creation fine, however they are not account bound and cannot be used. I have looked in the SS script for a direction but unfortunately they do not currently bind to an account and have to be set by proping and entering the account name. Clearly this method for every account made on the server would be very labor intensive and not a viable option. So I am wishing to add them to each new account onto the first character and have them bound to that account.
 

Talow

Sorceror
Change the adding to something like this.
PackItem( new Soulstone(m.Account) );

I don't know for sure that the soulstone.cs is the default one, but in my scripts, there are 4 constructors for the soulstone.

One takes no arguments to create, with no arguments the Account of the stone will be null.

The next has one argument of account.
This will create a soulstone with account = to the argument passed. This is the one you are wanting to use to bind the stone to your account.
 

Talow

Sorceror
To be able to add an account bound by using the mobile instead, you would want to add another constructor to the SoulStone class, something like this

Code:
public SoulStone(Mobile m) : this(m.Account)
{
}
 

Baralis

Sorceror
Ok this is what I have in Soulstone.cs

Code:
[Constructable]
        public SoulStone( string account )
            : this( account, 0x2A93, 0x2A94 )
        {
        }
        public SoulStone(Mobile m) : this(m.Account)
        {
        }
        public SoulStone( string account, int itemID )
            : this( account, itemID, itemID )
        {
        }

        public SoulStone( string account, int inactiveItemID, int activeItemID ) : base( inactiveItemID )
        {
            Light = LightType.Circle300;
            LootType = LootType.Blessed;

            m_InactiveItemID = inactiveItemID;
            m_ActiveItemID = activeItemID;

            m_Account = account;
        }

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

What I have in charactercreation.cs

Code:
public class CharacterCreation
    {
        public static void Initialize()
        {
            // Register our event handler
            EventSink.CharacterCreated += new CharacterCreatedEventHandler( EventSink_CharacterCreated );
        }

        private static void AddBackpack( Mobile m )
        {
            Container pack = m.Backpack;
           
            if ( pack == null )
            {
                pack = new Backpack();
                pack.Movable = false;

                m.AddItem( pack );
            }

            PackItem( new RedBook( "a book", m.Name, 20, true ) );
            PackItem( new Gold( 1000 ) ); // Starting gold can be customized here
            PackItem( new Dagger() );
            PackItem( new Candle() );
            PackItem( new PersonalBlessDeed(m) ); 
            PackItem( new SoulStone(m.Account) );

        }

And this is the errors I get:

RunUO - [www.runuo.com] Version 2.1, Build 4293.39484
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 4 64-bit processors

Errors:
+ Items/Special/SoulStone.cs:
CS0121: Line 113: The call is ambiguous between the following methods or pro
perties: 'Server.Items.SoulStone.SoulStone(string)' and 'Server.Items.SoulStone.
SoulStone(Server.Mobile)'
CS1502: Line 123: The best overloaded method match for 'Server.Items.SoulSto
ne.SoulStone(string)' has some invalid arguments
CS1503: Line 123: Argument '1': cannot convert from 'Server.Accounting.IAcco
unt' to 'string'
+ Misc/CharacterCreation.cs:
CS1502: Line 35: The best overloaded method match for 'Server.Items.SoulSton
e.SoulStone(string)' has some invalid arguments
CS1503: Line 35: Argument '1': cannot convert from 'Server.Accounting.IAccou
nt' to 'string'
 

Talow

Sorceror
Change:
Code:
public SoulStone(Mobile m) : this(m.Account)
        {
        }
to:
Code:
public SoulStone(Mobile m) : this(m.Account.Username)
        {
        }
 
Top