Jump to content

[LE] Is it possible to track if the player just used a specific soul gem?


JustChill

Recommended Posts

Hey there,

 

I currently want to mod some sort of "Azura's Star" for Enderal (Total Conversion of Skyrim).

Yet as Enderal uses a scripted soul trap spell to avoid the well-known bug of soul gems loosing their filling I actually wanted to continue on that.

 

Furthermore, if I use the keyword "ReusableSoulgem" on a filled Azura's Star and try to recharge an enchanted weapon, the game crashes.

Yet it works, when I use an unfilled Azura's Star but I don't like that you can loose the fill level of the gem, when you drop the item.

 

 

Furthermore I would like that the soul gem can hold creature AND NPC souls.

Which actually works very well by having a script that simply removes the empty Azura's Star and adds a filled one, with the proper level.

 

Yet... If I use that one, it surely disappears as I cannot use the keyword as I don't want the game to crash. ^^

 

 

Is there any other possibility to check if the player uses a specific soul gem?

 

That's my current script for the magic effect Soul Trap.

 

 

ScriptName magicSoulTrapFXScript extends ActiveMagicEffect

{Scripted effect for the Soul Trap Visual FX}



import debug





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

;  PROPERTIES  /

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

ImageSpaceModifier property TrapImod auto

{IsMod applied when we trap a soul}

sound property TrapSoundFX auto ; create a sound property we'll point to in the editor'

{Sound played when we trap a soul}

VisualEffect property TargetVFX auto

{Visual Effect on Target aiming at Caster}

VisualEffect property CasterVFX auto

{Visual Effect on Caster aming at Target}

EffectShader property CasterFXS auto

{Effect Shader on Caster during Soul trap}

EffectShader property TargetFXS auto

{Effect Shader on Target during Soul trap}

bool property bIsEnchantmentEffect = false auto

{Set this to true if this soul trap is on a weapon enchantment or a spell that can do damage to deal with a fringe case}



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

;  VARIABLES   /

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

; objectreference playerref

bool DeadAlready = FALSE

bool bUseWait = True

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

;  EVENTS      /

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





;Declaring soul gem levels:





Event OnEffectStart(Actor akTarget, Actor akCaster)

    victim = akTarget

    caster = akCaster

    

    

    if(victim.HasKeyword(ActorTypeNPC))

        victimIsNPC = true

    endif

 

 

    if bIsEnchantmentEffect == False

        DeadAlready = Victim.IsDead()

    endif

    

    Countdown()

EndEvent





