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!

[set [props item restriction!

Giraffe

Wanderer
[set [props item restriction!

I Have donation tokens in my shard but i want to make it so that only the owners (at this point) can Edit Them ... Right now i have it so only owners can [add them and they cannot be Duped by anyone but if say a GM gets their hands on some and want a few more all they have to do is [props and change the amount or [set amount how do i restrict these to a certain access level or make it so no one can do it ... I Have been trying for over a week all sorts of ways i have changed everything i had back to before i started trying to remove the [props,[set access.. is there a way to do it through the item or what im totally lost ive searched hundreds of scripts and cant find anything ... Help Please!

Donation Tokens Only Rewards Tokens Im Not Worried About!

PHP:
using System;

namespace Server.Items
{
	public class DonationToken : Item
	{
		public override double DefaultWeight
		{
			get { return 0.02; }
		}


        [Constructable(AccessLevel.Owner)]
		public DonationToken() : this( 1 )
		{            
		}


        [Constructable(AccessLevel.Owner)]
		public DonationToken( int amountFrom, int amountTo ) : this( Utility.RandomMinMax( amountFrom, amountTo ) )
		{
		}


        [Constructable(AccessLevel.Owner)]
		public DonationToken( int amount ) : base( 0xEED )
		{
			Stackable = true;
			Amount = amount;
            Hue = 37;
            Name = "Donation Token";
		}

        public DonationToken(Serial serial): base(serial)
		{
		}

		public override int GetDropSound()
		{
			if ( Amount <= 1 )
				return 0x2E4;
			else if ( Amount <= 5 )
				return 0x2E5;
			else
				return 0x2E6;
		}

		protected override void OnAmountChange( int oldValue )
		{
			int newValue = this.Amount;

            UpdateTotal(this, TotalType.Gold, newValue - oldValue);
		}

		public override int GetTotal( TotalType type )
		{
			int baseTotal = base.GetTotal( type );

			if ( type == TotalType.Gold )
				baseTotal += this.Amount;

			return baseTotal;
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
		}
	}

    public class RewardToken : Item
    {
        public override double DefaultWeight
        {
            get { return 0.02; }
        }

        [Constructable]
        public RewardToken() : this(1)
        {
            
        }

        [Constructable]
        public RewardToken(int amountFrom, int amountTo)
            : this(Utility.RandomMinMax(amountFrom, amountTo))
        {
        }

        [Constructable]
        public RewardToken(int amount): base(0xEED)
        {
            Stackable = true;
            Amount = amount;
            Hue = 1072;
            Name = "Reward Token";
        }

        public RewardToken(Serial serial)
            : base(serial)
        {
        }

        public override int GetDropSound()
        {
            if (Amount <= 1)
                return 0x2E4;
            else if (Amount <= 5)
                return 0x2E5;
            else
                return 0x2E6;
        }

        protected override void OnAmountChange(int oldValue)
        {
            int newValue = this.Amount;

           UpdateTotal(this, TotalType.Gold, newValue - oldValue);
        }

        public override int GetTotal(TotalType type)
        {
            int baseTotal = base.GetTotal(type);

            if (type == TotalType.Gold)
               baseTotal += this.Amount;

            return baseTotal;
        }



        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)0); // version
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
        }
    }
}

Any Help Is Greatly Appreciated!

Thanks!
 
would be a pain, but this could work

make a new variable amount2, set it to owner only

then set an override for invalidateproperties (make sure to call the base.invalidateprop also)

in there have it check that if amount != amount2 to delete the item, or reset it to the amount, etc

then in the scripts that takes amounts away (i.e. stone that uses it for cash) also have it modify the amount2 variable also
 

Giraffe

Wanderer
uhhhh

Wow!

ok so im sorry i dont want to take your time but ... How TO? ... im still really new and will only ask

make a new variable amount2, set it to owner only


then set an override for invalidateproperties (make sure to call the base.invalidateprop also)

means? private.public override InvalidateProperties() ...

and

if (!amount = amount2)
delete.item;

and i understand the last line ...

again sorry for not knowing very much

And Thank you so MUCH!
 
look in many other scrips for command property of a variable, and see how it is set to gamemaster, make it owner, otherwaise just an other intiger variable

yes public override
can look in many scripts of how to do a publick override using void -- might not be any to inval props, but many void ones outh there

have it
if(amount2 != amount)
a single = will try to set it so they equal and can't at that point
and would be
item.Delete();
 

Giraffe

Wanderer
cant find override invalidtae properties

This is what i have thus far but i cannot find the override Identifiers? for InvalidateProperties

i have searched with search to check inside all the files and i cannot find it to check but heres my tokens.cs
PHP:
using System;

namespace Server.Items
{
	public class DonationToken : Item
	{
        
        public override double DefaultWeight
		{
			get { return 0.02; }
		}

        [CommandProperty(AccessLevel.Owner)]
        public int Amount2    
        {
            get { return m_Amount2; }
            set { m_Amount2 = value; InvalidateProperties(); }
        }

        [Constructable(AccessLevel.Owner)]
		public DonationToken() : this( 1 )
		{            
		}


        [Constructable(AccessLevel.Owner)]
		public DonationToken( int amountFrom, int amountTo ) : this( Utility.RandomMinMax( amountFrom, amountTo ) )
		{
		}


        [Constructable(AccessLevel.Owner)]
		public DonationToken( int amount2 ) : base( 0xEED )
		{
			Stackable = true;
			Amount2 = amount2;
            Hue = 37;
            Name = "Donation Token";
		}

        public DonationToken(Serial serial): base(serial)
		{
		}

		public override int GetDropSound()
		{
			if ( Amount2 <= 1 )
				return 0x2E4;
			else if ( Amount2 <= 5 )
				return 0x2E5;
			else
				return 0x2E6;
		}

		protected override void OnAmountChange( int oldValue )
		{
			int newValue = this.Amount2;

            UpdateTotal(this, TotalType.Gold, newValue - oldValue);
		}

        public override void InvalidateProperties()
        {
            if (amount2 != amount)
                Item.Delete();
        }

		public override int GetTotal( TotalType type )
		{
			int baseTotal = base.GetTotal( type );

			if ( type == TotalType.Gold )
				baseTotal += this.Amount2;

			return baseTotal;
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
		}
	}

    public class RewardToken : Item
    {
        public override double DefaultWeight
        {
            get { return 0.02; }
        }

        [Constructable]
        public RewardToken() : this(1)
        {
            
        }

        [Constructable]
        public RewardToken(int amountFrom, int amountTo)
            : this(Utility.RandomMinMax(amountFrom, amountTo))
        {
        }

        [Constructable]
        public RewardToken(int amount): base(0xEED)
        {
            Stackable = true;
            Amount = amount;
            Hue = 1072;
            Name = "Reward Token";
        }

        public RewardToken(Serial serial)
            : base(serial)
        {
        }

        public override int GetDropSound()
        {
            if (Amount <= 1)
                return 0x2E4;
            else if (Amount <= 5)
                return 0x2E5;
            else
                return 0x2E6;
        }

        protected override void OnAmountChange(int oldValue)
        {
            int newValue = this.Amount;

           UpdateTotal(this, TotalType.Gold, newValue - oldValue);
        }

        public override int GetTotal(TotalType type)
        {
            int baseTotal = base.GetTotal(type);

            if (type == TotalType.Gold)
               baseTotal += this.Amount;

            return baseTotal;
        }



        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)0); // version
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
        }
    }
}

Just point me in the direction of a script or whatever ... thanks
 

Lokai

Knight
I think these will do what you are needing:

Code:
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]private [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] m_OwnerAmount;[/SIZE]
 
[SIZE=2][[/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]CommandProperty[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]AccessLevel[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Owner)][/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]public [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] OwnerAmount[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]    get[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] { [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] m_OwnerAmount; }[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]    set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] { m_OwnerAmount = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]value[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]; Amount = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]value[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]; InvalidateProperties(); }[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]protected [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]override [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] OnAmountChange([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] oldValue)[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]    if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (Amount != OwnerAmount) Amount = oldValue;[/SIZE]
[SIZE=2]}[/SIZE]
 

