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?
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.
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.
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
; -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)
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
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
; *********************************************************************************** ; *** 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
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.
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.
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.
17 comments
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?
You're absolutely right with the mistake, I changed the source script in earlier posting of mine.
Thank you, and regards
kudo comes later!
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.
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.
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!
or is this for the axe-bleeding perk... ?
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.
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.
I wrote a detailed explanation at the description page now.