Jump to content

Scripting Help ..... for ZaZ Stuff


ZaZ

Recommended Posts

Posted

I'm practically zero at scripts ,  so I will need some guidance and help ,

 

1. What I want to do is create an enchantment effect  that adds/attaches an art object while one enters a specific furniture

2. This effect is kinda passive  and should be only for the duration of the the time when in the furniture 

3. Once the actor is off the furniture the effect is off and the art object is removed .

 

Antons DragonWings and the animated Gaunt let  uses this kind of effect

 

 

Scriptname _Anton_AnimatedGlovesFemale_Static extends ObjectReference  

Spell Property _Anton_AnimatedObjectSpell Auto
Sound Property _Anton_Voice_Equip Auto
Int SoundREF

Auto State NothingEquipped
	
	Event OnEquipped( Actor akActor )
		GoToState("AnimatedObjectEquipped")
		
		; Добавляем способность
		akActor.AddSpell(_Anton_AnimatedObjectSpell, False)
		_Anton_AnimatedObjectSpell.Cast( akActor, None )
		
		; Говорим вступительную речь
		SoundREF = _Anton_Voice_Equip.Play(akActor)
		Sound.SetInstanceVolume(SoundREF, 1.0)
	EndEvent

	Event OnUnequipped( Actor akActor )
	EndEvent

EndState

State AnimatedObjectEquipped
	
	Event OnEquipped( Actor akActor )
	EndEvent

	Event OnUnequipped( Actor akActor )
		akActor.DispelSpell(_Anton_AnimatedObjectSpell)
		akActor.RemoveSpell(_Anton_AnimatedObjectSpell)
		GoToState("NothingEquipped")
	EndEvent

EndState

 

 

 This is pretty much a casting spell , kinda ,

I just want the enchantment that adds the art object when on the specified furniture for that specific duration, hope to get some help 

 

Cheers

Posted

You can add a objectreference script to the actor or alias who will use the furniture.

In the script you may use onsit and on getup events. Under onsit handler cast your magic, under ongetup handler use dispelspell.

Something like this:

 

Event OnSit(ObjectReference akFurniture)

If(AkFurniture == YourFurniture)

YourSpell.Cast(Self, Self)

EndIf()

EndEvent

 

Event OnGetUp(ObjectReference akFurniture)

If(akFurniture == YourFurniture)

Self.DispelSpell(YourSpell)

EndIf

EndEvent

 

You can also use an OnActivate event in a script attached to the base object of the furniture.

But im unable to test it now.

Posted

 

You can add a objectreference script to the actor or alias who will use the furniture.

In the script you may use onsit and on getup events. Under onsit handler cast your magic, under ongetup handler use dispelspell.

Something like this:

 

Event OnSit(ObjectReference akFurniture)

If(AkFurniture == YourFurniture)

YourSpell.Cast(Self, Self)

EndIf()

EndEvent

 

Event OnGetUp(ObjectReference akFurniture)

If(akFurniture == YourFurniture)

Self.DispelSpell(YourSpell)

EndIf

EndEvent

 

You can also use an OnActivate event in a script attached to the base object of the furniture.

But im unable to test it now.

 

 

Yeh this magic / enchant stuff is a bit tedious :s ,

but I did look up a script that worked on activate its just that it only plays the first animation in the nif , but it works , But  I need to get it to play multiple animations in the nif not just the first one on activate , let me show you code 

Scriptname ZaZVerticalStocksXScript extends ObjectReference  

bool 	property bPlayerVictim 	        auto hidden
Actor 	property akVictim 		auto hidden

Event OnLoad()
	;debug.notification("Initialised.")
	SetMotionType(Motion_Keyframed, false)
EndEvent

event onActivate(ObjectReference akActivator)

	; don't start if the victim isn't using the machine
	; this is to keep from starting again if the player is trying
	; to leave after the animation is done.
	Actor activatorREF = akActivator as Actor
	if (activatorREF.getSitState() == 4) 
		return
	endif

	; make sure the mesh can play the animation
	SetMotionType(Motion_Keyframed, true)

	; check to see if it's the player
	akVictim = akActivator as Actor
	if (akVictim == Game.getPlayer())
		bPlayerVictim = true
	else
		bPlayerVictim = false
	endif
	

	; play the animation
	if (!playGamebryoAnimation("mBegin", true, 0.0))
		Debug.notification("Machine animation failed")
	endif

endEvent

"mBegin" is the first animation in the sequence of 5 animation events , it plays just as intended  

ZaZAPFVS00Enter  -  mbegin 
ZaZAPFVS01 
ZaZAPFVS02
ZaZAPFVS03
ZaZAPFVS04 

 

the other 4 animation events are  ignored kinda , what I want to do is sync the animation events with the animations in the nif 

for eg if i call  ZaZAPFVS01 , I  want it to play its corresponding nif animation .

 

By the way the top code was based on pure luck 

 

Cheers

Posted