Event OnEffectFinish(Actor akTarget, Actor akCaster)

    Await()

    if victim

    

        ; initiate lock to prevent multiple soul traps from processing at the same time:

        if(SoulTrapController != None)

            while(!SoulTrapController.SecurePermission(caster))

                Utility.Wait(0.1)

            endWhile

        endif

        

        

        if(!deadAlready && victim.IsDead() && victim.GetActorValue("PerceptionCondition") != 0)

            bool soulTrapped = false

            String soulType = "None"



            if numSiraFillCounter == 50 && Caster.GetItemCount(_00E_YerosCave_SiraSoulbender)

                numSiraFillCounter = 0

                Caster.RemoveItem(_00E_YerosCave_SiraSoulbender, 1, true)

                Caster.AddItem(_00E_WishWell_FrostcliffTavern_BrokenSoulgem, 1)

            endif



            ;if victim is not a humanoid, remove Black Soul Gems from inventory before trap begins:

            if(!victimIsNPC)

                

                ;numBlack = caster.GetItemCount(SoulGemBlack)

                ;caster.RemoveItem(SoulGemBlack, numBlack, true)

                

                numPetty = caster.GetItemCount(SoulGemPetty)

                numLesser = caster.GetItemCount(SoulGemLesser)

                numCommon = caster.GetItemCount(SoulGemCommon)

                numGreater = caster.GetItemCount(SoulGemGreater)

                numGrand = caster.GetItemCount(SoulGemGrand)

        

                int targetLevel = victim.GetLevel()

                if(targetLevel < Game.GetGameSettingInt("iLesserSoulActorLevel")) ;soul is petty

                    soulType="Petty"

                    if(numPetty > 0)

                        caster.RemoveItem(SoulGemPetty, 1, true)

                        caster.AddItem(SoulGemPettyFilled, 1, true)

                        soulTrapped = true

                    elseif (numLesser > 0)

                        caster.RemoveItem(SoulGemLesser, 1, true)

                        caster.AddItem(_00E_SoulGemLesserFilledPetty, 1, true)

                        soulTrapped = true

                    elseif(numCommon > 0)

                        caster.RemoveItem(SoulGemCommon, 1, true)

                        caster.AddItem(_00E_SoulGemCommonFilledPetty, 1, true)

                        soulTrapped = true

                    elseif(numGreater > 0)

                        caster.RemoveItem(SoulGemGreater, 1, true)

                        caster.AddItem(_00E_SoulGemGreaterFilledPetty, 1, true)

                        soulTrapped = true

                    elseif(numGrand > 0)

                        caster.RemoveItem(SoulGemGrand, 1, true)

                        caster.AddItem(_00E_SoulGemGrandFilledPetty, 1, true)

                        soulTrapped = true

                    elseif(caster.GetItemCount(_00E_YerosCave_SiraSoulbender))

                        caster.RemoveItem(_00E_YerosCave_SiraSoulbender, 1, true)

                        caster.AddItem(_00E_YerosCave_SiraSoulbender_FillPetty, 1, true)

                        soulTrapped = true

                        numSiraFillCounter += 1

                    endif

                    

                elseif(targetLevel < Game.GetGameSettingInt("iCommonSoulActorLevel"));soul is lesser

                    soulType="Lesser"

                    if(numLesser > 0)

                        caster.RemoveItem(SoulGemLesser, 1, true)

                        caster.AddItem(SoulGemLesserFilled, 1, true)

                        soulTrapped = true

                    elseif (numCommon > 0)

                        caster.RemoveItem(SoulGemCommon, 1, true)

                        caster.AddItem(_00E_SoulGemCommonFilledLesser, 1, true)

                        soulTrapped = true

                    elseif(numGreater > 0)

                        caster.RemoveItem(SoulGemGreater, 1, true)

                        caster.AddItem(_00E_SoulGemGreaterFilledLesser, 1, true)

                        soulTrapped = true

                    elseif(numGrand > 0)

                        caster.RemoveItem(SoulGemGrand, 1, true)

                        caster.AddItem(_00E_SoulGemGrandFilledLesser, 1, true)

                        soulTrapped = true

                    elseif(caster.GetItemCount(_00E_YerosCave_SiraSoulbender))

                        caster.RemoveItem(_00E_YerosCave_SiraSoulbender, 1, true)

                        caster.AddItem(_00E_YerosCave_SiraSoulbender_FillLess, 1, true)

                        soulTrapped = true

                        numSiraFillCounter += 1

                    endif

                    

                elseif(targetLevel < Game.GetGameSettingInt("iGreaterSoulActorLevel")) ;soul is common

                    soulType="Common"

                    if(numCommon > 0)

                        caster.RemoveItem(SoulGemCommon, 1, true)

                        caster.AddItem(SoulGemCommonFilled, 1, true)

                        soulTrapped = true

                    elseif(numGreater > 0)

                        caster.RemoveItem(SoulGemGreater, 1, true)

                        caster.AddItem(_00E_SoulGemGreaterFilledCommon, 1, true)

                        soulTrapped = true

                    elseif(numGrand > 0)

                        caster.RemoveItem(SoulGemGrand, 1, true)

                        caster.AddItem(_00E_SoulGemGrandFilledCommon, 1, true)

                        soulTrapped = true

                    elseif(caster.GetItemCount(_00E_YerosCave_SiraSoulbender))

                        caster.RemoveItem(_00E_YerosCave_SiraSoulbender, 1, true)

                        caster.AddItem(_00E_YerosCave_SiraSoulbender_FillCom, 1, true)

                        soulTrapped = true

                        numSiraFillCounter += 1

                    endif

                    

                elseif(targetLevel < Game.GetGameSettingInt("iGrandSoulActorLevel")) ;soul is greater

                    soulType="Greater"

                    if(numGreater > 0)

                        caster.RemoveItem(SoulGemGreater, 1, true)

                        caster.AddItem(SoulGemGreaterFilled, 1, true)

                        soulTrapped = true

                    elseif(numGrand > 0)

                        caster.RemoveItem(SoulGemGrand, 1, true)

                        caster.AddItem(_00E_SoulGemGrandFilledGreater, 1, true)

                        soulTrapped = true

                    elseif(caster.GetItemCount(_00E_YerosCave_SiraSoulbender))

                        caster.RemoveItem(_00E_YerosCave_SiraSoulbender, 1, true)

                        caster.AddItem(_00E_YerosCave_SiraSoulbender_FillGreat, 1, true)

                        soulTrapped = true

                        numSiraFillCounter += 1

                    endif

                    

                else

                    soulType="Grand"

                    if(numGrand > 0)

                        caster.RemoveItem(SoulGemGrand, 1, true)

                        caster.AddItem(SoulGemGrandFilled, 1, true)

                        soulTrapped = true

                    elseif(caster.GetItemCount(_00E_YerosCave_SiraSoulbender))

                        caster.RemoveItem(_00E_YerosCave_SiraSoulbender, 1, true)

                        caster.AddItem(_00E_YerosCave_SiraSoulbender_FillGrand, 1, true)

                        soulTrapped = true

                        numSiraFillCounter += 1

                    endif

                endif

            

        

        

        

            ; return Black Soul Gems:

            ;caster.AddItem(SoulGemBlack, numBlack, true)

            else

                numBlack = caster.GetItemCount(SoulGemBlack)

                if(numBlack > 0)

                    caster.RemoveItem(SoulGemBlack, 1, true)

                    caster.AddItem(SoulGemBlackFilled, 1, true)

                    soulTrapped = true

                elseif(caster.GetItemCount(_00E_YerosCave_SiraSoulbender))

                    caster.RemoveItem(_00E_YerosCave_SiraSoulbender, 1, true)

                    caster.AddItem(_00E_YerosCave_SiraSoulbender_FillGrand, 1, true)

                    soulTrapped = true

                    numSiraFillCounter += 1

                endif

            endif

        

            ; begin vanilla Soul Trap FX finale:

            if(soulTrapped == true)

                victim.SetActorValue("PerceptionCondition", 0)

                PlayEffects(caster, victim)

                if soulType=="Petty"

                    Debug.Notification(_00E_SoulPetty.GetName()+" "+_00E_SuccessfulTrapping.GetName())

                    SoulsCaught.SetValueInt(SoulsCaught.GetValueInt()+1)

                elseif soulType=="Lesser"

                    Debug.Notification(_00E_SoulLesser.GetName()+" "+_00E_SuccessfulTrapping.GetName())

                    SoulsCaught.SetValueInt(SoulsCaught.GetValueInt()+1)

                elseif soulType=="Common"

                    Debug.Notification(_00E_SoulCommon.GetName()+" "+_00E_SuccessfulTrapping.GetName())

                    SoulsCaught.SetValueInt(SoulsCaught.GetValueInt()+1)

                elseif soulType =="Greater"

                    Debug.Notification(_00E_SoulGreater.GetName()+" "+_00E_SuccessfulTrapping.GetName())

                    SoulsCaught.SetValueInt(SoulsCaught.GetValueInt()+1)

                elseif soulType =="Grand"

                    Debug.Notification(_00E_SoulGrand.GetName()+" "+_00E_SuccessfulTrapping.GetName())

                    SoulsCaught.SetValueInt(SoulsCaught.GetValueInt()+1)

                else

                    _00E_SoulHuman.show()

                endif

            elseif (!victimIsNPC)

                _00E_FailedTrapping.Show()

                

            

            endif

        endif

        

        ; release lock

        SoulTrapController.ReleasePermission(caster)

    endif

endEvent







;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Functions;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



Function PlayEffects(Actor akCaster, Actor akVictim)

  TrapSoundFX.Play(akCaster)              ; Play TrapSoundFX sound from player

  TrapImod.Apply()                        ; Apply isMod at full strength

 

  TargetVFX.Play(akVictim, 4.7, akCaster) ; Play TargetVFX and aim them at the player

  CasterVFX.Play(akCaster, 5.9, akVictim)

 

  TargetFXS.Play(akVictim, 2)             ; Play effect shaders

  CasterFXS.Play(akCaster, 3)

EndFunction



Function Countdown()

  latch -= 1

EndFunction



Function Await(int count = 0)

  while(latch > count)

    Utility.Wait(0.1)

  endwhile

EndFunction





;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Properties + Variables;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



bool victimIsNPC



GlobalVariable Property SoulsCaught Auto



Actor caster

Actor victim



int latch = 1

int numPetty

int numLesser

int numCommon

int numGreater

int numGrand

int numBlack

int numSiraFillCounter



_00E_SoulTrapController Property SoulTrapController Auto





Message Property _00E_FailedTrapping Auto

Message Property _00E_SuccessfulTrapping Auto



Message Property _00E_SoulPetty Auto

Message Property _00E_SoulLesser Auto

Message Property _00E_SoulCommon Auto

Message Property _00E_SoulGreater Auto

Message Property _00E_SoulGrand Auto

Message Property _00E_SoulHuman Auto



Actor Property PlayerREF Auto



Keyword Property ActorTypeNPC Auto



SoulGem Property SoulGemPetty Auto

SoulGem Property SoulGemPettyFilled Auto



SoulGem Property SoulGemLesser Auto

SoulGem Property SoulGemLesserFilled Auto

SoulGem Property _00E_SoulGemLesserFilledPetty Auto



SoulGem Property SoulGemCommon Auto

SoulGem Property SoulGemCommonFilled Auto

SoulGem Property _00E_SoulGemCommonFilledPetty Auto

