Jump to content

Need Help with Small Scripting Issue


Recommended Posts

Hey y'all!

I am trying to make a simple mod, in which I give the daedric artifacts a skill with custom animations. Everything (almost) is working fine, except that when the animation ends and the script calls for "Ritual Spell Out", the character stays on that position for a while.  The thing is, from what I saw peeking through other's scripts, this wasn't supposed to happen.

I call the AnimEvent using Debug and I have to call the Ritual Out or else the character gets stuck. Other mods do the same, with basically the same script and this ugly animation never plays (like the mod Vitrium, for instance). But mine does, and no amount of changing the script helped.

By the way, this is the script:

SPELL Property FastHealing  Auto
Bool FirstPersonView = false  
Actor selfRef

Event OnEffectStart(Actor Target, Actor Caster)

	selfRef = Target
	if selfRef == game.GetPlayer()
		if selfRef.GetSitState() == 0 && selfRef.GetAnimationVariableInt("bIsRiding") == 0 && selfRef.GetAnimationVariableInt("bInJumpState") == 0 && selfRef.GetAnimationVariableInt("IsEquipping") == 0 && selfRef.GetAnimationVariableInt("IsUnequipping") == 0
			Game.DisablePlayerControls(true, false, true, false, false, false, true, false, 0)
			if selfRef.GetAnimationVariableInt("i1stPerson") == 1
				FirstPersonView = true
				game.ForceThirdPerson()
			endIf
			debug.sendAnimationEvent(selfRef as objectreference, "RitualSpellStart")  # here I call for the modified animation and it works nicely!
			FastHealing.Cast(SelfRef)
		else
			self.dispel()
		endIf
	else
		self.dispel()
	endIf
endEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)
	debug.sendAnimationEvent(selfRef as objectreference, "RitualSpellOut")  # The problem lies here. This animation lasts longer than the one that should be the ONE.
	if FirstPersonView
		game.ForceFirstPerson()
	endIf
	game.EnablePlayerControls(true, true, true, true, true, true, true, true, 0)
endEvent

Does anyone know what's wrong with the script? Thanks!

Link to comment
Share on other sites

Replaced the 

debug.sendAnimationEvent(selfRef as objectreference, "RitualSpellOut")

with: 

debug.sendAnimationEvent(selfRef as objectreference, "IdleForceDefaultState")

just to see if the magic release animation would stop playing and, oddly enough, it didn't. It remains the same, no matter what I do... maybe the "RitualSpellStart" forcibly calls the "RitualSpellOut" animation via behaviour? 

I'll continue to try things out...

Link to comment
Share on other sites

Papyrus compiles everything just fine; no errors whatsoever.
I'm guessing the problem is with the behaviour or, at least, the way SAE works, though I'm not sure what exactly.

I need to play the animation with a sword (for a Dawnbreaker skill), DAR changes the animation and then the character was supposed to just resume the fighting or whatever the player is doing at the moment, but without calling the SpellOut event, the character just gets stuck, believe it or not, IN the SpellOut animation. On the other hand, if I call the SpellOut event, the character performs the pose for 2 or 3 seconds, and only then the behaviour resumes.

I really need to get rid of this last portion of the animation so as to not break the flow of the gameplay for end users, but it's been a pain in the arse...

Link to comment
Share on other sites

  • 3 weeks later...

Messed around with the mod today and I think I discovered the issue or, at least, had an insight about the proccess behind the scenes.

The problem is, since the script calls for the "spellout" event at the end, of course the game will play the animation. What boggled me is the fact that other mods using the same method and almost the same scripts didn't seem to call the animation, since the animation never played.

Apparently, all come down to the duration of the magic effect. If the set duration is long enough (let's say 5 seconds), the spellout event will be shown in game. If not, then the magic effect will finish mid animation (the first one we call in the script) and the other, the spellout, won't have enough time to be played, but the benefitial effects are still applied, that is, the character does not get stuck in the charge animation.

Not all animations should be used in the same duration, though, because some animations are longer than others. It requires some fine tuning, but I think 3 seconds is a good enough number for most cases.

So, that's it! I hope my little problem and solution may help someone who might need in the future.

P.S: I tested this hypothesis with another animation for another artifact and yeah, it really seems to be the case. Both animations are playing nicely, with no ugly spellout animation letting my character stuck. Success!

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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