Jump to content

[LE] Script wont compile


GSGlobe

Recommended Posts

Ah! Yes, now this make sense, thanks a bundle for this. I didnt think for a moment about using a quest nor did I think about magiceffect getting a new instance, tunnelsight is that a saying?

 

Thanks a lot for your help! I suppose performance wise its good?

 

Best regards

 

There won't be noticeable performance hits unless your system is already heavily overloaded (and if it is, this won't be the thing that's causing it).

Link to comment
Share on other sites

Instead of quest with associated script you could use a single GlobalVariable as counter to casr the spell.

 

use a formlist

Scriptname Auto_Release_Combination_Script extends ActiveMagicEffect  

  GlobalVariable PROPERTY gvCounter auto        ; Auto_Combination_Counter
  FormList       PROPERTY myList    auto        ; Auto_Combination_FormList


; -- EVENT --

EVENT OnEffectStart(Actor akTarget, Actor akCaster)
IF (akTarget == Game.GetPlayer())
ELSE
    self.Dispel()
    RETURN    ; - STOP -    spell target is not the player
ENDIF
;---------------------
    myF_Action(akTarget)
ENDEVENT

; -- FUNCTION --

;----------------------------------
FUNCTION myF_Action(Actor akTarget)
;----------------------------------
    int i = gvCounter.GetValueInt()              ; get the current value of this globalVar
    spell sp

    IF (i < myList.GetSize())
        sp = myList.GetAt(i) as Spell
        i = i + 1                                ; update local Integer Variable
    ELSE
        sp = myList.GetAt(0) as Spell
        i = 0                                    ; max has been reached rotate back to zero
    ENDIF

    IF ( sp )
        gvCounter.SetValue(i as Float)           ; update globalVar
        sp.Cast(akTarget as ObjectReference)     ; cast the spell
;    ELSE
;        Debug.Trace("ComboMGEF: Index = " +i+ " does not contain a valid spell within formlist.")
    ENDIF
ENDFUNCTION

 

 

use an array

Scriptname Auto_Release_Combination_Script extends ActiveMagicEffect  

  GlobalVariable PROPERTY gvCounter auto        ; Auto_Combination_Counter
  Spell[]        PROPERTY myList    auto        ; prefill in CK with your created spells, take the order you like to have


; -- EVENT --

EVENT OnEffectStart(Actor akTarget, Actor akCaster)
IF (akTarget == Game.GetPlayer())
ELSE
    self.Dispel()
    RETURN    ; - STOP -    spell target is not the player
ENDIF
;---------------------
    myF_Action(akTarget)
ENDEVENT

; -- FUNCTION --

;----------------------------------
FUNCTION myF_Action(Actor akTarget)
;----------------------------------
    int i = gvCounter.GetValueInt()              ; get the current value of this globalVar
    spell sp

    IF (i < myList.Length)
        sp = myList[i]
        i = i + 1                                ; update local Integer Variable
    ELSE
        sp = myList[0]
        i = 0                                    ; max has been reached rotate back to zero
    ENDIF

    IF ( sp )
        gvCounter.SetValue(i as Float)           ; update globalVar
        sp.Cast(akTarget as ObjectReference)     ; cast the spell
;    ELSE
;        Debug.Trace("ComboMGEF: Index = "+i+" does not contain a valid spell within array.")
    ENDIF
ENDFUNCTION

Edited by ReDragon2013
Link to comment
Share on other sites

  • Recently Browsing   0 members

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