• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Building set

"PROGRAM\ITEMS\initItems.c" has this:
Code:
int InitBLDexterior(  ref ItemIndex, string id, string model,
            string chrmodel, string dialog, int planks, int money, int crew,
            float dmg_min, float dmg_max, int piercing, int block
          )
That's the function which defines building items. The items themselves are also listed in "initItems.c", e.g.:
Code:
n = InitBLDexterior(n,"house",      "B_house02",    "B_man",        "b_house.c",        20,  4000,  3,   1.0, 2.0,  0, 20 );  // house
This appears to define a building item "house" which uses model "B_house02.gm" and character model "B_man.gm". You'll find "B_house.gm" in "RESOURCE\MODELS\Ammo\BuildingSet", and "B_Man.gm" in "RESOURCE\MODELS\Characters".
 
I did try it but the house didn't even appear. :modding
nohouse.png
(This was with a new game.)
 
Last edited:
I edited the PROGRAM\ITEMS\initItems.c
From this:
Code:
  n = InitBLDexterior(n,"house",      "B_house02",    "B_man",        "b_house.c",        20,  4000,  3,   1.0, 2.0,  0, 20 );  // house
To this:
Code:
  n = InitBLDexterior(n,"house",      "B_house02",    "B_house02",        "b_house.c",        20,  4000,  3,   1.0, 2.0,  0, 20 );  // house
 
To build something add the code line at the bottom of the locations file. See for ex. PROGRAM/Locations/init/Cuba.c at the very end.
Don't change anything in initItems.c.
 
To build something add the code line at the bottom of the locations file. See for ex. PROGRAM/Locations/init/Cuba.c at the very end.
Don't change anything in initItems.c.
I have a question, aren't these files used for permanent buildings, and if this is true how would this help with not permanent buildings? :shrug
 
Function "Build_at" is defined in "PROGRAM\BUILDINGS\Buildingkit.c". Also defined there is "Building_delete":
Code:
void Building_delete(ref lcn, string nr)  // nr must be called as string "" !
{
  DeleteAttribute(lcn,"building."+nr);
}
The problem is that to delete a specific building, you need its number, and "Build_at" is defined as "void" so it doesn't return the number.

One option appears to be seen in the code for the "Mysterious Plants" quest:
Code:
       case "Apothecary Build Obstacles":
           lcn = &Locations[FindLocation("Greenford_suburb")];
           cidx = -1;
           for(i = 1; i<=MAXBUILDINGS; i++)
           {
               attr = "building."+i+".building";
               if( !CheckAttribute(lcn,attr) && cidx < 0)
               {
                   cidx = i;
               }
           }
           string buildingid = ""+cidx;
           pchar.quest.mysterious_plants.baricade.l1 = buildingid;
           lcn.building.(buildingid).building = "box";
           lcn.building.(buildingid).interior = "";
           lcn.building.(buildingid).x = -27.167;
           lcn.building.(buildingid).y =  1;
           lcn.building.(buildingid).z = 34.291;
           lcn.building.(buildingid).ay = 0;
           lcn.building.(buildingid).aigroup = "blockade";
           cidx += 1;
           buildingid = ""+cidx;
           pchar.quest.mysterious_plants.baricade.l2 = buildingid;
           lcn.building.(buildingid).building = "box";
           lcn.building.(buildingid).interior = "";
           lcn.building.(buildingid).x = -28.296;
           lcn.building.(buildingid).y = 1;
           lcn.building.(buildingid).z = 33.846;
           lcn.building.(buildingid).ay = 0;
           lcn.building.(buildingid).aigroup = "blockade";
           cidx += 1;
           buildingid = ""+cidx;
           pchar.quest.mysterious_plants.baricade.l3 = buildingid;
           lcn.building.(buildingid).building = "bale";
           lcn.building.(buildingid).interior = "";
           lcn.building.(buildingid).x = -27.458;
           lcn.building.(buildingid).y = 1;
           lcn.building.(buildingid).z = 33.549;
           lcn.building.(buildingid).ay = 0;
           lcn.building.(buildingid).aigroup = "blockade";
           cidx += 1;
           buildingid = ""+cidx;
           pchar.quest.mysterious_plants.baricade.l4 = buildingid;
           lcn.building.(buildingid).building = "bale";
           lcn.building.(buildingid).interior = "";
           lcn.building.(buildingid).x = -27.963;
           lcn.building.(buildingid).y = 1;
           lcn.building.(buildingid).z = 34.571;
           lcn.building.(buildingid).ay = 0;
           lcn.building.(buildingid).aigroup = "blockade";
       break;
It's basically a version of the same code used by "Build_at", but it also stores the building numbers as "PChar.quest" attributes. Later on, the buildings are removed:
Code:
       case "Apothecary Remove Baricade":
           DeleteAttribute(pchar,"quest.Apothecary_indian_detour");
           StopBlockadeCheck("Greenford_suburb");
           Building_delete(&Locations[FindLocation("Greenford_suburb")], pchar.quest.mysterious_plants.baricade.l1);
           Building_delete(&Locations[FindLocation("Greenford_suburb")], pchar.quest.mysterious_plants.baricade.l2);
           Building_delete(&Locations[FindLocation("Greenford_suburb")], pchar.quest.mysterious_plants.baricade.l3);
           Building_delete(&Locations[FindLocation("Greenford_suburb")], pchar.quest.mysterious_plants.baricade.l4);
       break;

Otherwise, if you're sure that there are no other buildings in the area, you can do something like this:
Code:
    for(int i = 1; i<=MAXBUILDINGS; i++)
   {
       if( CheckAttribute(lcn,"building."+i+".building") )
       {
           Building_delete(lcn, "" + i);
       }
   }
That wipes out all buildings in the area.
 
Back
Top