Jump to content

Scripting question regarding Reanimate animation


ulukinatme

Recommended Posts

I'm looking for some feedback or direction regarding a spell I'm creating. I'm working on making my own Resurrection spell. I have the basic functionality started and it seems to work fine. I can select a dead target, cast the spell, and they'll come back to life. I'm looking to spice it up a bit though. I've already added a couple explosions as part of the spell to make it look cool. What I'd really like to be able to do is use the Reanimate animation as part of the spell. Basically I want the corpse to be raised like a rag doll from the ground before it comes back to life. I'm learning my way around spell creation currently and the scripting engine, but still pretty new to it. I've looked through a number of other scripts and I've looked at the Reanimate spells themselves, but I haven't figured out how I can call or implement this animation yet. Any ideas?
Link to comment
Share on other sites

Hmmm. I tried implementing the playidle using the "IdleNocturnal_Rise" animation, as I figured it would be a good place to start from. It doesn't seem to want to fire for me though. I've also tried using the SendAnimationEvent function, no go. Will they not work on a dead actor?

 

idle property IdleNocturnal_Rise auto

Target.playidle(IdleNocturnal_Rise)

 

Debug.SendAnimationEvent(Target, "IdleNocturnal_Rise")

Link to comment
Share on other sites

Yes, the Target is the object reference to the actor I'm resurrecting. Trying to post the plugin now, we'll see how this goes:

 

http://www.2shared.com/file/3KipmdRY/Resurrection.html

 

The script should just be "resurrection," and the Magic Effect should be the same name.

 

If you just want to look at the script, I'll post it below. I started by using the AshPile script, so it looks very similar to that.

 

Scriptname resurrection extends activemagiceffect  


import debug
import FormList




;======================================================================================;
;  PROPERTIES  /
;=============/

float property fDelay = 4.05 auto
								{time to wait before Spawning Ash Pile}
float property fDelayEnd = 1.65 auto
								{time to wait before Removing Base Actor}
float property ShaderDuration = 0.00 auto
								{Duration of Effect Shader.}
Activator property AshPileObject auto
								{The object we use as a pile.}
EffectShader property MagicEffectShader auto
								{The Effect Shader we want.}
Bool property bSetAlphaZero = True auto
								{The Effect Shader we want.}
FormList Property ImmunityList auto
								{If the target is in this list, they will not be disintegrated.}
Bool property bSetAlphaToZeroEarly = False Auto
								{Use this if we want to set the acro to invisible somewhere before the effect shader is done.}
Keyword Property ActorTypeDaedra  Auto  

Keyword Property ActorTypeFamiliar  Auto  

bool Property AshPileCreated  Auto  


;======================================================================================;
;  VARIABLES   /
;=============/


actor Victim
race VictimRace
bool TargetIsImmune = False

Spell property Reanimate auto
objectReference property myTarget auto
explosion property FXDragonPriestLargeExplosion auto
explosion property CWCatapultExp auto
explosion property MG07LightBeamImpactResurrect auto
explosion property FXAlduinTimeWarpExplosion auto
idle property IdleNocturnal_Rise auto



;=============
;   FUNCTIONS /
;=============

bool function IsSummoned()
if Victim.HasKeyword(ActorTypeFamiliar) || Victim.HasKeyword(ActorTypeDaedra)
	return true
; ;		debug.trace("ReanimateAshPile: IsSummoned True")
else
	return false
; ;		debug.trace("ReanimateAshPile: IsSummoned False")
endIf
endFunction



;======================================================================================;
;   EVENTS     /
;=============/



Event OnEffectStart(Actor Target, Actor Caster)
victim = target
; 	debug.trace("ReanimateAshpile: victim == " + victim + ", is this right?")

if IsSummoned() == False
	TargetIsImmune = False
	Target.placeAtMe(FXDragonPriestLargeExplosion)		;Dirt/Dust animation
	Target.placeAtMe(MG07LightBeamImpactResurrect)		;Lightning Ball animation
		
	utility.wait(fDelay) 		;Long delay before fiery explosion and resurrection
		
	Target.placeAtMe(CWCatapultExp)		;Large Fiery Explosion animation
	Target.placeAtMe(FXAlduinTimeWarpExplosion)		;Alduin Time Warp Animation for effect

	utility.wait(fDelayEnd)		;Short delay while fire subsides

	;Target.playidle(IdleNocturnal_Rise)
	Debug.SendAnimationEvent(Target, "IdleNocturnal_Rise")
	Target.resurrect()
else
	
endIf

EndEvent


Event OnDying(Actor Killer)

;Leftover function from previous script

EndEvent

Event OnEffectFinish(Actor Target, Actor Caster)

;Leftover function from previous script

EndEvent

Link to comment
Share on other sites

Been testing the script. Something is causing the idle to fail on target actor.

 

I havent been able to nail it. What I tried was setting up a quest\scene\AIpackage\alias then fill the alias with the magiceffect target. When the alias is filled with the resurrect target > use the quest scene to force the effect target into an AI package that plays idles. But I was having trouble forcing the quest alias to fill with any actor with a script. It looks like theres 101 things that can cause playidle() to not work on a actor such as being busy with an ai package or scene among other things. Im sure its possible, just someone who knows more about magic effects and aliases needs to chime in :)

Link to comment
Share on other sites

This stuff is much more complicated than a simple event or idle call. I've spent many hours trying to deciphering it for FNIS. Without the kind of success I needed.

 

You might know that AnimEvents are defined in the behavior files, most idles like this in mt_behavior.hkx.

 

The Nocturnal Idles are furniture idles. Furniture Idles form complex behavior constructs, usually consisting of enter, one or more loop , and an exit animations. Furniture Idles are connected to a furniture object, in this case "NocturalMarker". And they are called by a sit or similar package, NocturnalDefaultStart. I'm not sure if you can make furniture idles work with PlayIdle() or SendAnimevent(), because they need to find these furniture markers, and neither those calls, nor the behavior definitions provide this kind of information.

 

Now for the "IdleNocturnal_Rise" you found there is something special I haven't seen for other furniture animations yet. It's in TG09NocturnalRisesPackage, a "StayAtCurrentLocation" package. This package loopks like it is running independant of any (Nocturnal) furniture marker. Although this can't be, because the IdleNocturnal_Rise behavior definition is embedded into the other Nocturnal (furniture) Idles. And usually you cannot run 2 packages at the same time.

 

But you might test with this package definition. Maybe I'm wrong. Again.

Link to comment
Share on other sites

Thanks for looking into it, scrivener07, and everyone. Lots of interesting info here. Before we go any farther I should clarify that I'm not 100% set on using the Nocturnal enter animation, it was just one of the possibilities I could use to "raise" the body as part of the Resurrection spell script.

 

Just a bit ago I was playing with the DeadThrall spell. I think I can find a way to utilize it's animation to raise the body, then add my resurrection script to the spell to perform the target.resurrect() command. My only concern is that the NPC is still showing as my Thrall after the resurrect() function is run on the target, despite the NPC returning to normal once you leave the cell and return. I'm going to play around with it some more, I'll update the script here once it's smoothed out a bit.

Link to comment
Share on other sites

It's maybe more overhead than you want to have, but with FNIS you can define new idles based on every animation you like.

 

So you can even use one of the animations nocturnalrisingpool_idle0<n>.hkx (NOT the AnimEvent), assign this to a new AnimEvent, and call it with either playidle() or SendAnimEvent().

Link to comment
Share on other sites

  • Recently Browsing   0 members

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