SoulGem Property _00E_SoulGemCommonFilledLesser Auto



SoulGem Property SoulGemGreater Auto

SoulGem Property SoulGemGreaterFilled Auto

SoulGem Property _00E_SoulGemGreaterFilledPetty Auto

SoulGem Property _00E_SoulGemGreaterFilledLesser Auto

SoulGem Property _00E_SoulGemGreaterFilledCommon Auto



SoulGem Property SoulGemGrand Auto

SoulGem Property SoulGemGrandFilled Auto

SoulGem Property _00E_SoulGemGrandFilledPetty Auto

SoulGem Property _00E_SoulGemGrandFilledLesser Auto

SoulGem Property _00E_SoulGemGrandFilledCommon Auto

SoulGem Property _00E_SoulGemGrandFilledGreater Auto



SoulGem Property SoulGemBlack Auto

SoulGem Property SoulGemBlackFilled Auto



SoulGem Property _00E_YerosCave_SiraSoulbender  Auto  

SoulGem Property _00E_YerosCave_SiraSoulbender_FillPetty  Auto  

SoulGem Property _00E_YerosCave_SiraSoulbender_FillLess  Auto

SoulGem Property _00E_YerosCave_SiraSoulbender_FillCom  Auto  

SoulGem Property _00E_YerosCave_SiraSoulbender_FillGreat  Auto  

SoulGem Property _00E_YerosCave_SiraSoulbender_FillGrand  Auto



MiscObject Property _00E_WishWell_FrostcliffTavern_BrokenSoulgem Auto

 

 

 

 

It perfectly avoids that bug of the regular soul trap effect, where you loose your filling of the gem, when you drop it.

 

 

Yet... "SiraSoulbender" is that Azura's Star clone but simply get's removed either, when used like a regular soul gem.

 

And by using an unfilled Soulbender with the "ReusableSoulgem" keyword to make it not disappear after usage, the issue with the lost filling and not being able to attach NPC souls is present.

 

 

 

 

So basically it sounds easy. I just want the game to know when I used any type of Soulbender to recharge a weapon and give it then back to the player.

But as you cannot attach a script to a soul gem I am a bit clueless. :sad:

 

 

I appreciate any help. :smile:

 

Thank you and kindest regards.

Link to comment
Share on other sites

  • Replies 61
  • Created
  • Last Reply

Top Posters In This Topic

Your script is an ActiveMagicEffectScript, that means every time the spell is casted the effect may stack. But the scriptVariables and properties do not have access to each instance of this magic effect.

For example:

            if numSiraFillCounter == 50 && Caster.GetItemCount(_00E_YerosCave_SiraSoulbender)
                numSiraFillCounter = 0
                Caster.RemoveItem(_00E_YerosCave_SiraSoulbender, 1, true)
                Caster.AddItem(_00E_WishWell_FrostcliffTavern_BrokenSoulgem, 1)
            endif

numSiraFillCounter will never be 50, because each effect has its own finish event.. You have to use a GlobalVariable for counting of this special case.

 

(1) your script is using a SKSE function

; GetName() is SKSE exclusive

(2) you should use an array or formlist to shrink the amount of script properties for "Soulgem"

 

(3) your script is looking for external controller script.. hmm.. not so good!? Use a special (own created) keyword to prevent multiple soultraps on actors!

_00E_SoulTrapController PROPERTY SoulTrapController auto    ; pointer to external script "_00E_SoulTrapController.pex"

jucmagicSoulTrapFXScript

 

Scriptname jucmagicSoulTrapFXScript extends ActiveMagicEffect
{Scripted effect for the Soul Trap Visual FX}
; https://forums.nexusmods.com/index.php?/topic/8360833-is-it-possible-to-track-if-the-player-just-used-a-specific-soul-gem/

  GlobalVariable          PROPERTY SoulsCaught        auto
  _00E_SoulTrapController PROPERTY SoulTrapController auto    ; pointer to external script "_00E_SoulTrapController.pex"

  Message Property _00E_Failed      auto      ; _00E_FailedTrapping
  Message Property _00E_Success     auto      ; _00E_SuccessfulTrapping
  Message Property _00E_SoulPetty   auto
  Message Property _00E_SoulLesser  auto
  Message Property _00E_SoulCommon  auto
  Message Property _00E_SoulGreater auto
  Message Property _00E_SoulGrand   auto
  Message Property _00E_SoulHuman   auto

  Sound PROPERTY TrapSoundFX auto             ; played when we trap a soul, create a sound property we'll point to in the editor'

  ImageSpaceModifier PROPERTY TrapImod auto   ; IsMod applied when we trap a soul

  VisualEffect PROPERTY TargetVFX auto        ; {Visual Effect on Target aiming at Caster}
  VisualEffect PROPERTY CasterVFX auto        ; {Visual Effect on Caster aming at Target}

  EffectShader PROPERTY CasterFXS auto        ; {Effect Shader on Caster during Soul trap}
  EffectShader PROPERTY TargetFXS auto        ; {Effect Shader on Target during Soul trap}

  Bool PROPERTY bIsEnchantmentEffect auto     ; [Default=False]
    ; Set TRUE, if this soul trap is on a weapon enchantment or a spell that can do damage to deal with a fringe case

  Bool DeadAlready                            ; [Default=False]
  Bool victimIsNPC
  Int latch = 1

  Actor caster
  Actor victim


; -- EVENTs -- 2

EVENT OnEffectStart(Actor akTarget, Actor akCaster)
    victim = akTarget
    caster = akCaster

    myF_Init(akTarget)
    Countdown()
ENDEVENT


EVENT OnEffectFinish(Actor akTarget, Actor akCaster)
int i = 0
    WHILE (latch > i)
        Utility.Wait(0.1)
    ENDWHILE

    IF (victim) && (caster)
        myF_Finish()
    ENDIF
ENDEVENT


; -- FUNCTIONs -- 6

;--------------------------------
FUNCTION myF_Init(Actor akTarget)
;--------------------------------
    IF akTarget.HasKeyword( Game.GetForm(0x00013794) as Keyword )    ; [KYWD:00013794]  ActorTypeNPC
        victimIsNPC = TRUE
    ENDIF

    IF ( bIsEnchantmentEffect )
        ; do not pre-check for victims death
    ELSE
        DeadAlready = akTarget.IsDead()
    ENDIF
ENDFUNCTION


;-------------------
FUNCTION Countdown()
;-------------------
  latch -= 1
ENDFUNCTION