Giraffe

Wanderer
Player Stacking = RunUO Error

I Implemented the code lokai suggested it works great except when a player tries to seperate them i get this error that causes runuo to crash not the server the whole runuo program ... something about stackableoverflow error ... sometimes i would try pulling 5 off the stack it would leave one there and make a new pile of 10 i can do this over and over ... how do i get the piles to adjust appropriately ... it will error the runuo core if i try to seperate them but if i give them more then try to seperate it does the whole move stack and leave one behind

or Stack them they just go to whatever the stack im piling onto's value so if i stack 10 onto 10 i still have 10 when im done

Heres my Script

Token.cs
PHP:
using System;

namespace Server.Items
{
	public class DonationToken : Item
	{
        
        public override double DefaultWeight
		{
			get { return 0.02; }
		}

        private int m_OwnerAmount;

        [CommandProperty(AccessLevel.Owner)]
        public int OwnerAmount
        {
            get { return m_OwnerAmount; }
            set { m_OwnerAmount = value; Amount = value; InvalidateProperties(); }
        }
        
        [Constructable(AccessLevel.Owner)]
		public DonationToken() : this( 1 )
		{           
		}


        [Constructable(AccessLevel.Owner)]
		public DonationToken( int amountFrom, int amountTo ) : this( Utility.RandomMinMax( amountFrom, amountTo ) )
		{
		}


