Repository navigation
fix: NPCs change their look when they change armor at runtime (G2: Greg wears the farmer clothes) - #541
Merged
Conversation
…eg wears the farmer clothes you give him - An already built NPC whose visual body changes (NpcVisualBodyChanged: armor (un)equipped, Mdl_SetVisualBody) gets its body's skinned meshes swapped on its existing skeleton (NpcMeshBuilder.RebuildBody via MeshService.RebuildNpcBody, listener in NpcService). The skeleton is put into its rest pose for the rebuild, as bind poses are written into the cached, shared mesh. Fatness/ghost looks are applied again. The hero is skipped. - Armor attachments go into an own child of their bone, so the old armor's ones (Greg's captain hat) are removed. - Color-only (untextured) sub meshes of NPC bodies are drawn in their color instead of being skipped, which also shifted every following material by one sub mesh. Ported from the experimental branch (b441350, 2c13522) onto develop's builders.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
An NPC that changes its armor while the game runs now also changes its look. In G2, Greg puts on the farmer clothes you give him outside Khorinis, and his captain hat goes away with his old outfit.
NpcServicelistens toNpcVisualBodyChanged(armor equipped or unequipped,Mdl_SetVisualBody). For an NPC whose mesh is already built,NpcInitializerDomain.RebuildBodyswaps the body on its existing skeleton (MeshService.RebuildNpcBody→NpcMeshBuilder.RebuildBody).[ArmorVisual] <npc>: body rebuilt as '<mdm>'.Why
Playtest 2026-11-22 (G2 Night of the Raven, PCVR build from develop): after
DIA_Addon_Greg_NW_Stadtwachen_klamottenthe log saidGreg now wears 'Armor_Bau_L.asc', but Greg still looked like the captain. Develop only updated the data (EquipDomain.UpdateArmorVisual: "An NPC's built mesh is swapped with a later PR"). Follow-up of #539. The code existed on the experimental branch (b441350, 2c13522) but never reached main/develop. No issue exists for it.How to test manually
Stadtwachen_klamotten). He visibly wears the farmer clothes right away, his captain hat is gone, and his animations (walking to the market) look normal. The log has[ArmorVisual] Greg: body rebuilt as 'Armor_Bau_L.asc'.Save/load
Nothing new is stored. Equipped items are saved; after a load,
MdmNameis derived from them and the NPC is built with the new armor anyway.Known gaps / follow-ups
Mdl_SetVisualBodyon an already built NPC rebuilds the body twice (two events). It only happens on change.NpcBodyBounds) isn't recalibrated after a rebuild.MeshService.CreateNpc(VR hero body, Lab) now also draw colour-only parts and keep attachments in_Attachmentchildren.AI usage
Claude ported the experimental commits onto develop's mesh builders and wrote this description. The user found the bug in a playtest.