Milva

Moderator
Milva submitted a new resource:

ACC YardSystem - Yard, decorate

Updated to work with the new Banker system
Thanks to @Dexter_Lexia for helping with the code
You can use gold in the pack or bank
Since the yard decorator had the name interior decorator when added in game-I went ahead and added a name in the script.
SS to show how this would work - it does charge players to use -the yard shovel is what is used to place the items.
*** Not my Script***
View attachment 13134

Read more about this resource...
 
I remember years ago in runuo this had an inherent issue. Players could put up a small house, put down deco then collapse the house. The deco would stay. also the owner of the deco would not transfer.

I have the basehouse edits somewhere that I used for this.
 
I am not sure how well this will interface directly into servuo and I think I have included all pieces. I wrote this about 5 years ago and recently started thinking about uo emulation again. I added the following functions and function calls in basehouse.cs

Add this to the onSecureTrade function:

C#:
m_House.transferyard(to); // calls class to transfer the yard tool items to the new owner

function to transfer yard:
        public void transferyard(Mobile to)
        {
            ArrayList Yardcrap = new ArrayList();
            foreach (Item item in this.GetItemsInRange(42)) // find all items with a 75 tile radius of the fallen house's position.
            {
                if (item is YardItem)
                {
                    YardItem yi = item as YardItem;
                    if (!yi.Deleted)
                    {
                        if (yi.LinkedHouse != null && yi.LinkedHouse == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
                if (item is YardIronGate)
                {
                    YardIronGate yi = item as YardIronGate;
                    if (!yi.Deleted)
                    {
                        if (yi.LinkedHouse != null && yi.LinkedHouse == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
                if (item is YardStair)
                {
                    YardStair yi = item as YardStair;
                    if (!yi.Deleted)
                    {
                        if (yi.LinkedHouse != null && yi.LinkedHouse == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
            }
            for (int i = 0; i < Yardcrap.Count; ++i)
            {
                Item yard = (Item)Yardcrap[i];
                if (yard is YardStair)
                {
                    YardStair ys = yard as YardStair;
                    ys.Placer = to;
                    ys.Name = ys.Placer.Name + "'s Yard";
                }
                if (yard is YardItem)
                {
                    YardItem ys = yard as YardItem;
                    ys.Placer = to;
                    ys.Name = ys.Placer.Name + "'s Yard";
                }
                if (yard is YardIronGate)
                {
                    YardIronGate ys = yard as YardIronGate;
                    ys.Placer = to;
                    ys.Name = ys.Placer.Name + "'s Yard";
                }
            }
        }

that will transfer the yard from one home owner to the next. This prevents the old owner from taking down all the deco after the house is sold.

Now to ensure the yard gets deleted when a house is collapsed so players do not take it upon themselves to deco your shard with 18 million items.

This needs to be added to the onDelete function:

C#:
deleteyard();

Then add this function to actually delete the yard:

function to delete yard:
        public void deleteyard()
        {
            ArrayList Yardcrap = new ArrayList();
            foreach (Item item in this.GetItemsInRange(42)) // find all items with a 75 tile radius of the fallen house's position.
            {
                if (item is YardItem)
                {
                    YardItem yi = item as YardItem;
                    if (!yi.Deleted)
                    {
                        if (yi.LinkedHouse != null && yi.LinkedHouse == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
                if (item is YardIronGate)
                {
                    YardIronGate yi = item as YardIronGate;
                    if (!yi.Deleted)
                    {
                        if (yi.LinkedHouse != null && yi.LinkedHouse == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
                if (item is YardStair)
                {
                    YardStair yi = item as YardStair;
                    if (!yi.Deleted)
                    {
                        if (yi.LinkedHouse != null && yi.LinkedHouse == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
            }
            for (int i = 0; i < Yardcrap.Count; ++i)
            {
                Item yard = (Item)Yardcrap[i];
                yard.Delete();
            }
        }
 
I got a good chuckle out of the array named Yardcrap. It's descriptive and self-explanatory all at the same time :D
Post automatically merged:

Note that in YardItem.cs it needs to be updated from :
Code:
loc.Z -= TileData.ItemTable[((StaticTarget)t).ItemID & 0x3FFF].CalcHeight;

to
Code:
loc.Z -= TileData.ItemTable[((StaticTarget)t).ItemID & 0x7FFF].CalcHeight;

to account for the increased number of item tiles in the clients that are newer than when the script was written. Otherwise the wand won't recognize newer building tile sets.
Post automatically merged:

And a similar edit on line 47 in YardTarget for the same reason.
 
Last edited:
Glad you got a laugh out of it. I was 16 hours into debugging various issues when that got dropped on me as a "must do right now". I was about to go serious bad on the array name but pulled it back to "yardcrap".

From what I remember (this was 5 years ago) I had some players help me do some fairly extensive testing on yard transfers and yard deletes. No clue how ServUO will view these changes as I have not tried the yard wand since I started playing around last week.
 
Any Updates for this script? Has anyone changed the way stuff is deleted? Right now if I double click on the trees I place they just disappear and it says money was deposited into my account in the system messages.
 
That's how you remove the items you've placed... They won't disappear if someone else double-clicks them.
Yeah I get that. Just seems to easy to remove on accident.
Post automatically merged:

I am not sure how well this will interface directly into servuo and I think I have included all pieces. I wrote this about 5 years ago and recently started thinking about uo emulation again. I added the following functions and function calls in basehouse.cs

Add this to the onSecureTrade function:

C#:
m_House.transferyard(to); // calls class to transfer the yard tool items to the new owner

function to transfer yard:
        public void transferyard(Mobile to)
        {
            ArrayList Yardcrap = new ArrayList();
            foreach (Item item in this.GetItemsInRange(42)) // find all items with a 75 tile radius of the fallen house's position.
            {
                if (item is YardItem)
                {
                    YardItem yi = item as YardItem;
                    if (!yi.Deleted)
                    {
                        if (yi.LinkedHouse != null && yi.LinkedHouse == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
                if (item is YardIronGate)
                {
                    YardIronGate yi = item as YardIronGate;
                    if (!yi.Deleted)
                    {
                        if (yi.LinkedHouse != null && yi.LinkedHouse == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
                if (item is YardStair)
                {
                    YardStair yi = item as YardStair;
                    if (!yi.Deleted)
                    {
                        if (yi.LinkedHouse != null && yi.LinkedHouse == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
            }
            for (int i = 0; i < Yardcrap.Count; ++i)
            {
                Item yard = (Item)Yardcrap[i];
                if (yard is YardStair)
                {
                    YardStair ys = yard as YardStair;
                    ys.Placer = to;
                    ys.Name = ys.Placer.Name + "'s Yard";
                }
                if (yard is YardItem)
                {
                    YardItem ys = yard as YardItem;
                    ys.Placer = to;
                    ys.Name = ys.Placer.Name + "'s Yard";
                }
                if (yard is YardIronGate)
                {
                    YardIronGate ys = yard as YardIronGate;
                    ys.Placer = to;
                    ys.Name = ys.Placer.Name + "'s Yard";
                }
            }
        }

that will transfer the yard from one home owner to the next. This prevents the old owner from taking down all the deco after the house is sold.

Now to ensure the yard gets deleted when a house is collapsed so players do not take it upon themselves to deco your shard with 18 million items.

This needs to be added to the onDelete function:

C#:
deleteyard();

Then add this function to actually delete the yard:

function to delete yard:
        public void deleteyard()
        {
            ArrayList Yardcrap = new ArrayList();
            foreach (Item item in this.GetItemsInRange(42)) // find all items with a 75 tile radius of the fallen house's position.
            {
                if (item is YardItem)
                {
                    YardItem yi = item as YardItem;
                    if (!yi.Deleted)
                    {
                        if (yi.LinkedHouse != null && yi.LinkedHouse == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
                if (item is YardIronGate)
                {
                    YardIronGate yi = item as YardIronGate;
                    if (!yi.Deleted)
                    {
                        if (yi.LinkedHouse != null && yi.LinkedHouse == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
                if (item is YardStair)
                {
                    YardStair yi = item as YardStair;
                    if (!yi.Deleted)
                    {
                        if (yi.LinkedHouse != null && yi.LinkedHouse == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
            }
            for (int i = 0; i < Yardcrap.Count; ++i)
            {
                Item yard = (Item)Yardcrap[i];
                yard.Delete();
            }
        }
Add this all in the basehouse cs?
 
C#:
        public void transferyard(Mobile to)
        {
            ArrayList Yardcrap = new ArrayList();
            foreach (Item item in this.GetItemsInRange(42)) // find all items with a 75 tile radius of the fallen house's position.
            {
                if (item is YardItem)
                {
                    YardItem yi = item as YardItem;
                    if (!yi.Deleted)
                    {
                        if (yi.House != null && yi.House == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
                if (item is YardGate)
                {
                    YardGate yi = item as YardGate;
                    if (!yi.Deleted)
                    {
                        if (yi.House != null && yi.House == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
                if (item is YardStair)
                {
                    YardStair yi = item as YardStair;
                    if (!yi.Deleted)
                    {
                        if (yi.House != null && yi.House == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
            }
            for (int i = 0; i < Yardcrap.Count; ++i)
            {
                Item yard = (Item)Yardcrap[i];
                if (yard is YardStair)
                {
                    YardStair ys = yard as YardStair;
                    ys.Placer = to;
                    ys.Name = ys.Placer.Name + "'s Yard";
                }
                if (yard is YardItem)
                {
                    YardItem ys = yard as YardItem;
                    ys.Placer = to;
                    ys.Name = ys.Placer.Name + "'s Yard";
                }
                if (yard is YardGate)
                {
                    YardGate ys = yard as YardGate;
                    ys.Placer = to;
                    ys.Name = ys.Placer.Name + "'s Yard";
                }
            }
        }

C#:
        public void deleteyard()
        {
            ArrayList Yardcrap = new ArrayList();
            foreach (Item item in this.GetItemsInRange(42)) // find all items with a 75 tile radius of the fallen house's position.
            {
                if (item is YardItem)
                {
                    YardItem yi = item as YardItem;
                    if (!yi.Deleted)
                    {
                        if (yi.House != null && yi.House == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
                if (item is YardGate)
                {
                    YardGate yi = item as YardGate;
                    if (!yi.Deleted)
                    {
                        if (yi.House != null && yi.House == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
                if (item is YardStair)
                {
                    YardStair yi = item as YardStair;
                    if (!yi.Deleted)
                    {
                        if (yi.House != null && yi.House == this)
                        {
                            Yardcrap.Add(item);
                        }
                    }
                }
            }
            for (int i = 0; i < Yardcrap.Count; ++i)
            {
                Item yard = (Item)Yardcrap[i];
                yard.Delete();
            }
        }
 
getting these errors on publish 57


Errors:
+ Multis/BaseHouse.cs:
CS0246: Line 3867: The type or namespace name 'ArrayList' could not be found (are you missing a using directive or an assembly reference?)

CS0246: Line 3867: The type or namespace name 'ArrayList' could not be found (are you missing a using directive or an assembly reference?)

CS0019: Line 3904: Operator '<' cannot be applied to operands of type 'int' and 'method group'

CS1061: Line 2197: 'BaseHouse' does not contain a definition for 'transferyard' and no accessible extension method 'transferyard' accepting a
first argument of type 'BaseHouse' could be found (are you missing a using directive or an assembly reference?)

CS0246: Line 2204: The type or namespace name 'ArrayList' could not be found (are you missing a using directive or an assembly reference?)

CS0246: Line 2204: The type or namespace name 'ArrayList' could not be found (are you missing a using directive or an assembly reference?)

CS0019: Line 2212: Operator '==' cannot be applied to operands of type 'BaseHouse' and 'BaseHouse.TransferItem'

CS0019: Line 2223: Operator '==' cannot be applied to operands of type 'BaseHouse' and 'BaseHouse.TransferItem'

CS0019: Line 2234: Operator '==' cannot be applied to operands of type 'BaseHouse' and 'BaseHouse.TransferItem'

CS0019: Line 2241: Operator '<' cannot be applied to operands of type 'int' and 'method group'

Scripts: One or more scripts failed to compile or no script files were found.
 
This is the one i made from Keldons posts. it should work perfectly. I recommend looking at the original basehouse from pub 57 and comparing it to this one in either notepad++ or winmerge just so you can see what you were missing... There multiple namespaces are needed.
 

Attachments

  • BaseHouse.cs
    161.6 KB · Views: 15
Back