Kill NPC make assert exception
Sphere Version
- Compiled at May 10 2025 (05:11:29) [branch master / build 4031 / GIT hash 758bfe78426ecf6d847e592535588f79c9532976]
Steps:
- Spawn c_medusa
- Kill medusa
Error: 09:16:CRITICAL:Assert severity=2: 'restype < RES_QTY' file '/home/runner/work/Source-X/Source-X/src/common/resource/CResourceID.cpp', line 20, in ExcType=CAssert catched in CChar::OnTickPeriodic() #1 "death?" 09:16:DEBUG:Printing STACK TRACE for debugging purposes. 09:16:DEBUG: ______ thread (id) name _____ | # | _____________ function _____________ | 09:16:DEBUG:(7fd1cbfff6c0) T_Main | 0 | CWorld::_OnTick | 09:16:DEBUG:(7fd1cbfff6c0) T_Main | 1 | CWorldTicker::Tick | <-- exception catch point 09:16:DEBUG:(7fd1cbfff6c0) T_Main | 2 | CChar::Death | 09:16:DEBUG:(7fd1cbfff6c0) T_Main | 3 | CChar::ReadScriptReducedTrig | 09:16:DEBUG:(7fd1cbfff6c0) T_Main | 4 | CChar::ReadScriptReduced | 09:16:DEBUG:(7fd1cbfff6c0) T_Main | 5 | CItem::CreateHeader | 09:16:DEBUG:(7fd1cbfff6c0) T_Main | 6 | CItem::CreateTemplate | 09:16:DEBUG:(7fd1cbfff6c0) T_Main | 7 | CItem::ReadTemplate | 09:16:DEBUG:(7fd1cbfff6c0) T_Main | 8 | CItem::CreateHeader | 09:16:DEBUG:(7fd1cbfff6c0) T_Main | 9 | CResourceHolder::ResourceGetID | 09:16:DEBUG:(7fd1cbfff6c0) T_Main | 10 | CResourceHolder::ResourceGetID_EatSt | <-- last function call (stack unwinding detected here)
It seems that when there is another template in a template, it gives problems.
[TEMPLATE loot_medusa]
CATEGORY=Item Templates
SUBSECTION=Monster Loot Templates
DESCRIPTION=Medusa
ITEM=i_gold,{4000 5000}
ITEM=random_potion,{2 3}
ITEM=random_scroll,{2 3}
ITEM=random_reagent,{4 6}
ITEM=loaded_monster_goodie_4
ITEM={ random_magic_custom_greater 1 random_magic_jewelry 1 random_item_misc_rare 1 0 100 }
//ITEM=i_map_treasure,R99
CONTAINER=i_bag
ITEM=i_gold,{1000 1750}
ITEM=random_weapon_all
ITEM=random_armor_all
ITEM=random_potion
ITEM=random_wand_magery,R5
ITEM=random_scroll,{1 2}
ITEM=random_reagent,{3 5}
Did it ever work, having tm inside tm? I remember for sure DEF random ranges always worked, but not sure for templates
Try with random_scroll Seems to be have problem with template to def with refer to other def
Did it ever work, having tm inside tm? I remember for sure DEF random ranges always worked, but not sure for templates
Yes it did.
Yes I confirm template on template exist since a while.
But i'm not able reproduce the issue.....
[DEFNAME items_reagents]
random_reagent { random_reagent_magery 1 }
This make the error. But this case... i think is valid, right?
Try with this, this make error appears
[TEMPLATE random_item_misc_rare] CATEGORY=Random Item Templates SUBSECTION=Special DESCRIPTION=Rare Items ITEM={ random_item_plant_potted 1 }
Valid or not, a critical should not occur. Only an error should appear or it should work.
More detail
WOrk: ITEM={ random_item_plant_potted }
BUg: ITEM={ random_item_plant_potted 1 }
Qte of 1 create the critical