particle looping question

Post » Mon May 12, 2014 8:48 am

Hello,

I'm trying to create a particle effect when companions "drink" a potion. Normally you can't force NPCs to drink them (Equip doesn't work, AIActivate crashes the game), so I need to simulate the effect with script. To make it more accurate I decided to spawn an activator on companion (PlaceAtMe) with vanilla particle mesh that is used for restoration hit spell effect (magic_hit_rest.nif). And when the animation is over delete it.

For some reason vanilla spell effect meshes are not animated in game when spawned manually - stop probably on the first frame. They loop properly in NifSkope, so I think there may be some additional parameter set in mesh (something like NiStringExtraData that disables collision in game or those additional data for editor markers). I tried to compare the spell effect mesh with meshes from http://mw.modhistory.com/download-56-10923 in NifSkope to find the differences, but I couldn't see anything unusual about that vanilla mesh. Does anyone know how to fix it? Here is a mesh that doesn't loop in game: http://www.sendspace.com/file/v1jvup

by the way is there an easy way to loop particle only once instead of constant looping? This would give a better result (not dependent on FPS) when deleting the activator. edit: already answered by ThatGuyFromBlade.

User avatar
Leonie Connor
 
Posts: 3434
Joined: Mon Mar 12, 2007 4:18 pm

Post » Mon May 12, 2014 8:42 am

This is a tough one. Never heard of a broken loop sofar, as the loop is set within the .nif itself. You can alter the flags of the different controllers in nifskope and chose "cyclic", "reverse" and "clamp". "Clamp" would be the one to use if a single playthrough of the animation is intended. Problem might be that the particles/ billboards will just stop moving but still be visible, frozen at the last frame.

I'm no scripter myself...question: Can you force an NPC to cast a spell? If so, why not simply create a new spell with the desired effect of the potion and add a drinking sound as audio file? :)

User avatar
Marquis deVille
 
Posts: 3409
Joined: Thu Jul 26, 2007 8:24 am

Post » Sun May 11, 2014 7:54 pm

Thanks for the answer. That last frame freeze doesn't sound like a good solution, so unless I find a way to add additional blank frame without particles I won't use it. Adding a dummy sound at the last frame will allow me to detect it via local script attached to activator and delete it before it starts the new loop.

Yes, you can force them to cast spells. What I try to achieve is a full simulation of potion drinking. When you force NPC to cast spell the whole NPC casting animation will play, cast particle effects and sound and than hit particle effects. I need only the last step and instant visual effect, so it's not a good workaround.

The main problem remains unresolved, so I hope that someone will find a time to look into that mesh.

User avatar
Cartoon
 
Posts: 3350
Joined: Mon Jun 25, 2007 4:31 pm

Post » Mon May 12, 2014 11:04 am

Took a look at the .nif and might have a solution to the visibility of particles. In the block list you can find a node 110 NiParticleSystemController, highlight it and check it's properties in the block details. The actual "stop time" of the loop is set to 2, the "emit stop time" is set to 1,667 and the "lifetime" of the particles to 0.800. That means, as long as "emit stop time" plus "lifetime" stay below the "stop time" of 2, no particles will be visible at the loop's end.This way I was able to remove the spiraling particles at the end of loop. Oddly some particles still remain visible, not sure if they will persist ingame though. Can't even select them and they don't seem to have a corresponding node in the block list. Maybe just try ingame and see if it functions.

User avatar
Thomas LEON
 
Posts: 3420
Joined: Mon Nov 26, 2007 8:01 am

Post » Mon May 12, 2014 10:33 am

Setting "stop time" to higher value will give me enough time to remove the activator regardless of FPS. Of course I can't test it in game because the whole animation is not working like I mentioned in the first post, but based on what it looks like in NifSkope, this should hide the animation before the next loop. Thanks.

User avatar
Marion Geneste
 
Posts: 3566
Joined: Fri Mar 30, 2007 9:21 pm


Return to III - Morrowind