Skyrim
0 of 0

File information

Last updated

Original upload

Created by

Taka2nd

Uploaded by

Taka2nd

Virus scan

Safe to use

Tags for this mod

17 comments

  1. smokeybear187
    smokeybear187
    • premium
    • 19 kudos
    I've got a question:

    USLEEP: v3.0.10 (2017-08-12)

    Script Fixes

    FXDragonBloodDamageScript: Eliminated error spam and possibly stack dumps generated by this script. It has been rewritten by Taka2nd and used with permission. (Bug #13547)

    Does this mean your fix has been added to the latest USLEEP? or is your fix still necessary for the bleed-out function?

  2. xxFalconArasxx
    xxFalconArasxx
    • member
    • 4 kudos
    On the topic of broken Dragon blood effects. I noticed that in the game files of Dragonborn.esm, there is a bleeding effect for the Serpentine Dragon's head (DLC2Dragon_Black_BloodHeadFXArmor) that doesn't seem to work properly on the model, as in no bleed effect seems to occur on its head.
  3. ReDragon2013
    ReDragon2013
    • member
    • 48 kudos
    It is always a pleasure to see your really good code improvements. I shouldn't do many things at the same time.
    You're absolutely right with the mistake, I changed the source script in earlier posting of mine.
     
    Thank you, and regards 
     
    kudo comes later!
  4. ReDragon2013
    ReDragon2013
    • member
    • 48 kudos
    Forzane, I got it. Thank you..
     
    I'm sorry Taka2nd, its all fine with your code. Yesterday I had a black out in my brain.
    I couldn't see the forest, there were too many trees inside.

    The condition in line 102 is ok, because of percentage your are using. 1.0 - x, with x in [0..1] is always positive. Ashes on my head..

    Just in case you (Taka) want to make your script version a bit more comfortable and robust,
    here is an adjusted version, click on link "View forum thread" on top to see the papyrus script in formated code.
    Spoiler:  
    Show


    Scriptname FXDragonBloodDamageScript extends ActiveMagicEffect
    {a bit adjusted by ReDragon 2016, original idea by Taka2nd}

    ; it applies blood damage geometry to the dragon and turns it on
    ; when they are hit based on the direction they are hit from

    ; nexus mod source: http://www.nexusmods.com/skyrim/mods/80951/? by Taka2nd

    ; MARKs ORIGINAL VARS & PROPERTIES
      Armor PROPERTY DragonBloodHeadFXArmor  auto    ; UnUSED, do not remove vanilla properties (except they are Hidden)!
      Armor PROPERTY DragonBloodTailFXArmor  auto    ; UnUSED
      Armor PROPERTY DragonBloodWingLFXArmor auto    ; UnUSED
      Armor PROPERTY DragonBloodWingRFXArmor auto    ; UnUSED

    ; MARKs ORIGINAL VARS
      Actor selfRef

    ; JOELs VARS & PROPERTIES, user can override HP percentages
      Float PROPERTY HPpctT1 = 0.98 auto
      ; {relative total HP at which first blood should appear DEFAULT: 0.??}

      Float PROPERTY HPpctT2 = 0.95 auto
      ; {relative total HP at which second blood should appear DEFAULT: 0.??}
     
      Float PROPERTY HPpctT3 = 0.90 auto
      ; {relative total HP at which third blood should appear DEFAULT: 0.??}

      Float PROPERTY HPpctT4 = 0.80 auto
      ; {relative total HP at which final blood should appear DEFAULT: 0.??}

      Float previousHP

    ; tracking values for the amount of damage each "side" has taken.
      Float HPFront
      Float HPBack
      Float HPLeft
      Float HPRight

    ; tracking vars for damage to each side, 0 = no blood, 1 = tier 1 blood, etc.
      Int stateFront = 0
      Int stateBack  = 0
      Int stateLeft  = 0
      Int stateRight = 0


    ; Variable added by Taka2nd
      Bool bDead


    ; -- EVENTs -- 3 + "__Busy__"

    EVENT OnEffectStart(Actor akTarget, Actor akCaster)
        selfRef = akCaster
        bDead   = False

        stateFront = 0
        stateBack  = 0
        stateLeft  = 0
        stateRight = 0

        previousHP = 1.0    ; assume 100%
        HPFront    = 1.0
        HPBack     = 1.0
        HPLeft     = 1.0
        HPRight    = 1.0

        Validate()
    ENDEVENT


    EVENT OnDying(Actor akKiller)
        bDead = TRUE
    ENDEVENT


    ;=======================
    state __Busy__
    ;=============
    EVENT OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, Bool abBashAttack, Bool abHitBlocked)
    ENDEVENT
    ;=======
    endState


    ;  -45°     45°
    ;    \  a  /        a = Front
    ;     \   /
    ;  c   .*.  b       c = Left  b = Right
    ;     /   \
    ;   /  d  \       d = Back
    ; -135°    135°


    EVENT OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, Bool abBashAttack, Bool abHitBlocked)
    IF (akAggressor as Actor)
    ELSE
        RETURN    ; - STOP -    ### USKP 2.0.8 ### is possible for akAggressor to be NONE
    ENDIF
    ;---------------------
        gotoState("__Busy__")            ; ### STATE ###

    IF (!selfRef) || (bDead)
        selfRef = None
        RETURN    ; - STOP -    R.I.P. dragon monster
    ENDIF
    ;---------------------
        float f = selfRef.GetActorValuePercentage("health")              ; f = fCurrentHP (0.0 .. 1.0)
    IF (f <= 0.0)
        gotoState("")                    ; ### STATE ###  back to empty state
        RETURN    ; - STOP -    no hitpoints left, dead!
    ENDIF
    ;---------------------
        float deltaHP = previousHP - f                                   ; deltaHP = fDiffHP
    ;f; previousHP = f                                                   ; update global script variable (heap)
        
    IF (deltaHP <= 0)
        gotoState("")                    ; ### STATE ###  back to empty state
        RETURN    ; - STOP -    no valid delta
    ENDIF
    ;---------------------
    previousHP = f                                                   ; ### edit: 22/Dec/2016 back to version of Take2nd
        string s                                                         ; init function string variable (stack)

        float fHitAngle = selfRef.GetHeadingAngle(akAggressor)

    ;;;    int iNewState

        IF     (fHitAngle >= -45) && (fHitAngle <= 45)
            HPFront = HPFront - deltaHP

    ;;;        iNewState = GetBleedState(HPFront)
    ;;;        IF (iNewState > stateFront)

            IF IsNewBleedState(HPFront, stateFront)
                stateFront += 1
                s = "HeadBleed0" + stateFront
            ENDIF

    ;f; ELSEIF (fHitAngle >= 135) && (fHitAngle <= -135)
        ELSEIF (fHitAngle >= 135) || (fHitAngle <= -135)                ; ### edit: 22/Dec/2016 back to version of Take2nd
            HPBack = HPBack - deltaHP
            IF IsNewBleedState(HPBack, stateBack)
                stateBack += 1
                s = "TailBleed0" + stateBack
            ENDIF

        ELSEIF (fHitAngle < 0)
            HPLeft = HPLeft - deltaHP
            IF IsNewBleedState(HPLeft, stateLeft)
                stateLeft += 1
                s = "WingLBleed0" + stateLeft
            ENDIF

        ELSE ;IF (fHitAngle > 0)
            HPRight = HPRight - deltaHP
            IF IsNewBleedState(HPRight, stateRight)
                stateRight += 1
                s = "WingRBleed0" + stateRight
            ENDIF
        ENDIF

        IF (s) && (selfRef)
            selfRef.PlaySubGraphAnimation(s)
        ENDIF

        gotoState("")                    ; ### STATE ### back to empty state
    ENDEVENT


    ; -- FUNCTIONs -- 2

    ;---------------------------------------------------
    Bool FUNCTION IsNewBleedState(Float fHP, Int iState)
    ;---------------------------------------------------
        bool bOK = False

    IF     (fHP > HPpctT1)
    ;;;                        bOK = (0 > iState)     ; 100..99%    always false
    ELSEIF (fHP > HPpctT2)
                            bOK = (1 > iState)        ;  98..96%
    ELSEIF (fHP > HPpctT3)
                            bOK = (2 > iState)        ;  95..91%
    ELSEIF (fHP > HPpctT4)
                            bOK = (3 > iState)        ;  90..81%
    ELSE
                            bOK = (4 > iState)        ;   <= 80%
    ENDIF
        RETURN bOK
    ENDFUNCTION


    ;;------------------------------------
    ;Int FUNCTION GetBleedState(Float fHP)  ; obsolete by now
    ;;------------------------------------
    ;IF (fHP > HPpctT1)
    ;    RETURN 0            ; 100..99%
    ;ENDIF
    ;;---------
    ;IF (fHP > HPpctT2)
    ;    RETURN 1            ;  98..96%
    ;ENDIF
    ;;---------
    ;IF (fHP > HPpctT3)
    ;    RETURN 2            ;  95..91%
    ;ENDIF
    ;;---------
    ;IF (fHP > HPpctT4)
    ;    RETURN 3            ;  90..81%
    ;ENDIF
    ;;---------
    ;    RETURN 4            ;   <= 80%
    ;ENDFUNCTION


    ;------------------
    FUNCTION Validate()
    ;------------------
    ; *** Note: Only real dragons may have blood effects with PlaySubGraphAnimation() ***

    IF (selfRef) && (selfRef.GetRace().GetFormID() == 0x00012E82)        ; DragonRace [RACE:00012E82]
    ELSE
    ;; DLC1UndeadDragonRace [RACE:020117DE]    -> Durnehviir from Dawnguard
        gotoState("__Busy__")
        ebug.Trace(self+" Validate() - Abort! DragonRace does not match.. " +selfRef.GetRace())
        RETURN    ; - STOP -    invalid dragon race
    ENDIF
    ;---------------------
    IF selfRef.IsGhost()
        ebug.Trace("fxDBDS: Validate() - Abort! Dragon seems to be ghosted, " +selfRef)
        RETURN    ; - STOP -    ragon is a ghost!
    ENDIF
    ;---------------------
    IF (HPpctT4 > 0.2) && (HPpctT1 < 1.0) && (HPpctT1 > HPpctT2) && (HPpctT2 > HPpctT3) && (HPpctT3 > HPpctT4)
    ELSE
        ebug.Trace(self+" Validate() - Warning: Properties are missing or in bad order!  HP%1 = " +HPpctT1+ ", HP%2 = " +HPpctT2+ ", HP%3 = " +HPpctT3+ ", HP%4 = " +HPpctT4)
        HPpctT1 = 0.98        ; 0.98 by default
        HPpctT2 = 0.90        ; 0.95
        HPpctT3 = 0.75        ; 0.90
        HPpctT4 = 0.60        ; 0.80
    ENDIF
    ENDFUNCTION


    1. Taka2nd
      Taka2nd
      • member
      • 10 kudos
      That's excellent.
      It is fun to see the program source of an excellent engineer.
      I have learned a wonderful experience.

      But, there was a mistake in line 136. (from OR to AND)
      It probably will notice immediately after testing the operation.

      I am very appreciated that verify the program source, I am saved.
      Thank you very much.
  5. ReDragon2013
    ReDragon2013
    • member
    • 48 kudos
    I dislike script mods, which have not included the related source file. What are you afraid of?

    It was a good idea to implement selfRef.GetActorValuePercentage("health") instead of vanilla code like selfRef.GetActorValue("health").

    Nevertheless I disassembled your main script, and found something strange.
    Would you like to explain the code line 102!

    Spoiler:  
    Show


    Scriptname FXDragonBloodDamageScript extends ActiveMagicEffect
    {This script applies blood damage geometry to the dragon and turns it on when they are hit based on the direction they are hit from}
    ; nexus mod source: http://www.nexusmods.com/skyrim/mods/80951/?

    ;.info
    ;    .source "FXDragonBloodDamageScript.psc"
    ;    .modifyTime 1482096063 ;Sun Dec 18 22:21:03 2016 Local
    ;    .compileTime 1482096107 ;Sun Dec 18 22:21:47 2016 Local
    ;    .user "Taka"
    ;    .computer
    ;.endInfo

    ; MARKs ORIGINAL VARS & PROPERTIES
      Armor PROPERTY DragonBloodHeadFXArmor  auto    ; UnUSED, do not remove vanilla properties (except Hidden)!
      Armor PROPERTY DragonBloodTailFXArmor  auto    ; UnUSED
      Armor PROPERTY DragonBloodWingLFXArmor auto    ; UnUSED
      Armor PROPERTY DragonBloodWingRFXArmor auto    ; UnUSED

    ; MARKs ORIGINAL VARS
      Actor selfRef

    ; JOELs VARS & PROPERTIES
    ; user can override HP percentages
      Float PROPERTY HPpctT1 = 0.98 auto
      {relative total HP at which first blood should appear DEFAULT: 0.??}

      Float PROPERTY HPpctT2 = 0.95 auto
      {relative total HP at which second blood should appear DEFAULT: 0.??}
     
      Float PROPERTY HPpctT3 = 0.90 auto
      {relative total HP at which third blood should appear DEFAULT: 0.??}

      Float PROPERTY HPpctT4 = 0.80 auto
      {relative total HP at which final blood should appear DEFAULT: +HPpctT4}

      Float previousHP

    ; tracking values for the amount of damage each "side" has taken.
      Float HPFront
      Float HPBack
      Float HPLeft
      Float HPRight

    ; tracking vars for damage to each side, 0 = no blood, 1 = tier 1 blood, etc.
      Int stateFront = 0
      Int stateBack  = 0
      Int stateLeft  = 0
      Int stateRight = 0


    ; Variable added by Taka2nd
      Bool  bDead = False






    ; -- EVENTs -- 3 + "__Busy__"

    EVENT OnEffectStart(Actor Target, Actor Caster)            ; normally: EVENT OnEffectStart(Actor akTarget, Actor akCaster)
        selfRef = Caster                ;@line 62             ;           selfRef = akCaster
        stateFront = 0                  ;@line 63
        stateBack  = 0
        stateLeft  = 0
        stateRight = 0
        previousHP = 1.0                ;@line 67
        HPFront    = 1.0                ;@line 68
        HPBack     = 1.0
        HPLeft     = 1.0
        HPRight    = 1.0
        bDead = False                   ;@line 72
    ENDEVENT


    EVENT OnDying(Actor akKiller)
        bDead = TRUE                    ;@line 77            ; additional line could be useful: selfRef = None
    ENDEVENT

    ;  -45°     45°
    ;    \  0  /        0 = Front
    ;      \   /
    ;  2   .*.  1       2 = Left  1 = Right
    ;      /   \
    ;     /  3  \      3 = Back
    ; -135°    135°

    EVENT OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, Bool abBashAttack, Bool abHitBlocked)
        gotoState("__Busy__")           ;@line 89

    IF (!selfRef) || (bDead)            ;@line 91
        RETURN    ; - STOP -            ;@line 92
    ENDIF
    ;---------------------
    IF ( akAggressor )                                ;@line 95        better use that: IF (akAggressor as Actor)

        float fCurrentHP = selfRef.GetActorValuePercentage("health")                 ;@line 97
        IF (fCurrentHP <= 0)
            RETURN    ; - STOP -                                                     ;@line 99
        ENDIF
    ;    ----------------------
        float fDiffHP = previousHP - fCurrentHP       ;@line 102    *** SERIOUSLY ??? *** not that:  float fDiffHP = fCurrentHP - previousHP
        IF (fDiffHP > 0)                              ;@line 103    fDiffHP = 1.0 - xHP     --> it is always negative

            previousHP = fCurrentHP                                                  ;@line 105
            float fHitAngle = selfRef.GetHeadingAngle(akAggressor)                   ;@line 106
    ;;;        int   iNewState                                          ; better init here, instead inside the conditions

            IF     (fHitAngle >= -45) && (fHitAngle <= 45)                           ;@line 109
                HPFront = HPFront - fDiffHP                                          ;@line 110
                int iNewState = GetBleedState(HPFront)                               ;@line 111
                IF (iNewState > stateFront)                                          ;@line 112
                    stateFront = stateFront + 1                                      ;@line 113
                    selfRef.PlaySubGraphAnimation("HeadBleed0" + stateFront)         ;@line 114
                ENDIF

            ELSEIF (fHitAngle >= 135) && (fHitAngle <= -135)                         ;@line 117
                HPBack = HPBack - fDiffHP                                            ;@line 118
                int iNewState = GetBleedState(HPBack)                                ;@line 119
                IF (iNewState > stateBack)                                           ;@line 120
                    stateBack = stateBack + 1                                        ;@line 121
                    selfRef.PlaySubGraphAnimation("TailBleed0" + stateBack)          ;@line 122
                ENDIF

            ELSEIF (fHitAngle < 0)                                                   ;@line 125
                HPLeft = HPLeft - fDiffHP                                            ;@line 126
                int iNewState = GetBleedState(HPLeft)                                ;@line 127
                IF (iNewState > stateLeft)                                           ;@line 128
                    stateLeft = stateLeft + 1                                        ;@line 129
                    selfRef.PlaySubGraphAnimation("WingLBleed0" + stateLeft)         ;@line 130
                ENDIF

            ELSE
                HPRight = HPRight - fDiffHP                                          ;@line 134
                int iNewState = GetBleedState(HPRight)                               ;@line 135
                IF (iNewState > stateRight)                                          ;@line 136
                    stateRight = stateRight + 1                                      ;@line 137
                    selfRef.PlaySubGraphAnimation("WingRBleed0" + stateRight)        ;@line 138
                ENDIF
            ENDIF
        ENDIF
    ENDIF



        gotoState("")                    ;@line 146
    ENDEVENT



    Int FUNCTION GetBleedState(Float fHP)
    IF     (fHP > HPpctT1)               ;@line 152
                            RETURN 0
    ELSEIF (fHP > HPpctT2)               ;@line 154
                            RETURN 1
    ELSEIF (fHP > HPpctT3)               ;@line 156
                            RETURN 2
    ELSEIF (fHP > HPpctT4)               ;@line 158
                            RETURN 3     ;@line 159
    ENDIF
                            RETURN 4     ;@line 161
    ENDFUNCTION


    ;=======================
    state __Busy__
    ;=============
    EVENT OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, Bool abBashAttack, Bool abHitBlocked)
    ENDEVENT
    ;=======
    endState


    ; ***********************************************************************************
    ; *** Note: only real dragons may have blood effects with PlaySubGraphAnimation() ***
    ; ***********************************************************************************
    ; YOU FORGOT a race check like this:

    ;Bool FUNCTION IsDragonRace()
    ;----------------------------
    ; IF (selfRef) && (selfRef.GetRace().GetFormID() == 0x00012E82)       ; DragonRace [RACE:00012E82]    
    ;    Return TRUE
    ; ENDIF
    ;
    ;; DLC1UndeadDragonRace [RACE:020117DE]    -> Durnehviir from Dawnguard
    ;    gotoState("__Busy__")
    ;    ebug.Trace(self+" RaceCheck() - Abort! DragonRace does not match.. " +selfRef.GetRace())
    ;    Return False
    ;ENDFUNCTION


    1. Forzane
      Forzane
      • premium
      • 141 kudos
      actually the source is sitting as an misc download on the files tab
  6. Thomss00
    Thomss00
    • member
    • 36 kudos
    Thanks, now works.
  7. Spunky23
    Spunky23
    • member
    • 0 kudos
    Since when do dragons bleed? Is this mod based on another mod?
    or is this for the axe-bleeding perk... ?
  8. Rendu
    Rendu
    • member
    • 3 kudos
    Okay. So this will make dragons bleed a lot? That would be cool, but I have to ask why there is only one screenshot and in it are a bunch of dead dragons and no blood in sight? I think bleeding dragons is a great idea and would love to try this. It would be cool if I could actually see an example of what this mod does.
    1. aUberboy
      aUberboy
      • member
      • 0 kudos
      There is an error in how the dragon bleed script was operating that would show up repeatedly in the Skyrim logs (I am unsure if or how it may have affected game stability but I've come across it in the logs of at least one crash-to-desktop during a dragon fight before). Apparently this mod attempts to correct that error.

      As such, I'm not sure there really can be an illustrative screenshot, since I think the point here is to reduce or eliminate that source of error & potential instability, instead of adding functionality.
  9. kcaz25
    kcaz25
    • supporter
    • 24 kudos
    WIll you tell the USLEEP team!
    1. Taka2nd
      Taka2nd
      • member
      • 10 kudos
      I think so, too.
      I am also the one who loves USLEEP.
      However, because I am not good at English, I did not understand how to report an error.
      If you know, please let me know.

      Just because you need to rewrite almost all of the script to fix this bug,
      I hope I can explain it properly.
  10. Alkohol
    Alkohol
    • supporter
    • 15 kudos
    Yeah, I'd like to know exactly what the bug is.
    1. Taka2nd
      Taka2nd
      • member
      • 10 kudos
      I'm sorry.
      I wrote a detailed explanation at the description page now.