Models with other models attached

Say, I want to make a display case. For reference, its behaviour is supposed to be like this:

  • It is a piece of furniture crafted by a… say, carpenter
  • When placed on the map is has a button to “assign” an item to it
  • When you press the button it opens the menu that lists items appropriate for “displaying”
  • When you select an item its model is attached to the display case.
  • If you try to “harvest” a display case the attached model disappears and the case “drops” this item.

Okay, here’s the question. I’ve not tried to attach models to other models (especially not with furniture). So I’m asking for advice. How can I do that?

Note: Generally I’d like any item to be usable in this matter, but for now for the sake of simplicity I can limit it with items already having attach points, like shields or weapons.

Alright, I’m terribly inclined to drop it for now. :glum:
Sifting through files makes things more and more complicated, and I don’t see the light in the end of this tunnel.

What I’ve found so far:

  • Models can be applied to other models via “effect” mechanic.
    Problem: the list of effects and models used in them is fixed, and I don’t know if it can be changed to dynamic.

  • Another possible approach is to try and combine decor model with a chunk of humanoid JSON, allowing this deco to equip items.
    Problem 1: Is it is even possible to do this merge?
    Problem 2: Equipping and unequipping requires writing custom LUAs. I have some experience writing in LUA, but I have no idea how to call scripts in SH an how are they working here. Trying to look at some examples left me with a smoking brain.
    Problem 3: Applying equip scripts to the object probably requires creating a custom ai pack. Another thing I know nothing about.

1 Like

Is it possible to change an already placed model with another model? It’s a roundabout way but in the short couldn’t you replace a display case with another model that has the visual you want then make it drop the originals as loot when harvested?

1 Like

Technically I can do that. It’s much more simple. But this approach lacks flexibility: I need to have a separate “combined” model for each item I want to be displayable. Aside from all the manual work it would need, it makes my display uncompatible with any weapons added by mods.

It’s just too bad you couldn’t juryrig the stockpile system into putting just that one item there.

1 Like