View Issue Details

IDProjectCategoryView StatusLast Update
0003723The Dark ModCodingpublic13.05.2014 02:26
Reportergrayman Assigned Tograyman  
Status resolvedResolutionfixed 
Product VersionTDM 2.01 
Target VersionTDM 2.02Fixed in VersionTDM 2.02 
Summary0003723: Problems with persistent items
DescriptionPersistent health potions don't persist as advertised.

This behavior might also apply to other persistent inventory items.
Steps To ReproduceIn 2.01, using the demo campaign maps (whose mission order is red->blue->green):

1 - Add a health potion in the red map (atdm_playertools_health_potion_1) and give it the spawnarg "inv_persistent/1".

2 - Add a health potion in the blue map (atdm_playertools_health_potion_1).

3 - Add a health potion in the green map (atdm_playertools_health_potion_1).

Start the campaign.

Pick up the health potion in red map and exit to blue map.

The health potion from red map is still in inventory.

Pick up the health potion in blue map (inventory now says you have 2) and exit to green map.

No health potions are in the inventory.

The wiki page on campaigns says items marked "inv_persistent" will be present in all subsequent campaign maps (unless consumed, of course).

So the problem is that the health potion from red made it to blue, but not to green. This might have happened because the health potions all have the same name, and the lack of a persistent spawnarg on the blue potion wiped out the persistent spawnarg on the red potion.
TagsNo tags attached.




11.05.2014 21:05

administrator   ~0006600

An observation ...

Persistent inventory items carried to the next map, when the next map has a shop, are converted into "items already in your inventory" and shown on the shop page. When the shop page is processed, it spawns new entities to represent the items in your inventory.

So if you have a persistent item named "blahblah_1", a new instance of that item will be created at map start (after the shop is processed) and it will be given a new name like "blahblah_145".

This will cause a crash if the map already has an item named "blahblah_145". While the crash will be rare, it can still happen.

If there's no shop in the new map, the name given the inventory item in the earlier map will carry over to the new map, so an item named "blahblah_1" already in the map will cause a crash.


12.05.2014 00:38

administrator   ~0006601

I also found out that if a shop exists in mission 1 of a campaign, but isn't used in subsequent missions, persistent inventory items can be lost at the start of the mission after the one where they're picked up. This is because the code assumes that the presence of a shop in mission 1 means there's a shop in the rest of the missions, and it relies on the shop to process the persistent inventory items. If the author removes the shop from a mission, the persistent inventory items don't get processed, which means they get dropped.

If none of the missions use a shop, then we run into the naming problem I mentioned above, because the persistent items stick around, and can conflict with new items in the next mission.

Does the campaign design rely on a shop being in mission 1 and being present throughout the campaign?


12.05.2014 13:30

administrator   ~0006602

Melan responded when asked which Crucible missions have shops:

Here is how it should be logically treated:
Restless Plunder: yes
Wreckers' Reach: no
The Nexus: yes
Manor Royale: yes
Iceclaw: no
The Buried Cloister: no (but equipment carries over?)
Blackstone Manor: yes
The Dead Gathers: yes

This means we should fix the persistent item problem sooner rather than later, so I'm putting it on the 2.02 roadmap.


12.05.2014 19:54

administrator   ~0006603

Last edited: 12.05.2014 20:12

View 3 revisions

Also found that when a persistent item is to be dropped at the end of a map (via an instruction in an atdm:campaign_info) it's possible for the item to appear in the next map anyway. This comes about because of the following problem:

If a map has a shop with a list of items in the player's inventory, but the next map doesn't have a shop, that list isn't cleared, and the player is given those things again. So if the first map gave you a blackjack, then took it away at map end, you're gonna get it back anyway if the next map doesn't have a shop.

Yup, kinda complicated.

This problem is fixed by clearing the shop after you're done using it in a map.



13.05.2014 02:24

administrator   ~0006604

Last edited: 13.05.2014 02:26

View 2 revisions

Fixed three problems:

1. When there are persistent items in the player’s inventory as he leaves a map, and the next map doesn’t have a shop, it’s possible for the names of the persistent items to clash with the names of items in the new map. Fixed by assigning a new unique name to the persistent item.

2. When an atdm:campaign_info clears a persistent weapon from inventory by setting its weapon_limit to 0, it’s possible that the weapon will still appear in the next map, even though the next map doesn’t provide it. Fixed by clearing the shop after it’s been processed. It was hanging around, giving the same items to all following non-shop maps.

3. Persistent inventory items picked up in a map with a shop were getting dropped in the next map if the next map didn’t have a shop. Fixed by not depending on the next map’s nonexistent shop to process the item.

Rev. 5993:


Issue History

Date Modified Username Field Change
11.05.2014 14:49 grayman New Issue
11.05.2014 15:24 grayman Steps to Reproduce Updated View Revisions
11.05.2014 15:25 grayman Steps to Reproduce Updated View Revisions
11.05.2014 21:05 grayman Note Added: 0006600
12.05.2014 00:38 grayman Note Added: 0006601
12.05.2014 13:27 grayman Assigned To => grayman
12.05.2014 13:27 grayman Status new => assigned
12.05.2014 13:27 grayman Target Version => TDM 2.02
12.05.2014 13:30 grayman Note Added: 0006602
12.05.2014 19:54 grayman Note Added: 0006603
12.05.2014 19:54 grayman Note Edited: 0006603 View Revisions
12.05.2014 20:12 grayman Note Edited: 0006603 View Revisions
13.05.2014 02:24 grayman Note Added: 0006604
13.05.2014 02:24 grayman Status assigned => resolved
13.05.2014 02:24 grayman Resolution open => fixed
13.05.2014 02:24 grayman Fixed in Version => TDM 2.02
13.05.2014 02:26 grayman Note Edited: 0006604 View Revisions