Home » MODDING HQ 1.13 » v1.13 Bug Reports » BUG Can't Pick Up Items (Build 8675)
BUG Can't Pick Up Items[message #357594] Wed, 26 June 2019 00:52 Go to next message
fightcancer

 
Messages:197
Registered:February 2005
Location: USA
So many times when I enter tactical view in a sector (Build 8675), several items will be inaccessible under the "Show Items" section of the Strategic view. These inaccessible items are not shown anywhere on the mini map at the bottom right when I hover over the items. That means they're not visible anywhere on the map--even using cheats with Alt + E. These items seem to be lost forever, but still visible in sector inventory.

Any fix?

[Updated on: Wed, 26 June 2019 00:54]

Re: BUG Can't Pick Up Items[message #357596 is a reply to message #357594] Wed, 26 June 2019 11:28 Go to previous messageGo to next message
silversurfer

 
Messages:2601
Registered:May 2009
If I remember correctly there have been reports that this could happen if you drop items in the sector inventory (strategic map view) when the map is not loaded. Workaround is to always load the map first (go to sector screen) before dropping stuff. I always do it like that and never had inaccessible items unless they were in a locked room/container.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: BUG Can't Pick Up Items[message #357597 is a reply to message #357596] Thu, 27 June 2019 01:36 Go to previous messageGo to next message
fightcancer

 
Messages:197
Registered:February 2005
Location: USA
Thanks very much!
Re: BUG Can't Pick Up Items[message #357600 is a reply to message #357596] Thu, 27 June 2019 12:15 Go to previous messageGo to next message
townltu

 
Messages:375
Registered:December 2017
Location: here
The workaround to 1st load the sector before dropping any stuff in sector inventory has a potential flaw,
imagine you expect an attack in another sector soon so you called the militia into a building and blocked the exit,
but that sector is unloaded when you load another, and the militia is distributed again over the maps default spots.
It happened several times here that there was literally no time left to move the militia back.


Btw that brings up the questions:
1) Am I right that the the game take the scripted soldiers positions from the save game
or will it still load those positions from the genuine map files data
2) are those values stored as coordinates, or as directly as the tiles number?
(the number wee see in game when we hit [F] with cursor over the specific tile)

[Updated on: Thu, 27 June 2019 12:22]

Re: BUG Can't Pick Up Items[message #357634 is a reply to message #357600] Tue, 09 July 2019 12:27 Go to previous messageGo to next message
3iff

 
Messages:67
Registered:July 2001
Location: Birmingham, UK
FYI, I'm the one who discovered the workaround. Always load the sector first before trying to drop stuff into the sector inventory. I now never have 'lost' items when manipulating inventory. It is annoying to do so every time but you can soon get used to it...just as I always save the game before trying to do anything really stupid!

However, I've sometimes had militia/enemy battles where stuff is dropped into inaccessible places (those with different elevation levels, like Drassen mine sector). I can usually use the cheat to teleport a merc to the location and pick up the stuff - usually pistols and ammo - but it's a tad annoying that it happens at all. It would perhaps be better if dropped stuff from automatic battles is placed into tiles near the centre of the map, those guaranteed to be at the right level so they can be picked up.
Re: BUG Can't Pick Up Items[message #357819 is a reply to message #357634] Sat, 10 August 2019 12:06 Go to previous messageGo to next message
MH17

 
Messages:44
Registered:November 2018
Location: Antarctica
Hi! happy

I guess, I found out the location of the bug with the inaccessible items in the sector inventory, although I'm not capable to completely find out its origin.
Look on the code of function "MapInvenPoolSlots" (file "Strategic/Map Screen Interface Map Inventory.cpp", line 1299).
There is a list of all items kept in the sector "pInventoryPoolList" declared in the same file (line 49).
Studying the saved games with a plenty of inaccessible stuff from Urban Chaos Mod I conclude that the inaccessible ones are held with a field sGridNo == 0. As I understand it means that the items are situated out of the sector borders.
For the rest of items sGridNo is always greater than 0 pointing out right to the tile with their location. Even if the items are not available from global inventory (like Cup in Balime), but might be taken from tactical map.

As a result a player is not capable to locate a position of his missed stuff on tactical radar map in the right/bottom of the strategic screen. In the same way when player invokes a tactical environment map pressing "Ins" key the items with sGridNo == 0 are not visible there as well.
I guess all we need to fix it is just to include a simple test of all item's positions during tactical sector loading. If the sGridNo == 0 lets assign it 1 or something like this... Or perhaps: as I remember, in each sector there is a one special tile where all player's belongings are placed by default. We may assign its number to the locations of the lost stuff.
Re: BUG Can't Pick Up Items[message #357820 is a reply to message #357819] Sat, 10 August 2019 12:40 Go to previous messageGo to next message
sevenfm

 
Messages:1987
Registered:December 2012
Location: Soviet Russia
MH17 wrote on Sat, 10 August 2019 14:06
Or perhaps: as I remember, in each sector there is a one special tile where all player's belongings are placed by default. We may assign its number to the locations of the lost stuff.
Something like gMapInformation.sCenterGridNo? Or use the tile of any 'good' reachable item already existing in sector.



