How to fake "Random Anim Start"

Post » Tue Dec 06, 2011 5:06 am

http://geck.gamesas.com/index.php?title=Special%3ASearch&search=%22Random+Anim+Start%22&ns0=1&fulltext=Search 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 http://www.fallout3nexus.com/imageshare/image.php?id=15682, 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 http://www.fallout3nexus.com/articles/article.php?id=251 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 RandomAnimStartScriptint bLoadedfloat fTimerBegin OnLoad	set bLoaded to 1	set fTimer to GetRandomPercent * 5/99EndBegin 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	endifEnd

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: [media]http://www.youtube.com/watch?v=4Nm5JWFNlIQ[/media]
User avatar
gemma king
 
Posts: 3523
Joined: Fri Feb 09, 2007 12:11 pm

Return to Fallout 3