Jump to content

Help with Script counting use on actor


silhouett

Recommended Posts

I have the following script but do not seem to get the essential part working as I want it to... I want essentials to only be destroyed if they are dead bodies and after 3 times of being hit by this enchantment but am not sure how to do the counting

 

Here is what I have so far ...

 

 

Scriptname ZZTransportawayvictim extends ActiveMagicEffect

{Scripted effect for Destroyed}

 

import debug

import FormList

 

;======================================================================================;

; PROPERTIES /

;=============/

 

float property fDelay = 0.75 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 = true 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 HaveBeenDestroyed Auto

;======================================================================================;

; VARIABLES /

;=============/

 

 

actor Victim

bool TargetIsImmune = True

 

;=============

; FUNCTIONS /

;=============

 

 

 

bool function Destroythem()

 

 

;debug.trace("The Victim just died")

victim.SetCriticalStage(Victim.CritStage_DisintegrateStart)

victim.SetAlpha (0.99,False)

if MagicEffectShader != none

MagicEffectShader.play(Victim,ShaderDuration)

endif

if bSetAlphaToZeroEarly

;victim.SetAlpha (0.0,True)

endif

utility.wait(fDelay)

;Destroy code goes here...

;Destroy code goes here...

;Destroy code goes here...

Destroy regular people... Essentials after 3 shots

 

utility.wait(fDelayEnd)

if MagicEffectShader != none

MagicEffectShader.stop(Victim)

endif

if bSetAlphaZero == True

victim.SetAlpha (0.0,True)

endif

victim.SetCriticalStage(Victim.CritStage_DisintegrateEnd)

 

 

 

 

endFunction

 

;======================================================================================;

; EVENTS /

;=============/

 

Event OnEffectStart(Actor Target, Actor Caster)

victim = target

 

 

 

; debug.trace(Destroy: victim == " + victim + ", is this right?")

 

TargetIsImmune = True

 

 

 

if victim.GetLeveledActorBase().IsProtected() == False || victim.isessential() == False

; debug.trace(Destroy: victim == " + victim + ", is this protected!")

TargetIsImmune = False

 

endif

 

if Victim.IsCommandedActor() == True || Victim.isdead() == True

TargetIsImmune = False

 

endIf

 

EndEvent

 

 

Event OnDying(Actor Killer)

 

 

;debug.trace("Destroy Target Is Immune:" + TargetIsImmune)

 

if TargetIsImmune == False && HaveBeenDestroyed == False

Destroythem()

 

HaveBeenDestroyed = True

endif

 

EndEvent

 

Event OnEffectFinish(Actor Target, Actor Caster)

 

 

 

if TargetIsImmune == False && HaveBeenDestroyed == False

Destroythem()

 

HaveBeenDestroyed = True

endif

 

EndEvent

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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