7609+fix | 7609+AI (r1335) | Unofficial modpack | Win8+ fix | Experimental project | Youtube

"It's already "dog-eat-dog", friend. Not sure what worse a bunch of zombies could do."


Re: BUG Can't Pick Up Items[message #357822 is a reply to message #357820] Sat, 10 August 2019 15:18 Go to previous messageGo to next message
MH17

 
Messages:44
Registered:November 2018
Location: Antarctica
sevenfm wrote on Sat, 10 August 2019 12:40
MH17 wrote on Sat, 10 August 2019 14:06
Or perhaps: as I remember, in each sector there is a one special tile where all player's belongings are placed by default. We may assign its number to the locations of the lost stuff.
Something like gMapInformation.sCenterGridNo? Or use the tile of any 'good' reachable item already existing in sector.
Sounds like a good idea, bro!
After some more research I have to add one more remark: we gotta reset a bit-flag of the item WORLDITEM.usFlags into WORLD_ITEM_REACHABLE.

Only problem left: it is not clear for me where exactly we have to update the values.
I tried to experiment with the code of functions "UpdateLoadedSectorsItemInventory" and "SynchronizeItemTempFileVisbleItemsToSectorInfoVisbleItems", but it dindt help since there are some temporary file output.
The general structure of the code is still not clear for me, does anyone know where is the best place to update the item's attributes?
Thank you in advance!
Re: BUG Can't Pick Up Items[message #357823 is a reply to message #357822] Sat, 10 August 2019 15:54 Go to previous messageGo to next message
sevenfm

 
Messages:1987
Registered:December 2012
Location: Soviet Russia
@MH17
Flugente's comment in Map Screen Interface Map Inventory.cpp may be useful:
Quote:
// Flugente 2016-04-09: (pInventoryPoolList[i].usFlags & WORLD_ITEM_REACHABLE) does not guarantee that an item is reachable.
// For example, a previously reachable item might now be inside a locked house. This would result in all items to be dropped inside that house!
// It is better so simply leave sObjectSourceGridNo at NOWHERE. This will cause WORLD_ITEM_GRIDNO_NOT_SET_USE_ENTRY_POINT to be set, which in turn causes
// a reassignment to the (by then correct) gMapInformation.sCenterGridNo in LoadAndAddWorldItemsFromTempFile(...)



7609+fix | 7609+AI (r1335) | Unofficial modpack | Win8+ fix | Experimental project | Youtube

"It's already "dog-eat-dog", friend. Not sure what worse a bunch of zombies could do."


