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

Cannot Confirm BuildingSet Structures Appearing as Random Items

ANSEL

Corsair
Storm Modder
Hearts of Oak Donator
At vanderdeckens ship I found this strange item: seadogs2_0000.jpg seadogs2_0073.jpg
 

Attachments

  • compile.log
    2.4 KB · Views: 139
Code:
ItemLogic -> randItem draw: missing attribute RandItemType173 in location IslaDeMuerte_shore_02
Could that be related?

It is this general Building item by @Jack Rackham:
Code:
n = InitBuildingItemJRH(n,   "gatedoor_w8",       "gatedoor_w8");     //gatedoor metal on dark stones, also in Assassin
Initialized like this:
Code:
int InitBuildingItemJRH(ref ItemIndex, string id, string model)
{
   ref   bld;
   int   bldIndex = ItemIndex;
   makeref(bld,Items[bldIndex]);

   bld.id      = id;
   bld.name    = "itmname_" + id;
   bld.folder    = "ammo";
   bld.model    = "BuildingItemsJRH\"+model;

   bldIndex++;
   return bldIndex
}

Curious that neither that function nor the normal BuildingSet item initialization function has anything in place to avoid them appearing as random items.
Normally I would expect a "rare = 0.00" plus my hack of "minlevel = 99" to be extra sure they don't show at random. :facepalm
 
The same problem happens in Tortuga tavernseadogs2_0040.jpg seadogs2_0000.jpg
 

Attachments

  • compile.log
    118.9 KB · Views: 129
  • error.log
    501 bytes · Views: 128
seadogs2_0073.jpg Well now it all goes crazy, this is Tortuga again, its all related to @jack Rackhams files.seadogs2_0062.jpg
 

Attachments

  • compile.log
    12.3 KB · Views: 142
Last edited:
Has this started only recently? And it happens so very often?
That is very strange, I don't remember anything related being substantially changed.
Just in case, can you press F11 and see if that helps anything at all?
 
This is a problem which exists as long as I remember. I still had it on my list to look into it.
Thinking about it there might be a simple solution. Will look into it this week
 
My simple solution would be to just add itm.rare and itm.minlevel lines and see if that puts a stop to it.
That is easily done; should take just a few minutes.
 
My simple solution would be to just add itm.rare and itm.minlevel lines and see if that puts a stop to it.
That is easily done; should take just a few minutes.
They should appear there, but you shouldn't be able to pick them up.
 
Are these BuildingSet structures in their intended spots that you happen to be able to pick up?
Or do they randomly show up in spots where they aren't meant to?
Those are two very different problems. The Isla de Muerta issue suggests it is unintentional.
 
well I recently placed a carpet somewhere and if I stood in exactly the right spot I was able to pick it up. it has a radius of 0.1, I can try to decrease it to see if that helps.

but indeed those ship things appear to be placed on locators where they shouldn't be.
 
Has this started only recently? And it happens so very often?
That is very strange, I don't remember anything related being substantially changed.
Just in case, can you press F11 and see if that helps anything at all?
I have been playing" Castaway" for a long time with out any troubles, but yesterday it
suddenly happens. I have only visit Tortuga since it occurs. Im at level 32 now, dont know
if high levels could trig some thing to happen. I dont think F11 will do anything about it,
as I often use it.
 
Im at level 32 now, dont know
if high levels could trig some thing to happen.
That could actually be a plausible reason. Since "minlevel" isn't defined, maybe the game treats those items as having some sort of "default minlevel".
 
