• 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!

Feature Request Bury Your Own Treasure

Can "VanderDeckens" cabin work just like a cabin on a ship, whit weapons locker
and chest working?
 
That does sound related.

@ANSEL: Why would you want a weapons locker working there?
You already have working ones on each of your ships.
Though apart from Cursed Coins, there is nothing you can put in your companion weapon lockers that will actually do something....
 
@ANSEL: Why would you want a weapons locker working there?
I want to have resources of sails and planks. Im playing as a smuggler now,
my plan was to store contraband on the island, until I have enough to do some
few big deals from time to time. Such a base could be good to have, some times
I want to be the lonely" (Sea ) Wolfe".
 
I want to have resources of sails and planks.
A weaponslocker doesn't work for that. Only ships and stores can store cargo goods.
The weaponslocker is a "box" that can hold money and items. Just like any other chest.
 
I have no idea - didn't know it could happen.
A quick look in itemlogic.c under void Box_FillBox( )
//fill box with new items

could be something?

Just took a look at the file, after that fill box with new items, there is spawnItemsCount = OBJECTS_IN_BOX, and then the code proceeds to make a list of chests with the spawnItemsCount = 0, does the 0 means that when resetting occurs (SpawnTime), there will be NO items in the new spawn that were previously in the box, while changing it to 1 would mean there will be YES item previously in box' next SpawnTime and maybe a new item as well?
I think it's worth taking a look at the SpawnTime thing, if it's possible to change SpawnTime = NEVER for a specific chest location then that would be the thing.

The term SpawnItem first appears at:

