Jump to content

How does ModuleScienceExperiment know which animation to trigger?


Recommended Posts

I'm curious how ModuleScienceExperiment is wired up to animations.

Stock science experiment parts like the Mystery Goo Containment Unit have two modules as illustrated below.

I've learned through experimentation that the first (ModuleAnimateGeneric) provides an action button on the part's right-click menu (at least in the VAB, and usually after launch) that triggers the animation.  For the Goo, the button is labeled "Deploy".  I've also determined animationName points the game to the relevant animation in the mu file.

Similarly, ModuleScienceExperiment includes button labels that show up on the part's right-click menu (e.g. "Observe Mystery Goo").  And when you perform the science experiment in the game by clicking the button, the animation is triggered (start animation, then end animation).  However the module is missing any reference to an animation name.  I'm wondering how the game determines which animation to run.  Is it always assumed parts with ModuleScienceExperiment will also have a ModuleAnimateGeneric, and is that how the game looks up the animation?

I'm asking because I want to have a part with multiple ModuleScienceExperiment's and ModuleAnimateGeneric's.  When I do that in my weldment, performing a science experiment doesn't trigger the animation (but the animations still run when using the buttons corresponding to the first module).

        name = ModuleAnimateGeneric
        animationName = Deploy
        startEventGUIName = Deploy
        endEventGUIName = Close
        actionGUIName = Toggle Cover
        name = ModuleScienceExperiment
        experimentID = mysteryGoo
        experimentActionName = Observe Mystery Goo
        resetActionName = Reset Goo Canister
        useStaging = False
        useActionGroups = True
        hideUIwhenUnavailable = True
        xmitDataScalar = 0.3
        FxModules = 0
        dataIsCollectable = True
        collectActionName = Collect Data
        interactionRange = 1.2
        usageReqMaskInternal = 1
        usageReqMaskExternal = 8


Edited by Fwiffo
Link to comment
Share on other sites

40 minutes ago, ShotgunNinja said:

ModuleScienceExperiment  is propably picking up the first ModuleAnimateGeneric it find in the same part, if there is any. Then it use it to play the animation animationName.

I didn't think that's right, as my part had two ModuleAnimateGeneric's and it wasn't triggering either one.

But you prompted me to experiment some more with ordering.  From what I can determine:  When you activate a ModuleScienceExperiment, the game just grabs the very first module (whatever it is), looks for its animationName (if exists) and runs that.  So you can either move the desired animation module up to the top, or (if you don't want to mess up the action button ordering) just add a gimped moduleAnimateGeneric as the first module in your CFG:

	name = moduleAnimateGeneric
	animationName = blah

The latter technique gives you an extra "toggle" button in the Editor, but it goes away in flight.

And yes, as far as I can tell, this means if a part has multiple ModuleScienceExperiment's they must all share the same experiment animation.

Also turns out some other non-science parts use a similar scheme.  e.g. The Comms DTS-M1 similarly looks to the first module when picking the animation to run for its "Transmit Data" action.  (And the second technique above doesn't work; the extra "toggle" button stays present after launch, so you need to move its moduleAnimateGeneric to the top)

I'm finding so much good information like this lately; wish the wiki was publicly editable so I could make updates.

Edited by Fwiffo
Link to comment
Share on other sites

4 hours ago, Fwiffo said:

wish the wiki was publicly editable so I could make updates.

I think you can do that,but you need to create an account.After you login you'll get the edit button next to every title.
I tried once but formatting is little odd for me,so i gave up.

Link to comment
Share on other sites

  • 1 month later...

Weeks later, I finally learned the FxModules attribute is what wires the experiment up to the correct animation module.  That solved my problem for many cases without needing to rearrange ModuleAnimateGeneric's.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...