Quick Questions, Quick Answers - Thread #24

Post » Sun May 18, 2014 7:10 am

Dear frens,

is there a way to preview the idle animations? holla

User avatar
Rusty Billiot
 
Posts: 3431
Joined: Sat Sep 22, 2007 10:22 pm

Post » Sun May 18, 2014 7:41 am

I'm building a Dwemer Drill, that where it is, is drilling into a rock wall; I also want an effect that makes it look like dirt and rock is crumbling and being blasted aside...

The only problem is, I can't find any object that looks like that, except perhaps "TrapRiggedRockFall01FX (riggedrockfall01fx)"; the problem with this object is, the animation plays once, then stops...

Is there a script to make it loop the dirt and rock animation in the Creation Kit, or a simple way, using Nifskope, to force the animation to loop?

User avatar
Sara Lee
 
Posts: 3448
Joined: Mon Sep 25, 2006 1:40 pm

Post » Sun May 18, 2014 9:00 am

Have you tried anything using a while loop script? I can easily do it in a magic effect script; Just in case you don't know what I mean:

int LoopingEvent OnEffectStart() ;This obviously needs to be different in your case   Looping = 1      While Looping == 1   Debug.SendAnimation(akTarget,YourAnimation)   EndWhileEndEvent
User avatar
chinadoll
 
Posts: 3401
Joined: Tue Aug 22, 2006 5:09 am

Post » Sun May 18, 2014 10:06 am

This is the script I made, based on what you gave me:

Scriptname aaaMOTDQuest10DrillDustScript Extends ObjectReferenceInt Property Looping AutoEvent OnLoad()	Looping = 1	While Looping == 1		Debug.SendAnimationEvent(Self,"AnimPlay")	EndWhileEndEvent

Unfortunately, it doesn't do anything; I've never been a wiz with scripts, so you'll have to forgive any novice mistakes I've made...

User avatar
Cayal
 
Posts: 3398
Joined: Tue Jan 30, 2007 6:24 pm

Post » Sun May 18, 2014 11:40 am

Yea, I'm no wiz either but I know some basics. Why did you define the variable like that? Did my way not work? That's the way I've been doing it and it works perfectly.

User avatar
sarah
 
Posts: 3430
Joined: Wed Jul 05, 2006 1:53 pm

Post » Sun May 18, 2014 10:55 am

Emerald Demond, I'm not familiar with "TrapRiggedRockFall01FX (riggedrockfall01fx)", but does it play the animation whenever it is enabled? Perhaps you could disable and enable it?

User avatar
louise fortin
 
Posts: 3327
Joined: Wed Apr 04, 2007 4:51 am

Post » Sun May 18, 2014 11:12 am

Emerald Demond, you seem to be using an OnLoad() event, which is guaranteed to trigger only, if you enter the cell for the first time. At other times, it may or may not trigger, based on whether the game engine has already loaded the cell and your drill earlier, and may or may not have discarded it from memory based on its own whims.

You could add a line like Debug.Notification("I should be looping now") inside the event. If it does not show, you may need to change your event type.

Also, defining the Looping variable as a property can make sense, if you intend to access it from some other script in order to change its value and thus exit from the loop, or something like that. Otherwise, if it is just used as shown in the script, there is no need to define it as a property, which only adds unnecessary overhead to the script.

There is also the minor point, that a script like that will run forever unless halted, which will also keep the object in question persistent in memory. It might make sense to have a structure, that would start/stop the animation when the cell is Attached/Detached. I would actually replace your OnLoad() event with OnCellAttach() and use an OnCellDetach() event to set the Looping variable to 0. Furthermore, you would probably want to have a Wait(SomeSuitablePeriod) call in the script, so that the the animation has time to run before it is called upon again.

Actually, you can also feel free to disregard all above, as I have not really dabbled with such animations, and these are just "immediate layman's observations". Somebody more experienced may have better suggestions.

But anyway, here is how I would implement an "infinite" loop, that stops when the cell is detached.
Spoiler

int LoopingEVENT OnActivate()		; To jump start looping, if the option is desired, otherwise not necessary.	if Looping > 0		; If already looping, don't launch a second multi-threaded instance.		Looping = 1	; Cancel any pending 2-state for shut down.	else		Looping = 1	; Start Looping.		Loop()	endifendEVENTEVENT OnCellAttach()		; Regular launch	if Looping > 0		; If already looping, don't launch a second multi-threaded instance.		Looping = 1	; Cancel any pending 2-state for shut down.	else		Looping = 1	; Start Looping.		Loop()	endifendEVENTEVENT OnCellDetach()		; Initiate shut down.	if Looping > 0		; Go to 2-state to shut down an ongoing loop.		Looping = 2	endifendEVENTFUNCTION Loop()			; Continue to Loop, while Looping is in 1-state.	while Looping == 1		;; Do Stuff here		Utility.Wait(3.0) ; Or what ever is a suitable loop period	endwhile	Looping = 0	 	; Shut down looping.endFUNCTION
It takes into account the possibility, that the cell may be detached and re-attached while the loop is in a wait-state, and that may cause some multithreading-related issues unless precautions are taken. (I did not create it for this occasion, it is a slight modification of what I use in my own private, modified version of the snoring script in Sounds of Skyrim)
User avatar
Siobhan Wallis-McRobert
 
Posts: 3449
Joined: Fri Dec 08, 2006 4:09 pm

Post » Sun May 18, 2014 2:39 am

Oh, thank you for the corrections; like I said, I really have no clue when it comes to scripting...

I only ever really use the Property generator, I rarely write my own, and as for Events, I know even less, so...

But taking your new suggestions, and modifying them, I've finally made it work; thank you so very much for all your help, it's absolutely perfect...

User avatar
Dean Ashcroft
 
Posts: 3566
Joined: Wed Jul 25, 2007 1:20 am

Post » Sun May 18, 2014 6:33 am

Post limit. http://www.gamesas.com/topic/1471891-quick-questions-quick-answers-thread-25/

- Hypno
User avatar
Unstoppable Judge
 
Posts: 3337
Joined: Sat Jul 29, 2006 11:22 pm

Previous

Return to V - Skyrim