View Issue Details

IDProjectCategoryView StatusLast Update
0006326The Dark ModModelspublic26.11.2023 19:27
ReporterMirceaKitsune Assigned Tostgatilov  
Status resolvedResolutionfixed 
PlatformLinuxOSManjaroOS VersionStable
Product VersionTDM 2.11 
Fixed in VersionTDM 2.12 
Summary0006326: Crash: TDM crashes when modifying the model / skin of the player's head
DescriptionI'm working on a mod containing a script that modifies the player head, intended so the player can see himself with a custom head model when looking in a mirror. I use the following function on an item converted to a testing example:

void myitem::inventoryUse(entity userEntity, entity frobbedEntity, float buttonState)
    entity head = userEntity.getHead();

While this works and the head is successfully modified, weird effects such as the HUD blinking randomly start to happen, followed soon by a crash to the main menu with the following error printed to the console:

ERROR:idRenderWorld::UpdateEntityDef: index = -1

The crash can be immediately triggered by simply running head.hide() on the player's head from any script. I've temporarily commented out this feature in my script, hopefully this problem can be resolved so the intended functionality may be supported, I simply need the ability to use a different player head then revert back to the old one.
TagsCrash, model




04.11.2023 07:46

administrator   ~0016160

Could you please post some way to reproduce here?

I looked at the code, and I think changing model of head should not be a big problem.
Just don't try to change the whole head entity: this would be dangerous =)


04.11.2023 19:59

reporter   ~0016162

The mod I was working on for which I wanted this is now public: It should be easy to use it to test the problem.

Steps to reproduce: Download the disguises mod and insert it into a test FM, place a helmet item on the map and try it out to make sure the mod is working normally. Because I commented out this feature to avoid the crash, open up tdm_disguise.script and below lines 73 and 91 comment back in the functions for "head.setModel" and "head.setSkin". Test the mod again by putting the disguise on and off a few times, wait a couple of seconds and in a few minutes at most you should randomly be crashing to the main menu... in addition the head model doesn't always change when looking in a mirror although initially that worked.

But yes: I'm changing only the model of the head using the setModel function. That seems to be enough to trigger the "index -1" crash within seconds.
disguises_1.0.pk4 (444,966 bytes)


04.11.2023 20:08

reporter   ~0016163

Here's the full test case with map included, I enabled the lines responsible for changing the head so no further changes are needed: Just unpack this in the fms directory set it as the active FM and run "testmap test" from the console. Pick up and use a helmet, I tested it again and the crash occurs in a few seconds... once it will work you should see yourself with the guard head while the disguise is worn when looking in the mirror behind the player. (454,517 bytes)


05.11.2023 17:26

administrator   ~0016167

Thank you!

I fixed the error in svn rev 10495.
But I could not verify that head switching works: the mirror behind me is black.
Not sure if this is map error or something I broke recently with other changes... Accountant 2 mirrors work fine.


05.11.2023 20:11

reporter   ~0016168

Thanks! I will likely update my mod after the next dev snapshot having the custom head enabled. I plan on making it possible to steal the helmets from guards, which will require changing the head models of AI too so I'll have to see how that works.

And that's strange: That mirror is suddenly black for me as well, but it definitely worked until yesterday. Perhaps the latest dev snapshot introduced a new bug? I'm not doing anything unusual that should be causing this, it's just textures/common/mirror on the face of a square brush... maybe it only works on patches now?

Issue History

Date Modified Username Field Change
16.10.2023 17:13 MirceaKitsune New Issue
16.10.2023 17:13 MirceaKitsune Tag Attached: Crash
16.10.2023 17:13 MirceaKitsune Tag Attached: model
04.11.2023 07:46 stgatilov Note Added: 0016160
04.11.2023 19:59 MirceaKitsune Note Added: 0016162
04.11.2023 19:59 MirceaKitsune File Added: disguises_1.0.pk4
04.11.2023 20:08 MirceaKitsune Note Added: 0016163
04.11.2023 20:08 MirceaKitsune File Added:
05.11.2023 17:26 stgatilov Note Added: 0016167
05.11.2023 17:26 stgatilov Assigned To => stgatilov
05.11.2023 17:26 stgatilov Status new => feedback
05.11.2023 20:11 MirceaKitsune Note Added: 0016168
05.11.2023 20:11 MirceaKitsune File Added: Screenshot_20231105_220902.png
05.11.2023 20:11 MirceaKitsune Status feedback => assigned
26.11.2023 19:27 stgatilov Status assigned => resolved
26.11.2023 19:27 stgatilov Resolution open => fixed
26.11.2023 19:27 stgatilov Fixed in Version => TDM 2.12