        [Constructable(AccessLevel.Owner)]
        public DonationToken(int m_OwnerAmount): base(0xEED)
		{
			Stackable = true;
			OwnerAmount = m_OwnerAmount;
            Hue = 37;
            
		}

        public DonationToken(Serial serial): base(serial)
		{
		}

		public override int GetDropSound()
		{
			if ( OwnerAmount <= 1 )
				return 0x2E4;
			else if ( OwnerAmount <= 5 )
				return 0x2E5;
			else
				return 0x2E6;
		}

        protected override void OnAmountChange(int oldValue)
        {
            if (Amount != OwnerAmount) Amount = oldValue;
        }
                
		public override int GetTotal( TotalType type )
		{
			int baseTotal = base.GetTotal( type );

			if ( type == TotalType.Gold )
				baseTotal += this.OwnerAmount;

			return baseTotal;
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
		}
	}

    public class RewardToken : Item
    {
        public override double DefaultWeight
        {
            get { return 0.02; }
        }

        [Constructable]
        public RewardToken() : this(1)
        {
            
        }

        [Constructable]
        public RewardToken(int amountFrom, int amountTo)
            : this(Utility.RandomMinMax(amountFrom, amountTo))
        {
        }

        [Constructable]
        public RewardToken(int amount): base(0xEED)
        {
            Stackable = true;
            Amount = amount;
            Hue = 1072;
            Name = "Reward Token";
        }

        public RewardToken(Serial serial)
            : base(serial)
        {
        }

        public override int GetDropSound()
        {
            if (Amount <= 1)
                return 0x2E4;
            else if (Amount <= 5)
                return 0x2E5;
            else
                return 0x2E6;
        }

        protected override void OnAmountChange(int oldValue)
        {
            int newValue = this.Amount;

           UpdateTotal(this, TotalType.Gold, newValue - oldValue);
        }

        public override int GetTotal(TotalType type)
        {
            int baseTotal = base.GetTotal(type);

            if (type == TotalType.Gold)
               baseTotal += this.Amount;

            return baseTotal;
        }



        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)0); // version
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
        }
    }
}

This is way outta my league any help would be awesome
 

Lokai

Knight
I see the problem.

I don't have time to look at the whole thing, or write it up, but I can tell you this much: if you override the OnDragDrop method or some of the other OnDrop...whatever methods, you should be able to meet those conditions. I don't know if there is like an 'OnCombined' method or whatever....maybe someone else can chime in on this one, if they have the time.
 

Giraffe

Wanderer
Still Lost

I Have Played Around And Searched for a drag drop and couldnt find on that works for amounts and math and stuff like that ... i am also having issues with spending them if i try to purchase something with them it also crashes the core ... thank you all for your help ... i just deleted everything i had i was getting about 8 erorrs on the dragdrop override so a hint in the direction would be awesome!
 

Aquatic Elf

Sorceror
Code:
[CommandProperty( AccessLevel.Owner )]
[B][SIZE="3"]new[/SIZE][/B] public int Amount
{
	get{ return base.Amount; }
	set{ base.Amount = value; }
}
 
Top