;-----------------------------------------
Bool FUNCTION myF_IsLevel(Int i, String s)
;-----------------------------------------
    RETURN (i < Game.GetGameSettingInt(s)
ENDFUNCTION


;------------------------------------
FUNCTION myF_CSG(SoulGem sg, Form fm)  ; exchange soulgems
;------------------------------------
    caster.RemoveItem(sg as Form, 1, TRUE)
    caster.AddItem(fm, 1, TRUE)
ENDFUNCTION


  GlobalVariable PROPERTY numSiraFillCounter auto        ; Have to be used a globalVar here !!!

;--------------------
FUNCTION myF_Finish()
;--------------------
 ; initiate lock to prevent multiple soul traps from processing at the same time

    WHILE (SoulTrapController) && !SoulTrapController.SecurePermission(caster)
        Utility.Wait(0.1)
    ENDWHILE

IF (deadAlready) || victim.IsDead() || (victim.GetActorValue("PerceptionCondition") == 0.0)
    IF ( SoulTrapController )
        SoulTrapController.ReleasePermission(caster)    ; release lock
    ENDIF
    RETURN    ; - STOP -
ENDIF
;=====================

    IF caster.GetItemCount(_00E_YerosCave_SiraSoulbender)
        IF (numSiraFillCounter.GetValue() >= 50.0)
            numSiraFillCounter.setValue(0)
            myF_CSG(_00E_YerosCave_SiraSoulbender, _00E_WishWell_FrostcliffTavern_BrokenSoulgem)
        ENDIF
    ENDIF


    bool bOK    ; soulTrapped [default=False]


IF ( victimIsNPC )
    IF     (caster.GetItemCount(SoulGemBlack) > 0)
        bOK = TRUE
        myF_CSG(SoulGemBlack, SoulGemBlackFilled)

    ELSEIF (caster.GetItemCount(_00E_YerosCave_SiraSoulbender) > 0)
        bOK = TRUE
        myF_CSG(_00E_YerosCave_SiraSoulbender, _00E_YerosCave_SiraSoulbender_FillGrand)
        numSiraFillCounter.Mod(1)                            ; increase globalVar threadsafe
    ENDIF

ELSE    ; victim is not a humanoid (remove Black Soul Gems from inventory before trap begins)

    int[] a = new Int[6]
        a[0] = caster.GetItemCount(SoulGemPetty)             ; numPetty
        a[1] = caster.GetItemCount(SoulGemLesser)            ; numLesser
        a[2] = caster.GetItemCount(SoulGemCommon)            ; numCommon
        a[3] = caster.GetItemCount(SoulGemGreater)           ; numGreater
        a[4] = caster.GetItemCount(SoulGemGrand)             ; numGrand
        a[5] = caster.GetItemCount(_00E_YerosCave_SiraSoulbender)

    int iSoulType = 0                                        ; string soulType = "None"
    int i = victim.GetLevel()                                ; targetLevel

    IF myF_IsLevel(i, "iLesserSoulActorLevel")
;--------------------
        iSoulType = 1        ; "petty"

        IF     (a[0] > 0)
            myF_CSG(SoulGemPetty, SoulGemPettyFilled)
            bOK = TRUE

         ELSEIF (a[1] > 0)
            myF_CSG(SoulGemLesser, _00E_SoulGemLesserFilledPetty)
            bOK = TRUE

        ELSEIF (a[2] > 0)
            myF_CSG(SoulGemCommon, _00E_SoulGemCommonFilledPetty)
            bOK = TRUE

        ELSEIF (a[3] > 0)
            myF_CSG(SoulGemGreater, _00E_SoulGemGreaterFilledPetty)
            bOK = TRUE

        ELSEIF (a[4] > 0)
            myF_CSG(SoulGemGrand, _00E_SoulGemGrandFilledPetty)
            bOK = TRUE

        ELSEIF (a[5] > 0)
            myF_CSG(_00E_YerosCave_SiraSoulbender, _00E_YerosCave_SiraSoulbender_FillPetty)
            bOK = TRUE
            numSiraFillCounter.Mod(1)
        ENDIF

    ELSEIF myF_IsLevel(i, "iCommonSoulActorLevel")
;------------------------
        iSoulType = 2        ; "Lesser"

        IF     (a[1] > 0)
            myF_CSG(SoulGemLesser, SoulGemLesserFilled)
            bOK = TRUE
 
        ELSEIF (a[2] > 0)
            myF_CSG(SoulGemCommon, _00E_SoulGemCommonFilledLesser)
            bOK = TRUE

        ELSEIF (a[3] > 0)
            myF_CSG(SoulGemGreater, _00E_SoulGemGreaterFilledLesser)
            bOK = TRUE

        ELSEIF (a[4] > 0)
            myF_CSG(SoulGemGrand, _00E_SoulGemGrandFilledLesser)
            bOK = TRUE
 
        ELSEIF (a[5] > 0)
            myF_CSG(_00E_YerosCave_SiraSoulbender, _00E_YerosCave_SiraSoulbender_FillLess)
            bOK = TRUE
            numSiraFillCounter.Mod(1)
        ENDIF

    ELSEIF myF_IsLevel(i, "iGreaterSoulActorLevel")
;------------------------
        iSoulType = 3        ; "Common"

        IF     (a[2] > 0)
            myF_CSG(SoulGemCommon, SoulGemCommonFilled)
            bOK = TRUE

        ELSEIF (a[3] > 0)
            myF_CSG(SoulGemGreater, _00E_SoulGemGreaterFilledCommon)
            bOK = TRUE

        ELSEIF (a[4] > 0)
            myF_CSG(SoulGemGrand, _00E_SoulGemGrandFilledCommon)
            bOK = TRUE

        ELSEIF (a[5] > 0)
            myF_CSG(_00E_YerosCave_SiraSoulbender, _00E_YerosCave_SiraSoulbender_FillCom)
            bOK = TRUE
            numSiraFillCounter.Mod(1)
        ENDIF

    ELSEIF myF_IsLevel(i, "iGrandSoulActorLevel")
;------------------------
        iSoulType = 4        ; "Greater"

        IF     (a[3] > 0)
            myF_CSG(SoulGemGreater, SoulGemGreaterFilled)
            bOK = TRUE

        ELSEIF (a[4] > 0)
            myF_CSG(SoulGemGrand, _00E_SoulGemGrandFilledGreater)
            bOK = TRUE

        ELSEIF (a[5] > 0)
            myF_CSG(_00E_YerosCave_SiraSoulbender, _00E_YerosCave_SiraSoulbender_FillGreat)
            bOK = TRUE
            numSiraFillCounter.Mod(1)
        ENDIF

    ELSE
;------------------------
        iSoulType = 5        ; "Grand"

        IF     (a[4] > 0)
            myF_CSG(SoulGemGrand, SoulGemGrandFilled)
            bOK = TRUE

        ELSEIF (a[5] > 0)
            myF_CSG(_00E_YerosCave_SiraSoulbender, _00E_YerosCave_SiraSoulbender_FillGrand)
            bOK = TRUE
            numSiraFillCounter.Mod(1)
        ENDIF
    ENDIF
ENDIF

        
; begin vanilla Soul Trap FX finale:

    IF ( bOK )
        victim.SetActorValue("PerceptionCondition", 0.0)
        PlayEffects(caster, victim)
        
        string s = " " + _00E_Success.GetName()            ; _00E_SuccessfulTrapping.GetName()     *** SKSE required ***

        IF     (iSoulType == 1)        ; "petty"
            Debug.Notification(_00E_SoulPetty.GetName()+s)
            SoulsCaught.Mod(1)

        ELSEIF (iSoulType == 2)        ; "lesser"
            Debug.Notification(_00E_SoulLesser.GetName()+s)
            SoulsCaught.Mod(1)

        ELSEIF (iSoulType == 3)        ; "common"
            Debug.Notification(_00E_SoulCommon.GetName()+s)
            SoulsCaught.Mod(1)

        ELSEIF (iSoulType == 4)        ; "greater"
            Debug.Notification(_00E_SoulGreater.GetName()+s)
            SoulsCaught.Mod(1)

        ELSEIF (iSoulType == 5)        ; "grand"
            Debug.Notification(_00E_SoulGrand.GetName()+s)
            SoulsCaught.Mod(1)
        ELSE
            _00E_SoulHuman.show()
        ENDIF

    ELSEIF ( victimIsNPC )
    
    ELSE
        _00E_Failed.show()
    ENDIF

;========================
; release lock
    IF ( SoulTrapController )
        SoulTrapController.ReleasePermission(caster)
    ENDIF
ENDFUNCTION


;---------------------------------------------------
FUNCTION PlayEffects(Actor akCaster, Actor akVictim)
;---------------------------------------------------
    TrapSoundFX.Play(akCaster)              ; Play TrapSoundFX sound from player
    TrapImod.Apply()                        ; Apply isMod at full strength

    TargetVFX.Play(akVictim, 4.7, akCaster) ; Play TargetVFX and aim them at the player
    CasterVFX.Play(akCaster, 5.9, akVictim)

    TargetFXS.Play(akVictim, 2)             ; Play effect shaders
    CasterFXS.Play(akCaster, 3)
ENDFUNCTION


SoulGem Property SoulGemBlack Auto
SoulGem Property SoulGemBlackFilled Auto


SoulGem Property SoulGemPetty Auto
SoulGem Property SoulGemPettyFilled Auto


SoulGem Property SoulGemLesser Auto
SoulGem Property SoulGemLesserFilled Auto
SoulGem Property _00E_SoulGemLesserFilledPetty Auto


SoulGem Property SoulGemCommon Auto
SoulGem Property SoulGemCommonFilled Auto
SoulGem Property _00E_SoulGemCommonFilledPetty Auto
SoulGem Property _00E_SoulGemCommonFilledLesser Auto


SoulGem Property SoulGemGreater Auto
SoulGem Property SoulGemGreaterFilled Auto
SoulGem Property _00E_SoulGemGreaterFilledPetty Auto
SoulGem Property _00E_SoulGemGreaterFilledLesser Auto
SoulGem Property _00E_SoulGemGreaterFilledCommon Auto


SoulGem Property SoulGemGrand Auto
SoulGem Property SoulGemGrandFilled Auto
SoulGem Property _00E_SoulGemGrandFilledPetty Auto
SoulGem Property _00E_SoulGemGrandFilledLesser Auto
SoulGem Property _00E_SoulGemGrandFilledCommon Auto
SoulGem Property _00E_SoulGemGrandFilledGreater Auto


SoulGem Property _00E_YerosCave_SiraSoulbender  Auto  
SoulGem Property _00E_YerosCave_SiraSoulbender_FillPetty  Auto  
SoulGem Property _00E_YerosCave_SiraSoulbender_FillLess  Auto
SoulGem Property _00E_YerosCave_SiraSoulbender_FillCom  Auto  
SoulGem Property _00E_YerosCave_SiraSoulbender_FillGreat  Auto  
SoulGem Property _00E_YerosCave_SiraSoulbender_FillGrand  Auto

MiscObject Property _00E_WishWell_FrostcliffTavern_BrokenSoulgem Auto

 

 

Edited by ReDragon2013
Link to comment
Share on other sites

Your script is an ActiveMagicEffectScript, that means every time the spell is casted the effect may stack. But the scriptVariables and properties do not have access to each instance of this magic effect.

For example:

            if numSiraFillCounter == 50 && Caster.GetItemCount(_00E_YerosCave_SiraSoulbender)
                numSiraFillCounter = 0
                Caster.RemoveItem(_00E_YerosCave_SiraSoulbender, 1, true)
                Caster.AddItem(_00E_WishWell_FrostcliffTavern_BrokenSoulgem, 1)
            endif

numSiraFillCounter will never be 50, because each effect has its own finish event.. You have to use a GlobalVariable for counting of this special case.

Hey, thanks for pointing that out.

 

 

The script comes from the original Soul Trap script from Enderal, so I am not about to change much of it but this code is actually an addition of myself.

I thought they added the counter to count how often souls got filled just so it is also easily usable in other areas.

Haven't thought about that it would go down when used as script variable. ^^

 

 

Anyways, the script works properly beside of that and the counter doesn't make sense right now at all.

 

 

As I cannot re-add that specific soul gem in empty form to the player.

 

I could use the "ReusableSoulgem" keyword on that, but as I said I cannot catch NPCs and creatures with that gem at the same time, so the scripted solution is prefered.

When I add a gem that has a filling and contains the "ReusableSoulgem" the game crashes when I charge a weapon with.

That's actually a known problem:

https://forums.nexusmods.com/index.php?/topic/7230051-custom-renewable-soul-gem-issue/

 

And in addition of not being able to fill the gem with NPCs and creature souls at the same time, the regular soul trap effect of Skyrim is bugged and actually wasn't ever fixed (probably hard-coded):

 

 

Soul gems that have been self-filled (using the Soul Trap enchantment or spell) can lose their souls when dropped or stored in containers. They also will not stack (i.e. each one appears separately in inventory). This happens regardless of whether the soul is the "proper" size for the gem (e.g. a common soul in a common soul gem).
  • The only workaround for this is to keep all self-filled soul gems in inventory. Despite claims to the contrary, this has not been fixed in any patch.

https://elderscrolls.fandom.com/wiki/Soul_Gem_(Skyrim)#Bugs

 

 

 

Fully self-filled soul gems will be emptied if dropped, or transferred to a follower or container.

Pc22.png This bug is fixed by version 1.0 of the Unofficial Skyrim Patch

https://en.uesp.net/wiki/Skyrim:Soul_Gems#Bugs

 

Hmmmm...

Interestingly UESP Wiki states that this is fixed in the UOP.

I only have Skyrim SE and Enderal installed, but I hope I find this fix also in the UOP of the SE version.

 

 

 

 

After all, thanks for your input. :smile:

Link to comment
Share on other sites

I am actually pretty disappointed about the scripting in the Creation Engine.

 

https://www.creationkit.com/index.php?title=List_of_Papyrus_Functions

 

Even with SKSE, it doesn't feature nearly as much as Fallout New Vegas. Which is currently probably the strongest Bethesda-engine when it comes to scripting.

 

https://geckwiki.com/index.php?title=Complete_List_of_Function_in_Fallout_New_Vegas

 

 

 

I really hope there will be a way for me to figure out how to add an empty soul gem to the player, without the necessity to add the "ReusableSoulgem" keyword.

As I actually would like to rather go with a scripted soul trap effect.

 

Yet any help on that will be much appreciated.

 

Thanks again to @ReDragon2013 for your input. :)