// ************** RANDOM ITEMS *****************
void RandItems_OnLoadLocation(ref _location)
{
string locatorName;
aref randItemLocator;
for (int i=1; i<MAX_LOADED_RANDITEMS; i++)
{
string lastSpawnTimeString = "LastSpawnTime"+i;
string randItemTypeString = "RandItemType"+i;
locatorName = "randitem"+i;
if (!FindLocator(_location.id, locatorName, &randItemLocator, true))
break;



there's also this, more to the end of the file that seems interesting:

// LDH 30Apr09
// make your ship's chests lootable only once per day.
// unfortunately, this makes ALL your ships' crew cabin boxes, for example, lootable only once per day.
int SpawnTime = SPAWN_TIME;
if (ownDeckStarted())
{
SpawnTime = 20; // 20 hours, so you can loot your own ship once per day at the same time every day
isAbordageBox = false;
 
Also, just saw the Guide - Treasure Quests, and if it was possible to create a Hidden Safe Chest, that would be the Bury your own treasure feature, while the Treasure Hideout feature as I described in my post with the images would require the "fake store" with it's keeper and a non-hidden "safe chest".

Conquered towns are never retaken. No such feature was ever made.

Pieter, will such feature be added in the future? Why it wasn't, generated too many bugs or something?

If it becomes possible to add this feature later on, then that would become the gameplaywise point of having the "fake store" (Safe Store) to store your goods.

Just saying, not demanding anything. :razz
 
Last edited:
For chests, there are two options:
1. Add a "box" locator to the Cozumel cabin location model, then use RandItems_OnLoadLocation to ensure it is "safe".
2. There is a function that can create a "box" at specific x,y,z coordinates; this is used for the Treasure Quests.
Might be possible to call this through officer dialog with the x,y,z coordinates of that officer.
Relevant code can be found in PROGRAM\MAXIMUS_functions.c - search for "treasure".

Both should be quite doable.

As for the "fake store", I'm not sure if Cozumel (="Khael Roa") has a store already defined.
If so, that one could be used with a store keeper in your personal hide-out.
I have no clue how to prevent any goods from "spawning" there though. Somebody would need to figure that out...
 
If someone wants to bury treasure, try this...

In PROGRAM\console.c find:
Code:
    case 2:
       if (!bSeaActive) {
         float x,y,z,ay,xx,zz,xz,zx;
         GetCharacterPos(GetMainCharacter(), &x, &y, &z);
         GetCharacterAy(pchar, &ay);
         xx = -sin(ay - PId2);
         zz = xx;
         xz = -cos(ay - PId2);
         zx = -xz;
         Logit("Location id: "+pchar.location);
         Logit("Your Coords x: " + x+"  y: "+y+"  z: "+z );
         Logit("Viewangle ay: "+ay+"; xx= "+xx+" xz= "+xz+" zx= "+zx+" zz= "+zz);
         Logit("Curlocator: "+chrWaitReloadLocator);
       //   trace("rld,loc," +xx+",0,"+xz+",0,1,0,"+zx+",0,"+zz+","+x+","+y+","+z+",1,0,0,0,0,0,0,0,0,");
       //   trace("rld,aloc,"+xx+",0,"+xz+",0,1,0,"+zx+",0,"+zz+","+x+","+y+","+z+",1,0,0,0,0,0,0,0,0,");
       } else {
         Logit("Ship position: x="+pchar.ship.pos.x+", z="+pchar.ship.pos.z);
       }
       //Logit("Ship position: x="+worldMap.playerShipX+", z="+worldMap.playerShipZ);
     break;

Replace with:
Code:
    case 2:
       if (!bSeaActive) {
         float x,y,z,ay,xx,zz,xz,zx;
         GetCharacterPos(PChar, &x, &y, &z);
         WriteLocatorGlobal(PChar.location, "box", "buried_treasure", "", -1, x, y, z, false);
         Logit("Buried Treasure Box made in location: "+pchar.location);
         Logit("Your Coords x: " + x+"  y: "+y+"  z: "+z );
/*         GetCharacterAy(pchar, &ay);
         xx = -sin(ay - PId2);
         zz = xx;
         xz = -cos(ay - PId2);
         zx = -xz;
         Logit("Location id: "+pchar.location);
         Logit("Your Coords x: " + x+"  y: "+y+"  z: "+z );
         Logit("Viewangle ay: "+ay+"; xx= "+xx+" xz= "+xz+" zx= "+zx+" zz= "+zz);
         Logit("Curlocator: "+chrWaitReloadLocator);
       //   trace("rld,loc," +xx+",0,"+xz+",0,1,0,"+zx+",0,"+zz+","+x+","+y+","+z+",1,0,0,0,0,0,0,0,0,");
       //   trace("rld,aloc,"+xx+",0,"+xz+",0,1,0,"+zx+",0,"+zz+","+x+","+y+","+z+",1,0,0,0,0,0,0,0,0,");
       } else {
         Logit("Ship position: x="+pchar.ship.pos.x+", z="+pchar.ship.pos.z);
       }*/
       //Logit("Ship position: x="+worldMap.playerShipX+", z="+worldMap.playerShipZ);
     break;
Set switch(2) at the top, then press F12 to create a chest at the spot where you're standing.

I haven't tried this myself, but I think it might just work.
 
I tried to execute this code with the console. The console wont execute it.
Oops, I think this should work better:
Code:
    case 2:
       if (!bSeaActive) {
         float x,y,z,ay,xx,zz,xz,zx;
         GetCharacterPos(GetMainCharacter(), &x, &y, &z);
         WriteLocatorGlobal(PChar.location, "box", "treasure_box", "", -1, x, y, z, false);
         Logit("Buried Treasure Box made in location: "+pchar.location);
         Logit("Your Coords x: " + x+"  y: "+y+"  z: "+z );
       /*   GetCharacterAy(pchar, &ay);
         xx = -sin(ay - PId2);
         zz = xx;
         xz = -cos(ay - PId2);
         zx = -xz;
         Logit("Location id: "+pchar.location);
         Logit("Your Coords x: " + x+"  y: "+y+"  z: "+z );
         Logit("Viewangle ay: "+ay+"; xx= "+xx+" xz= "+xz+" zx= "+zx+" zz= "+zz);
         Logit("Curlocator: "+chrWaitReloadLocator);
       //   trace("rld,loc," +xx+",0,"+xz+",0,1,0,"+zx+",0,"+zz+","+x+","+y+","+z+",1,0,0,0,0,0,0,0,0,");
       //   trace("rld,aloc,"+xx+",0,"+xz+",0,1,0,"+zx+",0,"+zz+","+x+","+y+","+z+",1,0,0,0,0,0,0,0,0,");*/
       } else {
         Logit("Ship position: x="+pchar.ship.pos.x+", z="+pchar.ship.pos.z);
       }
       //Logit("Ship position: x="+worldMap.playerShipX+", z="+worldMap.playerShipZ);
     break;

Just tested it and it seems to work. Several issues though:
- Requires console and is therefore not (yet) an ingame feature
- Because it is named "treasure_box", it may interfere with treasure quest chests, so DON'T use it in a location that normally can have treasures hidden
- By extension, you can have only ONE of them in a location at the same time
- You may get hurt when trying to open it (I did)
- When you open it, it disappears again
- When you make it AGAIN in the same location, then you can find whatever items you put in it again

In other words: Plenty magic involved! And not quite perfect.
It would require some more code tweaking to make this a full game feature, but it IS possible through this method.

If at all possible, I'd prefer somebody else to actually make this happen for real.
Searching for "treasure_box" in the game code should lead you to all the relevant code.
Probably what is needed is to create a new type of box (e.g. "hidden_box") that serves its purpose better than those treasure boxes.
 
Well! That is weird. The chest is invisible and you can open it anywhere you are.
I think I have made a chest I always must carry around with.
 
Well! That is weird. The chest is invisible and you can open it anywhere you are.
I think I have made a chest I always must carry around with.
Really? When I tried, I did notice some weird stuff, but all of that weirdness has an explanation.
I definitely didn't get what you did.

Attached file is the one I did my testing with.
 

Attachments

  • console.c
    35.5 KB · Views: 268
With the console you posted, its the same behavior us before: Invisible chest I can open everywhere.:eek:
Also if you leave the location? And when you then come back?
I have seen that happen occasionally, but not today while using that console file.
 
Its still the same, even if I go to worldmap and return later.
But I have thise logs
 

Attachments

  • error.log
    300 bytes · Views: 284
Could it be this code and I have to chance the name to something different?
{
boxName = pch.boxname;
boxType = strcut(boxName, 0, strlen(boxName)-3);
curLoc = Locations[FindLocation(pch.location)].filespath.models;
curLocId = Locations[FindLocation(pch.location)].id; //JRH bookshelf
int powderCount;
string whichInterface = "";
 
Can you start a new game on mod default settings, then try again with the console.c I posted?
 
Back
Top