@Pieter Boelen it looks to me like the minlevel is being ignored if you are not playing on RPG style. Maybe that could have caused it too?
Code:
void RandItems_SpawnRandItem(int _index, aref _location, aref al)
{
    aref randItem;
    string lastSpawnTimeString;
    int n = -1; // TIH initialize Aug24'06

    string alName = GetAttributeName(al);
    string alNameAttribute = "items."+alName;
    // NK temporarily locations with named rand items will ignore the name. BUT if ID == blade1, will still gen that.
    // NK 05-03-25 fix this so it checks location's randitemsstay attribute.
    bool generate = true;// TIH name change for clarity
    if (CheckAttribute(_location, alNameAttribute))
    {
        // TIH --> logic fix
        bool locSetItem = false;
        if ( RANDOM_DUNGEON_BLADES == 0 ) { locSetItem = true; }
        if ( CheckAttribute(_location,"randitemsstay") && sti(_location.randitemsstay) ) { locSetItem = true; }
        if ( locSetItem )
        {
            generate = false;
            n = Items_FindItem(_location.items.(alName), &randItem);
            if (n == -1) return;
            lastSpawnTimeString = "LastSpawnTime"+_index;
            _location.(lastSpawnTimeString) = Items_MakeTime(0, 15, 1, 2003);
        }
        // TIH <--
    }
    // else
    if(generate)
    {
        // NK <--
        // TIH --> rpg_style only
        // use 'rare' in the formula for spawning a random item (adjusted scale)
        // also will try at least RARE_RAND_RETRIES times to find an item (instead of just once)
        // Nov21'06 fix: 'n' has now been set to -1 when it fails a check, so that the prior value of 'n' doesn't
        // simply carry through to the end of the function, thus spawning an item that failed the checks!
        if ( IT_RPG_STYLE ) {
            int     nn;
            float     itemProb
            bool     itmSelected = false;
            int        levelCut = makeint(RARE_MAXLEVEL_ABOVE + GetLevel(GetMainCharacter()) + makeint(CalcCharacterSkill(GetMainCharacter(),SKILL_SNEAK) / 2));
            for ( nn = 0; nn < RARE_RAND_RETRIES; nn++) {
                n = Items_FindItem(RandItems[rand(RANDITEMS_QUANTITY-1)].id, &randItem);
                if ( n == -1 ) continue;
                if ( CheckAttribute(randItem, "model") && randItem.model == "" ) {n = -1;continue;} // Nov21'06 // cant use items without models
                if ( RARE_MAXLEVEL_ABOVE > 0 && sti(randItem.minlevel) > levelCut ) {n = -1;continue;} // Nov21'06 // cant use item if too much higher than player
                if ( CheckAttribute(randItem, "rare") )
                {
                    // TIH locator items are rare to begin with, so we beef the probability with pure luck:
                    itemProb = stf(randItem.rare) * makefloat(CalcCharacterSkill(GetMainCharacter(),SKILL_SNEAK));
                    if ( rand(1000) > (itemProb*1000) ) {n = -1;continue;} // Nov21'06 // its 1000 for a reason
                }
                if ( n >= 0 ) break; // Nov21'06 // if we get this far, then we have a candidate!
            }
            // TIH --> last ditch effort to give them SOMETHING Aug24'06
            if ( n == -1 && frnd() > 0.5 )
            {
                switch ( rand(6) )
                {
                    case 0: n = Items_FindItem("100gp", &randItem); break;
                    case 1: n = Items_FindItem("250gp", &randItem); break;
                    case 2: n = Items_FindItem("medical1", &randItem); break;
                    case 3: n = Items_FindItem("potion3", &randItem); break;
                    case 4: n = Items_FindItem("indian4", &randItem); break;
                    case 5: n = Items_FindItem("indian3", &randItem); break;
                    case 6: n = Items_FindItem("pistolrock", &randItem); break;
                }
            }
            // TIH <--
            if (n == -1) return; // TIH die on failed find Nov21'06
        } else {
            // prior basic method
            n = Items_FindItem(RandItems[rand(RANDITEMS_QUANTITY-1)].id, &randItem);
            if (n == -1) return; // TIH die on failed find Nov21'06
        }
        // TIH <--

        lastSpawnTimeString = "LastSpawnTime"+_index;
        _location.(lastSpawnTimeString) = Items_MakeTime(GetTime(), GetDataDay(), GetDataMonth(), GetDataYear());
    }

    if (!CheckAttribute(randItem, "model")) // Sulan: bugfix
    {
        Trace("ItemLogic -> randItem spawn: no model for item "+_location.id+"."+randItem.id);
        return;
    }

    Items_LoadModel(&randItemModels[_index],  randItem);
    SendMessage(&randItemModels[_index], "lffffffffffff", MSG_MODEL_SET_POSITION, makeFloat(al.x), makeFloat(al.y), makeFloat(al.z), makeFloat(al.vx.x), makeFloat(al.vx.y), -makeFloat(al.vx.z), makeFloat(al.vy.x), makeFloat(al.vy.y), -makeFloat(al.vy.z), makeFloat(al.vz.x), makeFloat(al.vz.y), -makeFloat(al.vz.z));

    lastSpawnTimeString = "RandItemType"+_index;
    _location.(lastSpawnTimeString) = n;
}

But looking into it more all items should have Skiprand on true at default. And only when specificly told to have it set to false should they appear so that makes it even weirder how those items could have appeared
 
Last edited:
Code:
void RandItem_OnEnterLocator(aref _location, string _locator)
{
    int randIndex = sti(strcut(_locator, 8, strlen(_locator)-1));
    string randItemAttribute = "RandItemType"+randIndex;
    ref chr = GetMainCharacter();
    if (CheckAttribute(_location, randItemAttribute))
    {
        int currentType = sti(_location.(RandItemAttribute));
        if (currentType != -1)
        {
            chr.activeItem.Action = "Pick";
            Log_SetActiveAction(chr.activeItem.Action);
            Log_SetActionLabel(TranslateString("", "Item"));
            chr.activeItem = randIndex;
            chr.activeLocator = _locator;
            chr.activeRandItem = true;
            chr.activeItem.pick = true;
            BLI_RefreshCommandMenu();
        }
    }
}

@Jack Rackham if I read this right we should be able to rename those locators to say randitem-1 for example and you shouldn't be able to pick them up at all.
What we also could do it just add a check here saying if the radius is smaller then a certain value (say smaller or equal to 0.1) then it will skip it too.
What do you think?
 
just did some more tests and indeed changing it to radius 0.001 makes them non-pickup able again. so we just need to change the cases where the radius is set to high.
 
Let's change the radius of those randitems in the location file first (to 0,001 and hope that
it was that easy. If you can't 'reach' the randitem locator you can't pick up the item.

But the other thing are those wreck and shipbuilding models that looks placed upon dry land.
Has any of the locatorfiles being switched/changed at some moment?

In Tortuga port it's a little unusual: there is a locatorfile "Tortuga_l" but it's empty and exists
only to make "Tortuga_lb" load when capture town.
The real locatorfiles are "Tortuga_l_day" and "Tortuga_l_night".

In Ansels's compile.log:
Code:
ItemLogic -> randItem draw: no model for item Tortuga_port.compass2
This is strange because no such item is placed there (by me).
 
Back
Top