Link to comment
Share on other sites

This forum is for issues about Skyrim, not for Skyrim SE which has its own forum. As I rewrote the script that you posted, I didn't in mind it is related to vanilla script "magicSoulTrapFXScript".

 

You wrote: "And in addition of not being able to fill the gem with NPCs and creature souls at the same time, the regular soul trap effect of Skyrim is bugged and actually wasn't ever fixed (probably hard-coded):"

 

As follow three versions of that ActiveMagicEffect script:

 

vanilla

 

ScriptName magicSoulTrapFXScript extends ActiveMagicEffect
{Scripted effect for the Soul Trap Visual FX}

import debug


;======================================================================================;
;  PROPERTIES  /
;=============/
ImageSpaceModifier property TrapImod auto
{IsMod applied when we trap a soul}
sound property TrapSoundFX auto ; create a sound property well point to in the editor
{Sound played when we trap a soul}
VisualEffect property TargetVFX auto
{Visual Effect on Target aiming at Caster}
VisualEffect property CasterVFX auto
{Visual Effect on Caster aming at Target}
EffectShader property CasterFXS auto
{Effect Shader on Caster during Soul trap}
EffectShader property TargetFXS auto
{Effect Shader on Target during Soul trap}
bool property bIsEnchantmentEffect = false auto
{Set this to true if this soul trap is on a weapon enchantment or a spell that can do damage to deal with a fringe case}