I never tried using furniture animations. So I'll be guessing things.

 

How did you defined your animations in the pack? What is the animation type, cyclic, acyclic? I think when you use the furniture, animations in the list should play in squence until an cyclic animation. Fore example if your have 2 acyclic animations and third one is cyclic, first two will play, then you'll be stuck in the third animation. It'll keep playing until you exit or intervene it by script. To make the actor play other animations, you can use Debug.SendAnimationEvent(Actor, "AnimationEvent").

 

Also how do you want to do the syncing? With an animation event send by the animation, which is embedded in the animation? You can write your animation event into the animation (annotations) and then catch them by using RegisterForAnimationEvent/OnAnimationEvent.

 

If you just want the animations to play after a certain amount of time, I do that by simply pausing the script and sending Debug.SendAnimationEvent s. Duration of your pause should be more than the duration of your animation. For example:

 

Event OnActivate(ObjectReference akActivator)

     ...

     Utility.Wait(2)

     Debug.SendAnimationEvent(ZaZAPFVS02)

     Utility.Wait(2)

     Debug.SendAnimationEvent(ZaZAPFVS03)

     ...

EndEvent

 

Posted

I never tried using furniture animations. So I'll be guessing things.

 

How did you defined your animations in the pack? What is the animation type, cyclic, acyclic? I think when you use the furniture, animations in the list should play in squence until an cyclic animation. Fore example if your have 2 acyclic animations and third one is cyclic, first two will play, then you'll be stuck in the third animation. It'll keep playing until you exit or intervene it by script. To make the actor play other animations, you can use Debug.SendAnimationEvent(Actor, "AnimationEvent").

 

Also how do you want to do the syncing? With an animation event send by the animation, which is embedded in the animation? You can write your animation event into the animation (annotations) and then catch them by using RegisterForAnimationEvent/OnAnimationEvent.

 

If you just want the animations to play after a certain amount of time, I do that by simply pausing the script and sending Debug.SendAnimationEvent s. Duration of your pause should be more than the duration of your animation. For example:

 

Event OnActivate(ObjectReference akActivator)

     ...

     Utility.Wait(2)

     Debug.SendAnimationEvent(ZaZAPFVS02)

     Utility.Wait(2)

     Debug.SendAnimationEvent(ZaZAPFVS03)

     ...

EndEvent

 

Actually , Hold on to this thought , Cause I will need some time to learn what all this means when trying to call animations via scripts   , But for the moment I did manage to solve it using a the Behavior Creator by Anton so I kinda replicated what was done in the AnimatedDragonWings Mod , only this time I used the same thing on furniture , Lost my mind trying to figure out behavior files but it worked just need to redo some of the loops so they match 

 

 

 

[Begin]
[===Animation===]mBegin
end								mLoop
[===Animation===]mLoop
ZaZAPFVS01						mAnimation1_Start
ZaZAPFVS02						mAnimation2_Start
ZaZAPFVS03						mAnimation3_Start
ZaZAPFVS04						mAnimation4_Start
ZaZAPFVS00Exit					mEnd
[===Animation===]mEnd
ZaZAPFVS00Enter					mBegin
EndAnim							[***]
[===Animation===]mAnimation1_Start
end							mAnimation1_Loop
[===Animation===]mAnimation1_Loop
ZaZAPFVS02						mAnimation1_End
ZaZAPFVS03						mAnimation1_End
ZaZAPFVS04						mAnimation1_End
ZaZAPFVS00Exit					mEnd
[===Animation===]mAnimation1_End
end								mLoop
[===Animation===]mAnimation2_Start
end							mAnimation2_Loop
[===Animation===]mAnimation2_Loop
ZaZAPFVS01						mAnimation2_End
ZaZAPFVS03						mAnimation2_End
ZaZAPFVS04						mAnimation2_End
ZaZAPFVS00Exit					mEnd
[===Animation===]mAnimation2_End
end								mLoop
[===Animation===]mAnimation3_Start
end								mAnimation3_Loop
[===Animation===]mAnimation3_Loop
ZaZAPFVS01						mAnimation3_End
ZaZAPFVS02						mAnimation3_End
ZaZAPFVS04						mAnimation3_End
ZaZAPFVS00Exit					mEnd
[===Animation===]mAnimation3_End
end								mLoop
[===Animation===]mAnimation4_Start
end							mAnimation4_Loop
[===Animation===]mAnimation4_Loop
ZaZAPFVS01						mAnimation4_End
ZaZAPFVS02						mAnimation4_End
ZaZAPFVS03						mAnimation4_End
ZaZAPFVS00Exit					mEnd
[===Animation===]mAnimation4_End
end								mLoop
[End]

 

 

 

The the moment the animation events are called the .nif animation plays in tandem , its not perfect but just need to adust the parameters so the animations in the nif match and are smooth 

 

post-8713-0-40717300-1426860168_thumb.jpg

 

Cheers and thank you for your help 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...