Jump to content

How to add timer to spell?


Recommended Posts

So I'm making a spell, an enchantment specifically, for a staff that summons 3 of a creature.
I've done this successfully by duplicating the script for the Werewolf Wolf Howl power that summons 3 wolves.
However, when using the staff again one of the three creatures will die and the other 2 will remain, and the staff will summon the new three. Making 5.

This is obviously because the script I duplicated keeps the two other creatures permanent.
So I need to either make the spell on the staff have a timer so that they all die after a designated amount of time, or something like that.
Does anyone have a solution?

Link to comment
Share on other sites

this Wolf ActorBase Scripts that clean it UP

Scriptname HowlSummonWolfFXSSCRIPT extends ACTOR  

EFFECTSHADER PROPERTY ghostEffect AUTO
FLOAT PROPERTY ghostAlpha=0.1 AUTO

BOOL bFlash=FALSE

EVENT onLOAD()

	ghostEffect.play(SELF)
	SELF.SetAlpha(0.3)
	
	registerForAnimationEvent(SELF, "bowDraw")
	registerForAnimationEvent(SELF, "weaponSwing")
	registerForAnimationEvent(SELF, "arrowRelease")
	
	RegisterForSingleUpdate(60)

ENDEVENT

EVENT OnUpdate()
	TurnOff()
ENDEVENT

EVENT onHIT(OBJECTREFERENCE akAggressor, FORM akSource, Projectile akProjectile, BOOL abPowerAttack, BOOL abSneakAttack, BOOL abBashAttack, BOOL abHitBlocked)
	ghostFlash()
	

ENDEVENT

EVENT OnAnimationEvent(ObjectReference akSource, string EventName)
		ghostFlash()
		
ENDEVENT

EVENT onDYING(ACTOR killer)
	TurnOff()		
ENDEVENT

Function TurnOff()
	; SELF.setAlpha(0.3)
	UnregisterForUpdate()
	ghostEffect.stop(SELF)
	disable(true)
EndFunction

; //play this to flash the ghost when hit or attacking
FUNCTION ghostFlash()

	IF(!bFlash)
	
		bFlash = TRUE
	
		SELF.setAlpha(0.5, TRUE)
	
		utility.wait(1)
		
		SELF.setAlpha(0.3)
		
		bFlash = FALSE
	ENDIF
	
ENDFUNCTION

If you require my help modifying it I glad to so.

Link to comment
Share on other sites

Have I redeemed myself? And Yeah I didn't mean to offend. Since I followed my own advice that I gave to you, only I use the wolves.

 

Edit

 

they will need to be compiled of course

 

Attach to Magic Effect

 

 

Scriptname Semprus_SummonCreatureSCRIPT extends ActiveMagicEffect  

ACTORBASE PROPERTY CreatureToSummon AUTO ; fill with, you know the drill


INT PROPERTY numToPlace AUTO   ; fill with 1, 2 or 3 

OBJECTREFERENCE Creature1
OBJECTREFERENCE Creature2
OBJECTREFERENCE Creature3

EVENT onEffectStart(Actor akTarget, Actor akCaster)

        
    IF(numToPlace == 1)
        Creature1 = game.getPlayer().placeAtMe(CreatureToSummon)
    
    ELSEIF(numToPlace == 2)
        Creature1 = game.getPlayer().placeAtMe(CreatureToSummon)
        Creature2 = game.getPlayer().placeAtMe(CreatureToSummon)
    
    ELSEIF(numToPlace == 3)
        Creature1 = game.getPlayer().placeAtMe(CreatureToSummon)
        Creature2 = game.getPlayer().placeAtMe(CreatureToSummon)
        Creature3 = game.getPlayer().placeAtMe(CreatureToSummon)
    
    ENDIF
    

endEVENT

EVENT onEffectFinish(Actor akTarget, Actor akCaster)

    (Creature1 as Semprus_SummonCreatureFXSCRIPT).TurnOff()
    (Creature2 as Semprus_SummonCreatureFXSCRIPT).TurnOff()
    (Creature3 as Semprus_SummonCreatureFXSCRIPT).TurnOff()
    
endEVENT



 

 

 

 

Attach to the ACTORBASE being summon

 

 

Scriptname Semprus_SummonCreatureFXSCRIPT Extends ACTOR  

EFFECTSHADER PROPERTY GhostShaderFX AUTO ; pick a shader
FLOAT PROPERTY ghostAlpha=0.1 AUTO       ; alpha ~ transparency I use 0.3 for my stuff play with it.

BOOL bFlash=FALSE

EVENT onLOAD()

    GhostShaderFX.play(SELF)
    SELF.SetAlpha(0.3)
    
    registerForAnimationEvent(SELF, "bowDraw")
    registerForAnimationEvent(SELF, "weaponSwing")
    registerForAnimationEvent(SELF, "arrowRelease")
    
    RegisterForSingleUpdate(60)

ENDEVENT

EVENT OnUpdate()
    TurnOff()
ENDEVENT

EVENT onHIT(OBJECTREFERENCE akAggressor, FORM akSource, Projectile akProjectile, BOOL abPowerAttack, BOOL abSneakAttack, BOOL abBashAttack, BOOL abHitBlocked)
    ghostFlash()
    

ENDEVENT

EVENT OnAnimationEvent(ObjectReference akSource, string EventName)
        ghostFlash()
        
ENDEVENT

EVENT onDYING(ACTOR killer)
    TurnOff()        
ENDEVENT

Function TurnOff()
    ; SELF.setAlpha(0.3)
    UnregisterForUpdate()
    GhostShaderFX.stop(SELF)
    disable(true)
EndFunction

; //play this to flash the ghost when hit or attacking
FUNCTION ghostFlash()

    IF(!bFlash)
    
        bFlash = TRUE
    
        SELF.setAlpha(0.5, TRUE)
    
        utility.wait(1)
        
        SELF.setAlpha(0.3)
        
        bFlash = FALSE
    ENDIF
    
ENDFUNCTION

 

 

 

They will need to be compiled of course, && I know nothing about you Alpha Values requirements, but unfortunately I am done, I have solve your problem. This time around. LOL.

 

Yeah but I did that for every post first time, I would have no life.

Edited by PeterMartyr
Link to comment
Share on other sites

  • Recently Browsing   0 members

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