;======================================================================================;
;  VARIABLES   /
;=============/
actor CasterActor
actor Victim
; objectreference playerref
bool DeadAlready = FALSE
bool bUseWait = True
;======================================================================================;
;  EVENTS      /
;=============/


Event OnEffectStart(Actor Target, Actor Caster)
    victim = target
    CasterActor = Caster
    if bIsEnchantmentEffect == False
        DeadAlready = Victim.IsDead()
    endif
    bUseWait = False
;     debug.trace("Is Soultrap target dead? ("+deadAlready+")("+victim+")")
EndEvent


Event OnEffectFinish(Actor Target, Actor Caster)
    trace(self + " is finishing")
    if victim
        if bUseWait
            Utility.Wait(0.25)
        endif
        if DeadAlready == False
            if Caster.TrapSoul(victim) == true
                trace(victim + " is, in fact, dead.  Play soul trap visFX")
                TrapSoundFX.play(Caster)       ; play TrapSoundFX sound from player
                TrapImod.apply()                                  ; apply isMod at full strength
                TargetVFX.Play(victim,4.7,Caster)              ; Play TargetVFX and aim them at the player
                CasterVFX.Play(Caster,5.9,victim)
                TargetFXS.Play(victim,2)                            ; Play Effect Shaders
                CasterFXS.Play(Caster,3)
            else
                trace(victim + " is, in fact, dead, But the TrapSoul check failed or came back false")
            endif
        
        else
            trace(self + "tried to soulTrap, but " + victim + " is already Dead.")
        endif
    endif
endEvent

; Event OnEffectFinish(Actor Target, Actor Caster)
    ; victim = target
    ; trace(self + " is finishing")
        ; if Caster.TrapSoul(victim) == true
            ; trace(victim + " is, in fact, dead.  Play soul trap visFX")
            ; TrapSoundFX.play(Caster)                       ; play TrapSoundFX sound from player
            ; TrapImod.apply()                               ; apply isMod at full strength
            ; TargetVFX.Play(victim,4.7,Caster)              ; Play TargetVFX and aim them at the player
            ; CasterVFX.Play(Caster,5.9,victim)
            ; TargetFXS.Play(victim,2)                       ; Play Effect Shaders
            ; CasterFXS.Play(Caster,3)
        ; else
            ; trace(victim + " ``is, in fact, dead, But the TrapSoul check failed or came back false")
        ; endif
; endEvent

 

 

 

my version

 

ScriptName magicSoulTrapFXScript extends ActiveMagicEffect
{v1.4 ReDragon 2014}    ; scripted effect for the Soul Trap Visual FX

  ImageSpaceModifier PROPERTY TrapImod auto       ; IsMod applied when we trap a soul

  VisualEffect PROPERTY TargetVFX auto            ; Visual Effect on Target aiming at Caster
  VisualEffect PROPERTY CasterVFX auto            ; Visual Effect on Caster aming at Target
  EffectShader PROPERTY CasterFXS auto            ; Effect Shader on Caster during Soul trap
  EffectShader PROPERTY TargetFXS auto            ; Effect Shader on Target during Soul trap

  Sound PROPERTY TrapSoundFX auto                  ; Sound played when we trap a soul

  Bool PROPERTY bIsEnchantmentEffect = False auto  ; [Default=False]
{if set to TRUE this soultrap is on a weapon enchantment or a spell that can do damage to deal with a fringe case}

 ;Actor CasterActor                                ; UnUSED by default
  Actor victim

 ;Bool DeadAlready = False                         ; UnUSED by now
  Bool bUseWait    = TRUE                          ; [Default=TRUE]


; -- EVENTs -- 2

EVENT OnEffectStart(Actor akTarget, Actor akCaster)
;==================================================
IF myF_IsMGEF(akTarget)
    RETURN    ; - STOP -    soul trap effect already exists
ENDIF
;---------------------
    bUseWait = False
ENDEVENT


EVENT OnEffectFinish(Actor akTarget, Actor akCaster)
;===================================================
    myF_Info(akCaster)

    IF ( bUseWait )
        Utility.Wait(0.25)
    ENDIF

IF ( victim )
ELSE
    RETURN    ; - STOP -    no victim initialized
ENDIF
;---------------------
IF (!bIsEnchantmentEffect) && victim.IsDead()
;;    Debug.Trace(self+" OnEffectFinish() - tried to soulTrap, but " +victim+ " is already Dead.")
    RETURN    ; - STOP -    no enchantment effect and victim is dead
ENDIF
;---------------------
    myF_FX(akCaster)
ENDEVENT


; -- FUNCTIONs -- 3

;----------------------------
FUNCTION myF_FX(Actor caster)
;----------------------------
;;;    bool bNPC = victim.HasKeyword(Game.GetForm(0x00013794) as Keyword)        ; ActorTypeNPC

IF (caster) && caster.TrapSoul(victim)
ELSE
    RETURN    ; - STOP -    caster is <None> or could not trap victims soul successfully
ENDIF
;---------------------
    objectReference oRef = caster as ObjectReference
    TrapSoundFX.Play(oRef)
    TrapImod.Apply()                         ; apply iMod at full strength
    TargetVFX.Play(victim, 4.7, oRef)        ; play TargetVFX and aim them at the player
    CasterVFX.Play(oRef, 5.9, victim)
    TargetFXS.Play(victim, 2)                ; play Effect Shaders
    CasterFXS.Play(oRef, 3)
ENDFUNCTION