Re: BUG Can't Pick Up Items[message #357834 is a reply to message #357823] Sun, 11 August 2019 12:24 Go to previous messageGo to next message
silversurfer

 
Messages:2601
Registered:May 2009
Does that mean that if a map has a center grid defined all inaccessible items will be placed there and if this center grid definition is missing the items will remain inaccessible? I'm curious to see which maps have no center grid definition. I just checked a few sectors on standard 1.13 and WF maps and there the center grid was always defined. I never experience the inaccessible items bug so far and I'm playing on WF maps (when I'm playing, currently not).



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: BUG Can't Pick Up Items[message #357841 is a reply to message #357834] Mon, 12 August 2019 04:37 Go to previous messageGo to next message
MH17

 
Messages:44
Registered:November 2018
Location: Antarctica
Dear gentlemen,

I guess I found out the solution for the problem with inaccessible items. It seems to me the best position of the fix should be in function "LoadWorldItemsFromTempItemFile" (file "Tactical\Tactical Save.cpp", line 663), when we load all world items from any saved game.

In order to implement this I suggest that we should add in the last loop of the function something like a:
		if (pData[x].fExists && !pData[x].sGridNo && pData[x].object.exists())
		{
			pData[x].usFlags |= WORLD_ITEM_REACHABLE;
			pData[x].sGridNo = NOWHERE; // gMapInformation.sCenterGridNo;
		}

I tried to experiment with both values for pData[x].sGridNo (NOWHERE, gMapInformation.sCenterGridNo) and couldn't reveal any distinction in the obtained results. Here we have a lot of old saved games with missed equipment, I tried some of them, it seems to me that the idea works: after the correction of the code I have an access to the lost stuff only. The code doesn't modify any item, which must remain inaccessible (like "Police Bulletin" from Port Kip in Urban Chaos Mod).

Any criticism is welcome.
Re: BUG Can't Pick Up Items[message #357843 is a reply to message #357841] Mon, 12 August 2019 04:56 Go to previous messageGo to next message
sevenfm

 
Messages:1987
Registered:December 2012
Location: Soviet Russia
@MH17
I would probably add some debug message so it's no just silently changed but some information stored in debug log that item's position was wrong, with item's ID and other needed data.
Since NOWHERE is TileIsOutOfBounds(), it is probably auto replaced with gMapInformation.sCenterGridNo somewhere later in the code, unlike sGridNo == 0 which is technically ok value.

[Updated on: Mon, 12 August 2019 04:58]




7609+fix | 7609+AI (r1335) | Unofficial modpack | Win8+ fix | Experimental project | Youtube

"It's already "dog-eat-dog", friend. Not sure what worse a bunch of zombies could do."


Re: BUG Can't Pick Up Items[message #357844 is a reply to message #357843] Mon, 12 August 2019 05:02 Go to previous messageGo to next message
MH17

 
Messages:44
Registered:November 2018
Location: Antarctica
sevenfm wrote on Mon, 12 August 2019 04:56
@MH17
I would probably add some debug message so it's no just silently changed but some information stored in debug log that item's position was wrong, with item's ID and other needed data.
Totally agree! There is an access to sector coordinates, item's info etc right from the function "LoadWorldItemsFromTempItemFile", so this is shouldn't be a big issue.
Re: BUG Can't Pick Up Items[message #357927 is a reply to message #357844] Tue, 20 August 2019 01:45 Go to previous messageGo to next message
MH17

 
Messages:44
Registered:November 2018
Location: Antarctica
Hello, gentlemen!
I just tried to update my local SVN-repository to check the latest improvements and found out that the fix for the bug with inaccessible items haven't been applied yet.
My girlfriend cant wait to test all the new features of Ja2 1.13 with Urban Chaos mod.
If you expect something from my side to finish this problem, please, let me know.
Thanks!
Re: BUG Can't Pick Up Items[message #357932 is a reply to message #357927] Tue, 20 August 2019 20:44 Go to previous messageGo to next message
silversurfer

 
Messages:2601
Registered:May 2009
I managed to reproduce a (the ?) bug with inaccessible items on the WF maps. I went to sector H5 (hills) and dropped some items without loading the sector first. The game placed these items in valid tiles at the top center of the map.
That means the items had a valid grid ID and flag WORLD_ITEM_REACHABLE. After I went to tactical they lost the WORLD_ITEM_REACHABLE flag because they were in a inaccessible location so I couldn't pick them up again on tactical or strategic screen. Your proposed fix will not help here.

The question is how did the items end up exactly there? The reason is function "AutoPlaceObjectToWorld" in "Items.cpp". It gets the sGridNo from the soldier but this grid is completely invalid for an unloaded sector. It comes from the previous sector the soldier was in! I fixed that and set sGridNo to -1 and also added flag WORLD_ITEM_GRIDNO_NOT_SET_USE_ENTRY_POINT to the item so when the map is loaded the item will automatically be placed at the center grid. Fix is in r8690. This will not help with items on old map temp files because their data is already wrong.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: BUG Can't Pick Up Items[message #357933 is a reply to message #357932] Wed, 21 August 2019 00:07 Go to previous messageGo to next message
MH17

 
Messages:44
Registered:November 2018
Location: Antarctica
Hi, SilverSurfer! Thanks for keeping me updated.

In your circumstances I think my approach will become effective after saving the game and loading it, cause it was applied to infrastructure function "LoadWorldItemsFromTempItemFile".

On the one hand side, I guess, the idea to fix an origin of the problem in function "AutoPlaceObjectToWorld" is better than to deal with its manifestations and symptoms.
But on the other hand side perhaps it makes sense to take care about the fraction of the JA2-players, who already suffer from the trouble with missed inventory on their saved games. This is that my fix was proposed for.

Anyway, it will be very exciting to test a little the new executable with all the new features and fixes.
Re: BUG Can't Pick Up Items[message #357934 is a reply to message #357933] Wed, 21 August 2019 00:49 Go to previous messageGo to next message
silversurfer

 
Messages:2601
Registered:May 2009
If you have another scenario of inaccessible items with the new exe then please tell me how to reproduce it. I do not have any savegames with such items and except for the issue that I found today I'm not aware of other scenarios.
The issue that I found cannot be fixed in LoadWorldItemsFromTempItemFile because the items in the temp file had valid data. I just couldn't access them from any spot my mercs could reach on the map because the items were on a ridge.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: BUG Can't Pick Up Items[message #357935 is a reply to message #357934] Wed, 21 August 2019 02:28 Go to previous message
MH17

 
Messages:44
Registered:November 2018
Location: Antarctica
Thanks, I think I got what you mean.
If your solution is limited by the hilly landscape it seems to me we will definitely enjoy the issue again.
On my side the bug were often observed in the city sectors (for example, D6 in Urban Chaos mod) where there were no ridges on the tactical maps.
We'll try to reproduce it and see how it will arise in the game process.
Previous Topic: Runtime error if a different merc finishes a quest
Next Topic: NPC Portraits and Voices
Goto Forum:
  


Current Time: Tue Nov 19 16:54:19 EET 2019

Total time taken to generate the page: 0.01881 seconds