HugePinball Posted July 12, 2010 Share Posted July 12, 2010 Certain types of objects in the GECK have the "Random Anim Start" flag, which tells the game to start that object's idle animation (if any) at a random point when they are rendered in a scene, so if there are several of the same objects nearby they won't be animating in sync. Well, what if you want to do that for an object that doesn't have the "Random Anim Start" flag, such as a Weapon, Misc Item, or in my case, an Ingestible? I'm assuming there's no way to specify some kind of random start point for animation within a NIF, so here's what I worked out instead. First of all, the mesh must have the named "Idle" animation defined (although I suppose you could do this with any other named animation). I was finishing up my brain juice bottles, and for the Glowing One brain juice I wanted to have a little pulsing glow. I set up a Material Controller to do that (thanks to Ghogiel for his article on that), and went to test it in-game - that's when I found that if there were multiple bottles visible they'd all be pulsing in sync, which doesn't look great (see the video below). I'm not knowledgeable enough to be able to explain how to set up the Material Controller within the named Idle sequence, but I needed to do that in order for my script method to work - you'll need to get that info elsewhere, or work with a mesh that already has the Idle animation defined. So I've got the Glowing One Brain Juice in the GECK as an Ingestible. Here's the script (simplified slightly) assigned to it: ScriptName RandomAnimStartScript int bLoaded float fTimer Begin OnLoad set bLoaded to 1 set fTimer to GetRandomPercent * 5/99 End Begin GameMode if bLoaded if HasLoaded3D if fTimer > 0 PlayGroup Idle 1 set fTimer to fTimer - GetSecondsPassed Return else PlayGroup Idle 1 set bLoaded to 0 endif endif endif End In simple terms, each time a bottle appears in a scene it waits a random number of seconds up to 5 and then starts the idle animation. I used 5 because my animation is a little over 5 seconds long. The first PlayGroup is in essence stopping the idle from playing, since it's being called every frame until the timer runs out. (Actually, I guess I could save a line and remove the second PlayGroup, as it's redundant here.) So that's it! Here's a video showing how it looks, first without the script, then with it added: http://www.youtube.com/watch?v=4Nm5JWFNlIQ For those in Germany where the video is blocked (due to my music selection), here is a video download link. Link to comment Share on other sites More sharing options...
Recommended Posts