;------------------------------
FUNCTION myF_Info(Actor caster)
;------------------------------
IF (caster == Game.GetPlayer())
ELSE
    RETURN    ; - STOP -    not the player
ENDIF
;---------------------
    int i = caster.GetItemCount( Game.GetForm(0x00063b29) )        ; The Black Star
    int n = caster.GetItemCount( Game.GetForm(0x0002E500) )        ; SoulGemBlack empty
    int m = caster.GetItemCount( Game.GetForm(0x0002E504) )        ; SoulGemBlack filled
; #############
    Debug.Trace(self+" OnEffectFinish() - player is the caster, BlackStar = " +i+ ", black soul gems = " +n+ " / " +m)
; #############
ENDFUNCTION


;-------------------------------------
Bool FUNCTION myF_IsMGEF(Actor target)
;-------------------------------------
IF     target.HasMagicEffect(Game.GetForm(0x0004DBA3) as MagicEffect)    ; [MGEF:0004DBA3] SoulTrapFFActor "Soul Trap"
ELSEIF target.HasMagicEffect(Game.GetForm(0x0005B452) as MagicEffect)    ; [MGEF:0005B452] EnchSoulTrapFFContact "Soul Trap"
ELSEIF target.HasMagicEffect(Game.GetForm(0x000F5D24) as MagicEffect)    ; [MGEF:000F5D24] EnchSoulTrapFFAimedArea "Soul Trap"
ELSE
    victim = target
    Return False    ; Good, no other soul trap effect is running
ENDIF
;---------
;;     Debug.Trace(self+" OnEffectStart() - Victim has the soul trap effect already..")
      Return TRUE        ; Bad!
ENDFUNCTION

 

 

 

UnofficialPatch

 

ScriptName magicSoulTrapFXScript extends ActiveMagicEffect
{Scripted effect for the Soul Trap Visual FX}

import debug


;======================================================================================;
;  PROPERTIES  /
;=============/
ImageSpaceModifier property TrapImod auto
{IsMod applied when we trap a soul}
sound property TrapSoundFX auto ; create a sound property well point to in the editor
{Sound played when we trap a soul}
VisualEffect property TargetVFX auto
{Visual Effect on Target aiming at Caster}
VisualEffect property CasterVFX auto
{Visual Effect on Caster aming at Target}
EffectShader property CasterFXS auto
{Effect Shader on Caster during Soul trap}
EffectShader property TargetFXS auto
{Effect Shader on Target during Soul trap}
bool property bIsEnchantmentEffect = false auto
{Set this to true if this soul trap is on a weapon enchantment or a spell that can do damage to deal with a fringe case}

;======================================================================================;
;  VARIABLES   /
;=============/
actor CasterActor
actor Victim
; objectreference playerref
bool DeadAlready = FALSE
bool bUseWait = True
;======================================================================================;
; USKP VARIABLES   /
;=================/
USKPSoulTrapController SoulTrapController
ObjectReference DummyContainer
SoulGem DA01SoulGemBlackStar
Keyword ActorTypeNPC
bool victimIsNPC
int iBlackStars
;======================================================================================;
;  EVENTS      /
;=============/

Event OnEffectStart(Actor Target, Actor Caster)
  victim = target
  CasterActor = Caster

  ;USKP ADDITIONS-------------------------------------------------------

    ActorTypeNPC = Game.GetFormFromFile(0x013794, "Skyrim.esm") as Keyword
    if victim.HasKeyword(ActorTypeNPC)
      victimIsNPC = True
    endif

  ;---------------------------------------------------------------------

  if bIsEnchantmentEffect == False
    DeadAlready = Victim.IsDead()
  endif
  bUseWait = False
;   debug.trace("Is Soultrap target dead? ("+deadAlready+")("+victim+")")
EndEvent


Event OnEffectFinish(Actor Target, Actor Caster)
  ;trace(self + " is finishing")
  if victim
    if bUseWait
      Utility.Wait(0.25)
    endif
    
    if DeadAlready == False

      ;USKP ADDITIONS---------------------------------------------------------------------------------------------------

        ;initiate lock to prevent multiple soul traps from processing at the same time:
        SoulTrapController = game.getFormFromFile(0x070E9F, "Unofficial Skyrim Legendary Edition Patch.esp") as USKPSoulTrapController
        if SoulTrapController != None
          while !SoulTrapController.SecurePermission(CasterActor)
            utility.wait(0.1)
;           debug.trace("USKP testMessage: magicSoulTrapFXScript Looping (waiting for permission)....")
          endWhile
        endif

        ;if victim is not a humanoid, remove Azuras Black Star from inventory before trap begins:
        if !victimIsNPC
          ;SoulGemBlack = Game.GetFormFromFile(0x02e500, "Skyrim.esm") as SoulGem
          DA01SoulGemBlackStar = Game.GetFormFromFile(0x063b29, "Skyrim.esm") as SoulGem
          DummyContainer = Game.GetFormFromFile(0x01B1D8, "Unofficial Skyrim Legendary Edition Patch.esp") as ObjectReference
          iBlackStars = CasterActor.GetItemCount(DA01SoulGemBlackStar)
          ;debug.trace( "Black Star: " + DA01SoulGemBlackStar + " DummyContainer: " + DummyContainer + " #Black Stars: " + iBlackStars )

          if iBlackStars > 0
            ;move Black Star temporarily to DummyContainer (preserves reference to avoid losing any soul already in Star)
            CasterActor.removeItem(DA01SoulGemBlackStar, iBlackStars, true, DummyContainer)
          endif
        endif

      bool bSoulTrapped = Caster.TrapSoul(victim) ;USKP line edit

        ;return Black Soul Gems & Black Star:
        if iBlackStars > 0
          DummyContainer.removeItem(DA01SoulGemBlackStar, iBlackStars, true, CasterActor)
        endif

        ;release lock
        SoulTrapController.ReleasePermission(CasterActor)

      ;begin vanilla Soul Trap FX finale:
      if bSoulTrapped == true ;USKP line edit

      ;-----------------------------------------------------------------------------------------------------------------

        ;trace(victim + " is, in fact, dead.  Play soul trap visFX")
        TrapSoundFX.play(Caster)                ; play TrapSoundFX sound from player
        TrapImod.apply()                        ; apply isMod at full strength
        TargetVFX.Play(victim,4.7,Caster)       ; Play TargetVFX and aim them at the player
        CasterVFX.Play(Caster,5.9,victim)
        TargetFXS.Play(victim,2)                ; Play Effect Shaders
        CasterFXS.Play(Caster,3)
      else
        ;trace(victim + " is, in fact, dead, But the TrapSoul check failed or came back false")
      endif
    
    else
      ;trace(self + "tried to soulTrap, but " + victim + " is already Dead.")
    endif
  endif
endEvent

