Source-X icon indicating copy to clipboard operation
Source-X copied to clipboard

Kill NPC make assert exception

Open raydienull opened this issue 8 months ago • 8 comments

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)

raydienull avatar May 19 '25 07:05 raydienull

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}

raydienull avatar May 19 '25 08:05 raydienull

Did it ever work, having tm inside tm? I remember for sure DEF random ranges always worked, but not sure for templates

cbnolok avatar May 19 '25 09:05 cbnolok

Try with random_scroll Seems to be have problem with template to def with refer to other def

raydienull avatar May 19 '25 10:05 raydienull

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.

GladieUO avatar May 19 '25 10:05 GladieUO

Yes I confirm template on template exist since a while.

Image

But i'm not able reproduce the issue.....

Jhobean avatar May 19 '25 11:05 Jhobean

[DEFNAME items_reagents]
random_reagent         { random_reagent_magery 1 }

This make the error. But this case... i think is valid, right?

raydienull avatar May 19 '25 13:05 raydienull

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 }

raydienull avatar May 19 '25 13:05 raydienull

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

Jhobean avatar May 21 '25 10:05 Jhobean