Activators, Scripts & Animated Chests

Questions specific to OpenMW-CS can be asked, and content development related topics can be discussed here
Post Reply
User avatar
Frik
Posts: 124
Joined: 20 Dec 2016, 05:22

Activators, Scripts & Animated Chests

Post by Frik »

I'm using a mod called animated chests, which animates the opening & closing of most chests in the game. Occasionally, I run across a chest doesn't get animated. I had this problem with my recent mod, where I cloned a chest that doesn't animate.

I'm trying to understand how the Animate Chests mods works and from what I can tell, it adds an activator (with a dummy script?), then goes through all the chests and somehow sees their meshes, like this one: o\contain_chest10.nif, then changes it to o\anim_chest10.nif, and attaches a script to the object. In the case of my cloned chest, it failed do that, kept the original mesh and didn't add the script.

I guess I'm just not understanding what mechanism it uses to automagically find all the chests. It's certainly not finding my added chest. Any ideas?

Thanks!
Last edited by Frik on 20 Jan 2017, 18:59, edited 1 time in total.
User avatar
MiroslavR
Posts: 156
Joined: 12 Feb 2014, 17:45

Re: Activators, Scripts & Animated Chests

Post by MiroslavR »

Link to the animated chests mod?
User avatar
Frik
Posts: 124
Joined: 20 Dec 2016, 05:22

Re: Activators, Scripts & Animated Chests

Post by Frik »

Here is a link to the original mod:
http://download.fliggerty.com/download--680

This appears to be the animation meshes/resources here:
http://www.nexusmods.com/morrowind/mods/43453/?

Someone created a mod using those resources. The AnimChests readme is vague and contains little info.This is the entirety of it:
MORROWIND CHESTS ANIMATED

This mod adds open/close animation to all chests. Chests are by Phaedrus.
Tribunal or Bloodmoon are not required but all chests in Mournhold and Solstheim have animation.
Chests that had scripts attached left untouched.
Go to Arena pit ( type in the console "coc "vivec, arena pit"") to test them.
Let me know if the game crashes when opening chests or entering cells.
I'm interested in the mechanism being used to attach a script to all the chests.

Thanks
User avatar
MiroslavR
Posts: 156
Joined: 12 Feb 2014, 17:45

Re: Activators, Scripts & Animated Chests

Post by MiroslavR »

As far as I can tell, the mod simply modifies vanilla containers to give them custom animated models as well as scripts that play the opening animation upon activation and suppress the activation outcome until some time has passed, and then play the closing animation when MenuMode turns 0.

For whatever reason, the scripts also place an "anim_chest_whatever" activator (which has the same model as the container) to overlap the container. The activators have the "animchestdummy" script attached to them that disables them instantly. I am clueless as to what the purpose of these activators might be; the mod seems to work fine without them.
User avatar
Frik
Posts: 124
Joined: 20 Dec 2016, 05:22

Re: Activators, Scripts & Animated Chests

Post by Frik »

MiroslavR wrote:As far as I can tell, the mod simply modifies vanilla containers to give them custom animated models as well as scripts that play the opening animation upon activation
Yes, but how does it do that? Does it search through the object table looking for a pattern match? My added chest uses the same model as vanilla chests. Looking at the table I posted, why wouldn't it also replace the model and add a script to my cloned chest?

Edit: On 2nd thought, I suppose there is no mechanism to do that within a mod. So, the modder just went through and manually changed all of the chests to use the new model, and attached a script to each. That would explain why I occasionally see chests that aren't animated. Those are probably non-vanilla chests added by another mod.

In my case, I wanted a chest that contained specific items, so I didn't want to modify an existing chest.
Chris
Posts: 1626
Joined: 04 Sep 2011, 08:33

Re: Activators, Scripts & Animated Chests

Post by Chris »

I believe a similar thing happens with Graphic Herbalism type mods. The modder has to go through and manually place a script on each plant that, when activated, replaces the model and auto-adds the appropriate amount of ingredients to the player's inventory. That also causes plants added by other mods to still use the old menu interface since they don't have the script.

It would be nice to see proper support for things like this. For instance, having specially-named animation sequences in a container model, and when activated, the engine automatically plays the open animation sequence and brings up the menu, without the need of a script, and automatically plays the close animation sequence when the menu is closed. Similar for plants and stuff, a 'harvest' animation sequence that causes some or all of the model to disappear as the ingredients are added to the actor's inventory without needing to add a script.
User avatar
Frik
Posts: 124
Joined: 20 Dec 2016, 05:22

Re: Activators, Scripts & Animated Chests

Post by Frik »

Interesting idea, Chris. :idea: Perhaps something like that would be a nice feature for the future.

I was thinking there was/could be some type of global animation/script activator, which would globally substitute a static model with an animated model, then add an associated script. This could also be useful for something like Windows Glow, among other things.
Post Reply