; Event OnEffectFinish(Actor Target, Actor Caster)
  ; victim = target
  ; trace(self + " is finishing")
    ; if Caster.TrapSoul(victim) == true
      ; trace(victim + " is, in fact, dead.  Play soul trap visFX")
      ; TrapSoundFX.play(Caster)                ; play TrapSoundFX sound from player
      ; TrapImod.apply()                        ; apply isMod at full strength
      ; TargetVFX.Play(victim,4.7,Caster)       ; Play TargetVFX and aim them at the player
      ; CasterVFX.Play(Caster,5.9,victim)
      ; TargetFXS.Play(victim,2)                ; Play Effect Shaders
      ; CasterFXS.Play(Caster,3)
    ; else
      ; trace(victim + " ``is, in fact, dead, But the TrapSoul check failed or came back false")
    ; endif
; endEvent

 

 

 

Maybe it is helpful..

Edited by ReDragon2013
Link to comment
Share on other sites

I just mentioned Skyrim SE, because it's the only version I have installed.

 

 

But this script is for Enderal.

Have you hard about? It's a Skyrim classic (Oldrim) TC.

 

Thanks again for your post.

But the actual topic is not about this script. I just posted that as it is a start.

Have you seen the Soul Gem "_00E_YerosCave_SiraSoulbender" in my script?

This is meant to be a scripted, reusable soul gem.

 

I know reusable soul gems use a keyword called "ReusableSoulgem" so they don't disappear after usage in the inventory.

BUT, if you use that keyword you need to use the regular "TrapSoul" function.

As you cannot use the workaround with RemoveItem and AddItem, as if you add a filled soul gem which has the "ReusableSoulgem" keyword, your game crashes, when you try to charge a weapon with.

 

However, when you use the regular Soul Trap system you cannot control how the filling works and it appears that this is either bugged.

 


 

Soul gems that have been self-filled (using the Soul Trap enchantment or spell) can lose their souls when dropped or stored in containers. They also will not stack (i.e. each one appears separately in inventory). This happens regardless of whether the soul is the "proper" size for the gem (e.g. a common soul in a common soul gem).
  • The only workaround for this is to keep all self-filled soul gems in inventory. Despite claims to the contrary, this has not been fixed in any patch.

https://elderscrolls.fandom.com/wiki/Soul_Gem_(Skyrim)#Bugs

 

 

 

Fully self-filled soul gems will be emptied if dropped, or transferred to a follower or container.

Pc22.png This bug is fixed by version 1.0 of the Unofficial Skyrim Patch

https://en.uesp.net/wiki/Skyrim:Soul_Gems#Bugs

Yet thanks for posting the scripts. Even though I still would prefer to use a Script Effect with AddItem and RemoveItem on the Magic Effect instead of the actual Soul Trap archetype:

 

 

 

Just on a side note:

 

(1) your script is using a SKSE function

Enderal uses SKSE on default. You don't even have to install it, so there is nothing wrong with using a SKSE function.

Like seen here.

 

And just to be sure this is clear now:

The script I posted in the opening post works. I compiled it and tested it.

The only thing that doesn't work is the counter as you correctly stated AND I cannot get that "reusable" soul gem back as I cannot use the respective keyword to make this soul gem actually reusable.

 

This topic is about finding a solution on that problem.

Everytime I use that "reusable" soul gem, the game should be aware about that and gives the player silently such an emtpy soul gem back.

If that works I will make a global variable as suggested by you and count how often that "reusable" soul gem got filled. If the counter is 50, that soul gem will be finally removed and replaced with a broken one.

 

 

 

 

Still thanks for your effort. :smile:

Oh, I've wrote you a PM about the actual topic. You seem to have a lot of experience regarding Papyrus and maybe it's easier when we speak in our native language as according to your post on your Critter - Script fix mod I guess you are german? :wink:

Link to comment
Share on other sites

Not sure if you found a solution but this should be very easy to do a few different ways. I'm not going to rob you of the chance to learn something however.
The answer to your question is YES. One of the biggest parts of programming is problem solving. This one is pretty easy. Have fun!

Edited by NexusComa
Link to comment
Share on other sites

It probably would be easier if it would be Gamebryo.

Or if I simply can attach a script to the Soul Gem. XD

 

 

No seriously my current solution would be to add the soul gems via Quest Aliases which have the quest item flag set.

But I am unsure if a soul gem which is a quest item wouldn't get removed either. But even if that works it's rather a dumb "solution" at best. XD

 

So it might be easy for you, but I rather think in the ways of Gamebryo, so I am drifting further away from the solution I fear.

 

 

 

In addition:

 

Not sure if you found a solution but this should be very easy to do a few different ways. I'm not going to rob you of the chance to learn something however.
The answer to your question is YES. One of the biggest parts of programming it problem solving. This one is pretty easy. Have fun!

Ok... I have read your post a few times now and everytime I get more angry about.

I initially tried to wave it away with a funny response.

 

But honestly, that's a jackass comment. If someone is looking for help and you come like that it appears very unfriendly.

"Hahahaha easy solution but I don't tell!"

 

If everyone would share your mindset then this complete hub could be closed.

Because some people simply don't learn how scripting work. They rather go onto the official or unofficial pages of the game editor and check the functions there and try these out, or check out solutions of others and adapt these to their own needs.

That's not learning how it works, that's simply getting solutions. And that's perfectly fine.

Also asking for help is perfectly fine.

I've wrote this mod for New Vegas NOT because I am a programmer. But because I had a lot of help and even got a proper training on that engine and the scripting by my mentor. And I admit that I haven't credited him in that mod, BUT I've enhanced many of his own mods as an hommage and there I even added him as author.

You are crediting people who you got some assets from. That's perfectly fine. You never appear to mention if anyone helped you solving scripting problems.

So I simply guess you know it all and don't need any help about.

Good, you seem to be a programmer. And if that's the attitude of programmers, then I am glad I am not one.

 

I've shared many of my Gamebryo scripts, trials and errors with the community here on the New Vegas hub, regardless if useful or not. Even if people don't asked about it.

Similar like @ReDragon2013 completely revised the script currently used by the magic Soul Trap effect and I am happy to use his recommendations.

But I never would think of going to any hub on this site and writing something down like you did, as that's not helpful at all.

 

Yet I will credit both of you if I ever come to find an acceptable solution for and upload my mod.

Even though I only will credit ReDragon2013 for being helpful. ^^

Link to comment
Share on other sites

Your question was can it be done ... Yes it can. I just answered your question and gave you some encouragement.

 

I would say try what the script that fills the weapon is doing then just give them a new soulgem after.

​If i did go any further in the end I'd just end up doing what you should be doing and spend a few hours testing and writing scripts.

ReDragon2013 was all over this and not only answered you but gave you three different versions. I'm trying to not step on any toes here.
I didn't see any effort after the fact on your part. "Still thanks for your effort." Here is why you're wrong and what i feel you did wrong ... Are you kidding me.

Sorry if I offended you by doing exactly what you were doing ... asking you to do the work for me. Sucks, doesn't it.
And last but surly not least for the 1000th time ... This is not the SE forums.
Also this is almost exactly what the black or dark version of Azura's Star will do anyways (just not automatically).
Edited by NexusComa
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...