Badluck

Member
Hello Helper.. :)

I would like to make 1 uses in the HousePlacementTool..
after that the HousePlacementTool should be deleted....

could someone help me with this?..I myself have little experience with scripts...I would be really happy....

sorry for the bad english.. :(
 
Find the line "public virtual void OnPlacement(BaseHouse house)
{
}"

And replace it with
"
public virtual void OnPlacement(BaseHouse house)
{
this.Delete();
}
"
 
i can't find the entry "public virtual void OnPlacement(BaseHouse house)" neither in BaseHouse nor in HousePlacementTool
Post automatically merged:

 

Attachments

  • HousePlacementTool.cs
    45.3 KB · Views: 4
Last edited:
+ Multis/HousePlacementTool.cs:
CS0117: Line 128: 'Server.Core' enthält keine Definition für 'EJ'.
CS0117: Line 266: 'Server.Multis.BaseHouse' enthält keine Definition für 'GlobalBonusStorageScalar'.
CS0117: Line 267: 'Server.Multis.BaseHouse' enthält keine Definition für 'GlobalBonusStorageScalar'.
CS0103: Line 564: Der Name 'Siege' ist im aktuellen Kontext nicht vorhanden.
CS0246: Line 403: Der Typ- oder Namespacename 'TrinsicKeep' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0246: Line 404: Der Typ- oder Namespacename 'GothicRoseCastle' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0246: Line 405: Der Typ- oder Namespacename 'ElsaCastle' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0246: Line 406: Der Typ- oder Namespacename 'Spires' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0246: Line 407: Der Typ- oder Namespacename 'CastleOfOceania' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0246: Line 408: Der Typ- oder Namespacename 'FeudalCastle' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0246: Line 409: Der Typ- oder Namespacename 'RobinsNest' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0246: Line 410: Der Typ- oder Namespacename 'TraditionalKeep' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0246: Line 411: Der Typ- oder Namespacename 'VillaCrowley' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0246: Line 412: Der Typ- oder Namespacename 'DarkthornKeep' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0246: Line 413: Der Typ- oder Namespacename 'SandalwoodKeep' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0246: Line 414: Der Typ- oder Namespacename 'CasaMoga' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0246: Line 416: Der Typ- oder Namespacename 'RobinsRoost' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0246: Line 417: Der Typ- oder Namespacename 'Camelot' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0246: Line 418: Der Typ- oder Namespacename 'LacrimaeInCaelo' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0246: Line 419: Der Typ- oder Namespacename 'OkinawaSweetDreamCastle' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0246: Line 420: Der Typ- oder Namespacename 'TheSandstoneCastle' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0246: Line 421: Der Typ- oder Namespacename 'GrimswindSisters' konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
CS0117: Line 575: 'Server.Core' enthält keine Definition für 'EJ'.
CS0117: Line 776: 'Server.Multis.BaseHouse' enthält keine Definition für 'CheckAccountHouseLimit'.
CS1061: Line 803: 'Server.Multis.HouseFoundation' enthält keine Definition für 'OnPlacement', und es konnte keine Erweiterungsmethode 'OnPlacement' gefunden werden, die ein erstes Argument vom Typ 'Server.Multis.HouseFoundation' akzeptiert (Fehlt eine Using-Direktive oder ein Assemblyverweis?).
CS0117: Line 1090: 'Server.Multis.BaseHouse' enthält keine Definition für 'GlobalBonusStorageScalar'.
CS0117: Line 1091: 'Server.Multis.BaseHouse' enthält keine Definition für 'GlobalBonusStorageScalar'.
CS1502: Line 1139: Die beste Übereinstimmung für die überladene 'System.Collections.Generic.List<Server.Mobile>.List(int)'-Methode hat einige ungültige Argumente.
CS1503: Line 1139: Argument '1': Konvertierung von 'System.Collections.ArrayList' in 'int' nicht möglich.
CS1502: Line 1140: Die beste Übereinstimmung für die überladene 'System.Collections.Generic.List<Server.Mobile>.List(int)'-Methode hat einige ungültige Argumente.
CS1503: Line 1140: Argument '1': Konvertierung von 'System.Collections.ArrayList' in 'int' nicht möglich.
CS1502: Line 1141: Die beste Übereinstimmung für die überladene 'System.Collections.Generic.List<Server.Mobile>.List(int)'-Methode hat einige ungültige Argumente.
CS1503: Line 1141: Argument '1': Konvertierung von 'System.Collections.ArrayList' in 'int' nicht möglich.
CS1502: Line 1142: Die beste Übereinstimmung für die überladene 'System.Collections.Generic.List<Server.Mobile>.List(int)'-Methode hat einige ungültige Argumente.
CS1503: Line 1142: Argument '1': Konvertierung von 'System.Collections.ArrayList' in 'int' nicht möglich.
Scripts: One or more scripts failed to compile or no script files were found.
Post automatically merged:


Post automatically merged:

this does not work for me :(
 
Without being able to fully read those errors, my guess is you are running an older version of ServUO or RunUO, and the file in question is for the newest version. I think those errors say all the Custom House Content houses are not found which is what is leading me to that assumption.
 
ok..got it..but can't you change my version of the HousePlacementTool?..or asked another way..does anyone have a version with 1 uses?
 
Ah yes I'm using ServUO 57. Try this line 449 add what he said to do

public bool OnPlacement( Mobile from, Point3D p )
{
if ( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null )
return false;

this.Delete();
 
hmm i can not download the file... "Oops! We ran into some problems."
Post automatically merged:

+ Multis/HousePlacementTool.cs:
CS1061: Line 703: 'Server.Items.HousePlacementEntry' enthält keine Definition für 'Delete', und es konnte keine Erweiterungsmethode 'Delete' gefunden werden, die ein erstes Argument vom Typ 'Server.Items.HousePlacementEntry' akzeptiert (Fehlt eine Using-Direktive oder ein Assemblyverweis?).
Scripts: One or more scripts failed to compile or no script files were found.
Post automatically merged:

 

Attachments

  • HousePlacementTool.cs
    45.6 KB · Views: 2
Last edited:
It is actually quite hard to achieve this because the tool isn't passed as a reference into the targeting method so the Delete() method won't work. Delete() at that point will be trying to delete the target location which it can't do and that is what I guess that error message you get is. I don't speak German sorry. I catch the odd word but not enough to make sense of that.

You would have to pass the tool reference into the targeting method, and then you could test for success and then call Delete().

That code is horribly written too. You don't need to use "this." for everything, as it is already implied. It makes it very hard to read. It isn't meant to
be used like that. It would be used though, to pass the tool into the targeting method by something like

Sorry I just realised this is a terrible example as you can't pass "this" there lol


protected override void OnTarget(Mobile from, object o, HousePlacementTool m_tool )

That's where "this" is used. It passes this tool into the called method.

and then in the targeting method you would add

private HousePlacementTool m_tool

This catches the tool reference into the method

Then after the successful target and house placement, you could delete the tool with

m_tool.Delete()

However, this is a very complex piece of code so it is not going to be as simple as that! It is using a gump as well so you might have to do it within the gump method. So pass the tool into the gump similarly to what I mentioned, and then when the house preview is up and you click the button to confirm you are happy with the placement, THEN you call the m_tool.Delete()

I'm afraid it will take someone with more knowledge of this script or at least more time than me, but that will hopefully set you off on the right track or help someone else to help you.

David

EDIT: Nope. Looking at the code some more, I'm really not sure how you would achieve this. The successful house placement and confirming you want it, returns m_Placed as true, but false if you cancel the placement or it fails. But I still can't see any way that you can use that because you simply cannot pass the tool reference into that whole system.
 
Last edited:
Thank you..for trying to help me......I thought that here in the forum are professionals for whom it is no problem to change the script.... I did not think that it is so difficult....but thanks to you
 
I'm not sure if there are many professional programmers in here although I am one myself, but not for UO stuff I'm afraid :) There are people in here who are very talented and knowledgeable and who wrote a lot of these scripts. The problem is that they are busy with real life like the rest of us and have their jobs and families to put first. Plus also we must all remember that they are not doing this for money, it is all out of the kindness of their hearts and with passion for the game that we all love.

Someone who knows this script will hopefully find this thread soon and jump in with a very easy solution but I'm afraid I just can't spare the time to spend on working it out.

I do question, though, why you want to delete the tool anyway. They can't use it if they don't have the money in the bank, after all, or if they already have the maximum number of houses you allow them
 
It is already clear to me that the people here only scripten for fun and many also have a real life (family, work)......but it could have been that there is someone who has a quick solution to my problem.....this is unfortunately not the case...can you do anything......I also hope that someone can help me..sometime.....
we have made another house building system... therefore you should be allowed to use the tool only 1x..it does not have to be deleted.....but you should be able to use it only 1x

Translated with www.DeepL.com/Translator (free version)
 
Change this section to this..
Code:
        public void PlacementWarning_Callback(Mobile from, bool okay, object state)
        {
        var hpt = from.Backpack.FindItemByType(typeof(HousePlacementTool));

            if (!from.CheckAlive() || from.Backpack == null || hpt == null)
                return;

then add this line after house.MoveToWorld(center, from.Map);

Code:
                            house.MoveToWorld(center, from.Map);
                            hpt.Delete();
 
dont work :(

CS0127: Line 609: Da 'Server.Items.HousePlacementEntry.PlacementWarning_Callback(Server.Mobile, bool, object)' 'void' zurückgibt, darf auf ein Rückgabeschlüsselwort kein Objektausdruck folgen.
 

Attachments

  • HousePlacementTool.cs
    46 KB · Views: 3
Code:
       public void PlacementWarning_Callback(Mobile from, bool okay, object state)
        {
            var hpt = from.Backpack.FindItemByType(typeof(HousePlacementTool));

            if (!from.CheckAlive() || from.Backpack == null || hpt == null)
                return;

            PreviewHouse prevHouse = (PreviewHouse)state;

            if (!okay)
            {
                prevHouse.Delete();
                return;
            }

            if (prevHouse.Deleted)
            {
                /* Too much time has passed and the test house you created has been deleted.
                * Please try again!
                */
                from.SendGump(new NoticeGump(1060637, 30720, 1060647, 32512, 320, 180, null, null));

                return;
            }

            Point3D center = prevHouse.Location;
            Map map = prevHouse.Map;

            prevHouse.Delete();

            ArrayList toMove;
            //Point3D center = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z );
            HousePlacementResult res = HousePlacement.Check(from, this.m_MultiID, center, out toMove);

            switch ( res )
            {
                case HousePlacementResult.Valid:
                    {
                        if (from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse(from))
                        {
                            from.SendLocalizedMessage(501271); // You already own a house, you may not place another!
                        }
                        else
                        {
                            BaseHouse house = this.ConstructHouse(from);

                            if (house == null)
                                return;

                            house.Price = this.m_Cost;

                            if (from.AccessLevel >= AccessLevel.GameMaster)
                            {
                                from.SendMessage("{0} gold would have been withdrawn from your bank if you were not a GM.", this.m_Cost.ToString());
                            }
                            else
                            {
                                if (Banker.Withdraw(from, this.m_Cost))
                                {
                                    from.SendLocalizedMessage(1060398, this.m_Cost.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                                }
                                else
                                {
                                    house.RemoveKeys(from);
                                    house.Delete();
                                    from.SendLocalizedMessage(1060646); // You do not have the funds available in your bank box to purchase this house.  Try placing a smaller house, or adding gold or checks to your bank box.
                                    return;
                                }
                            }

                            house.MoveToWorld(center, from.Map);
                            hpt.Delete();

it needs to look like this, you have an extra bracket } in there I think
this isnt the whole section first half, I think you've messed some things up
Post automatically merged:

This should be the whole section for PlacementWarning_Callback

Code:
        public void PlacementWarning_Callback(Mobile from, bool okay, object state)
        {
            var hpt = from.Backpack.FindItemByType(typeof(HousePlacementTool));

            if (!from.CheckAlive() || from.Backpack == null || hpt == null)
                return;

            PreviewHouse prevHouse = (PreviewHouse)state;

            if (!okay)
            {
                prevHouse.Delete();
                return;
            }

            if (prevHouse.Deleted)
            {
                /* Too much time has passed and the test house you created has been deleted.
                * Please try again!
                */
                from.SendGump(new NoticeGump(1060637, 30720, 1060647, 32512, 320, 180, null, null));

                return;
            }

            Point3D center = prevHouse.Location;
            Map map = prevHouse.Map;

            prevHouse.Delete();

            ArrayList toMove;
            //Point3D center = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z );
            HousePlacementResult res = HousePlacement.Check(from, this.m_MultiID, center, out toMove);

            switch (res)
            {
                case HousePlacementResult.Valid:
                    {
                        if (from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse(from))
                        {
                            from.SendLocalizedMessage(501271); // You already own a house, you may not place another!
                        }
                        else
                        {
                            BaseHouse house = this.ConstructHouse(from);

                            if (house == null)
                                return;

                            house.Price = this.m_Cost;

                            if (from.AccessLevel >= AccessLevel.GameMaster)
                            {
                                from.SendMessage("{0} gold would have been withdrawn from your bank if you were not a GM.", this.m_Cost.ToString());
                            }
                            else
                            {
                                if (Banker.Withdraw(from, this.m_Cost))
                                {
                                    from.SendLocalizedMessage(1060398, this.m_Cost.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                                }
                                else
                                {
                                    house.RemoveKeys(from);
                                    house.Delete();
                                    from.SendLocalizedMessage(1060646); // You do not have the funds available in your bank box to purchase this house.  Try placing a smaller house, or adding gold or checks to your bank box.
                                    return;
                                }
                            }

                            house.MoveToWorld(center, from.Map);
                            hpt.Delete();

                            for (int i = 0; i < toMove.Count; ++i)
                            {
                                object o = toMove[i];

                                if (o is Mobile)
                                    ((Mobile)o).Location = house.BanLocation;
                                else if (o is Item)
                                    ((Item)o).Location = house.BanLocation;
                            }
                        }

                        break;
                    }
                case HousePlacementResult.BadItem:
                case HousePlacementResult.BadLand:
                case HousePlacementResult.BadStatic:
                case HousePlacementResult.BadRegionHidden:
                case HousePlacementResult.NoSurface:
                    {
                        from.SendLocalizedMessage(1043287); // The house could not be created here.  Either something is blocking the house, or the house would not be on valid terrain.
                        break;
                    }
                case HousePlacementResult.BadRegion:
                    {
                        from.SendLocalizedMessage(501265); // Housing cannot be created in this area.
                        break;
                    }
                case HousePlacementResult.BadRegionTemp:
                    {
                        from.SendLocalizedMessage(501270); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
                        break;
                    }
                case HousePlacementResult.BadRegionRaffle:
                    {
                        from.SendLocalizedMessage(1150493); // You must have a deed for this plot of land in order to build here.
                        break;
                    }
                case HousePlacementResult.InvalidCastleKeep:
                    {
                        from.SendLocalizedMessage(1061122); // Castles and keeps cannot be created here.
                        break;
                    }
                case HousePlacementResult.NoQueenLoyalty:
                    {
                        from.SendLocalizedMessage(1113707, "10000"); // You must have at lease ~1_MIN~ loyalty to the Gargoyle Queen to place a house in Ter Mur.
                        break;
                    }
            }
        }
 
Last edited:
A quick note I just noticed, you should probably rewrite the first lines like so, to catch a null backpack before the check

Code:
        public void PlacementWarning_Callback(Mobile from, bool okay, object state)
        {
            if (!from.CheckAlive() || from.Backpack == null)
                return;

            var hpt = from.Backpack.FindItemByType(typeof(HousePlacementTool));
            if (hpt == null)
                return;
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back