Repository navigation
fix: a script that takes the last piece of a worn item takes it off (G2: Greg's farmer clothes) - #539
Merged
Merged
Conversation
… giving Greg your farmer clothes leaves you in your naked body Like the engine (oCNpc::RemoveFromInv, OpenGothic Inventory::delItem), Npc_RemoveInvItem(s) unequips an equipped item when its last piece leaves the inventory: protection and on_unequip (next frame, like script equips) go, the armor visual (VR hero body) goes back to the naked body. Weapons leave the equipped list and the NPC's belt. Only script removals: a VR weapon in a hand or holster is out of the backpack but still equipped.
5 tasks
Contributor
Author
|
Follow-up for Greg's own look (NPC body mesh rebuilt on a runtime armor change): #541 |
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
When a script takes the last piece of an item you're wearing, you take it off first, like in the original engine.
In G2, when you give Greg your farmer clothes, the armor leaves your inventory and your VR body goes back to the naked
body. You also lose the armor's protection.
Npc_RemoveInvItemandNpc_RemoveInvItemscall the newNpcInventoryService.UnequipIfLastOneRemoved(engine:
oCNpc::RemoveFromInv; OpenGothic:Inventory::delItem).EquipDomain.UnequipItemWithEffects: protection is removed,on_unequipruns next frame like other script equips, and the armor visual returns to the naked body;EquipDomain.RemoveEquippedWeapon.backpack paths are unchanged.
[Equip] <npc>: a script took the last '<item>' - taking it off like the engine.(category NPC)Why
Found in a playtest on 2026-11-22 (G2 Night of the Raven, PCVR build from develop). In Greg's dialog
DIA_Addon_Greg_NW_Stadtwachen_klamottenoutside Khorinis, the farmer clothes left the inventory, but the hero stillwore them. No issue exists for this.
How to test manually
from the inventory, the VR hero body shows the naked body, and the log has
[Equip] ... a script took the last 'Strój farmera ...'.Save/load
Equipped items are saved, and the given-away armor is no longer among them, so after a load the hero isn't wearing
it. Nothing new is stored.
Known gaps / follow-ups
Greg now wears 'Armor_Bau_L.asc'), but developdoesn't rebuild an NPC's built mesh when it changes armor at runtime (
EquipDomain.UpdateArmorVisual, comment"swapped with a later PR"). Fixing that is a port of the experimental
b44135034and2c1352259(
MeshService.RebuildNpcBody).InventoryTransferServiceunequip a worn item that gets traded away.tested yet.
AI usage
Claude traced the bug from the playtest log, wrote the fix and compared it with the engine and OpenGothic. The user
found the bug in a playtest.