1
Fork 0

Added USSEP fixes to 47 scripts

development
Eddoursul 5 months ago
parent 3bdb55885c
commit ae5bb8af7d
  1. BIN
      scripts/atronachfrostscript.pex
  2. BIN
      scripts/blackreachdoorscript.pex
  3. BIN
      scripts/blacksmithforge01.pex
  4. BIN
      scripts/carryactorscript.pex
  5. BIN
      scripts/defaultdisableexitenableenter.pex
  6. BIN
      scripts/defaultforceevaluatepackagetrigger.pex
  7. BIN
      scripts/defaultpillarpuzzlelever.pex
  8. BIN
      scripts/defaultpillarpuzzlelevernofurn.pex
  9. BIN
      scripts/defaultpillarpuzzlepullbarnofurn.pex
  10. BIN
      scripts/doorbar.pex
  11. BIN
      scripts/dragonpriestactorscript.pex
  12. BIN
      scripts/dunkarthspireplatepuzzlescript.pex
  13. BIN
      scripts/dwespidercenturionpipescript.pex
  14. BIN
      scripts/favordialoguescript.pex
  15. BIN
      scripts/flameatronacheffectscript.pex
  16. BIN
      scripts/fxbirdfleescript.pex
  17. BIN
      scripts/fxdragonblooddamagescript.pex
  18. BIN
      scripts/fxdraugrmagicscript.pex
  19. BIN
      scripts/fxdwarvencenturionscript.pex
  20. BIN
      scripts/fxdwarvenspherescript.pex
  21. BIN
      scripts/fxdwarvenspiderscript.pex
  22. BIN
      scripts/fxgreybeardshoutscript.pex
  23. BIN
      scripts/fxsetblendvariablescript.pex
  24. BIN
      scripts/fxskeletonnecroscript.pex
  25. BIN
      scripts/fxsovengardescript.pex
  26. BIN
      scripts/icewraithparticlesscript.pex
  27. BIN
      scripts/magicattachashpileondeath.pex
  28. BIN
      scripts/magiceffectshadersonendscript.pex
  29. BIN
      scripts/pf_carryfirewood_000d97fa.pex
  30. BIN
      scripts/playerbookshelfclicktriggerscript.pex
  31. BIN
      scripts/playerbookshelfcontainerscript.pex
  32. BIN
      scripts/playerbookshelftriggerscript.pex
  33. BIN
      scripts/playerpotionrackclicktriggerscript.pex
  34. BIN
      scripts/playerpotionracktriggerscript.pex
  35. BIN
      scripts/reanimateashpile.pex
  36. BIN
      scripts/silverswordscript.pex
  37. BIN
      scripts/spiderwebanimationsscript.pex
  38. BIN
      scripts/sprigganswarmactorscript.pex
  39. BIN
      scripts/trapbear.pex
  40. BIN
      scripts/trapdweflamepillar.pex
  41. BIN
      scripts/traphitbase.pex
  42. BIN
      scripts/trapsoulgemcontroller.pex
  43. BIN
      scripts/traptriggerbase.pex
  44. BIN
      scripts/traptriggerhinge.pex
  45. BIN
      scripts/tripwire.pex
  46. BIN
      scripts/weaponracktriggerscript.pex
  47. 13
      source/scripts/atronachfrostscript.psc
  48. 6
      source/scripts/blackreachdoorscript.psc
  49. 2
      source/scripts/blacksmithforge01.psc
  50. 6
      source/scripts/carryactorscript.psc
  51. 50
      source/scripts/defaultdisableexitenableenter.psc
  52. 4
      source/scripts/defaultforceevaluatepackagetrigger.psc
  53. 17
      source/scripts/defaultpillarpuzzlelever.psc
  54. 17
      source/scripts/defaultpillarpuzzlelevernofurn.psc
  55. 17
      source/scripts/defaultpillarpuzzlepullbarnofurn.psc
  56. 5
      source/scripts/doorbar.psc
  57. 31
      source/scripts/dragonpriestactorscript.psc
  58. 16
      source/scripts/dunkarthspireplatepuzzlescript.psc
  59. 3
      source/scripts/dwespidercenturionpipescript.psc
  60. 20
      source/scripts/favordialoguescript.psc
  61. 13
      source/scripts/flameatronacheffectscript.psc
  62. 2
      source/scripts/fxbirdfleescript.psc
  63. 433
      source/scripts/fxdragonblooddamagescript.psc
  64. 11
      source/scripts/fxdraugrmagicscript.psc
  65. 14
      source/scripts/fxdwarvencenturionscript.psc
  66. 11
      source/scripts/fxdwarvenspherescript.psc
  67. 12
      source/scripts/fxdwarvenspiderscript.psc
  68. 2
      source/scripts/fxgreybeardshoutscript.psc
  69. 5
      source/scripts/fxsetblendvariablescript.psc
  70. 7
      source/scripts/fxskeletonnecroscript.psc
  71. 8
      source/scripts/fxsovengardescript.psc
  72. 21
      source/scripts/icewraithparticlesscript.psc
  73. 4
      source/scripts/magicattachashpileondeath.psc
  74. 21
      source/scripts/magiceffectshadersonendscript.psc
  75. 11
      source/scripts/pf_carryfirewood_000d97fa.psc
  76. 2
      source/scripts/playerbookshelfclicktriggerscript.psc
  77. 399
      source/scripts/playerbookshelfcontainerscript.psc
  78. 16
      source/scripts/playerbookshelftriggerscript.psc
  79. 2
      source/scripts/playerpotionrackclicktriggerscript.psc
  80. 8
      source/scripts/playerpotionracktriggerscript.psc
  81. 41
      source/scripts/reanimateashpile.psc
  82. 10
      source/scripts/silverswordscript.psc
  83. 8
      source/scripts/spiderwebanimationsscript.psc
  84. 7
      source/scripts/sprigganswarmactorscript.psc
  85. 7
      source/scripts/trapbear.psc
  86. 9
      source/scripts/trapdweflamepillar.psc
  87. 9
      source/scripts/traphitbase.psc
  88. 3
      source/scripts/trapsoulgemcontroller.psc
  89. 7
      source/scripts/traptriggerbase.psc
  90. 2
      source/scripts/traptriggerhinge.psc
  91. 99
      source/scripts/tripwire.psc
  92. 285
      source/scripts/weaponracktriggerscript.psc

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -10,8 +10,17 @@ Actor selfRef
int atronachHealth int atronachHealth
EVENT OnEffectStart(Actor Target, Actor Caster) EVENT OnEffectStart(Actor Target, Actor Caster)
selfRef = caster selfRef = caster
AtronachFrostFXS.Play(selfRef)
;USKP 2.0.5 - Stop this from attaching to the player.
if( selfRef == Game.GetPlayer() )
Return
EndIf
;USKP 2.0.3 - 3D check needed
if( selfRef.Is3DLoaded() )
AtronachFrostFXS.Play(selfRef)
EndIf
ENDEVENT ENDEVENT
Event OnEffectFinish(Actor akTarget, Actor akCaster) Event OnEffectFinish(Actor akTarget, Actor akCaster)

@ -38,7 +38,7 @@ endState
STATE busy STATE busy
; This is the state when I'm busy animating ; This is the state when I'm busy animating
EVENT onActivate (objectReference triggerRef) EVENT onActivate (objectReference triggerRef)
trace (self + " Busy") ;trace (self + " Busy")
endEVENT endEVENT
endSTATE endSTATE
@ -51,10 +51,10 @@ function SetOpen(bool abOpen = true)
isAnimating = true isAnimating = true
if !isOpen if !isOpen
gotoState ("busy") gotoState ("busy")
trace(self + " Opening") ;trace(self + " Opening")
playAnimationandWait(openAnim, openEvent) ; Animate Open playAnimationandWait(openAnim, openEvent) ; Animate Open
endif endif
trace(self + " Opened") ;trace(self + " Opened")
isOpen = true isOpen = true
gotoState("done") gotoState("done")
isAnimating = false isAnimating = false

@ -9,6 +9,6 @@ endEvent
Event OnTriggerEnter ( objectReference triggerRef ) Event OnTriggerEnter ( objectReference triggerRef )
if (triggerRef == Game.GetPlayer()) if (triggerRef == Game.GetPlayer())
FlameDamage.Cast(triggerRef, triggerRef) FlameDamage.Cast(self, triggerRef)
endIf endIf
endEvent endEvent

@ -1,5 +1,6 @@
Scriptname CarryActorScript extends ObjectReference Scriptname CarryActorScript extends Actor
{Script for actors who carry items around} {Script for actors who carry items around}
;USKP 2.0.1 - Yes. So explain why it was extending ObjectReference instead. No? Don't even want to try? I thought not.
MiscObject Property CarryItemMisc Auto MiscObject Property CarryItemMisc Auto
{item being carried - MiscObject} {item being carried - MiscObject}
@ -47,8 +48,7 @@ function ChangeCarryState(bool bBeginCarrying, bool bDropItem = false)
; I'm not carrying anything any more ; I'm not carrying anything any more
bCarryFlag = 0 bCarryFlag = 0
; get rid of anim object ; get rid of anim object
Actor selfActor = (self as ObjectReference) as Actor Self.PlayIdle(StopCarryingEvent)
selfActor.PlayIdle(StopCarryingEvent)
endif endif
endFunction endFunction

@ -20,11 +20,25 @@ EVENT onTriggerEnter(objectReference triggerRef)
ObjectReference MyLink03 = GetLinkedRef(LinkCustom03) ObjectReference MyLink03 = GetLinkedRef(LinkCustom03)
ObjectReference MyLink04 = GetLinkedRef(LinkCustom04) ObjectReference MyLink04 = GetLinkedRef(LinkCustom04)
MyLink.Enable(shouldFade) if( MyLink != None )
MyLink01.Enable(shouldFade) MyLink.Enable(shouldFade)
MyLink02.Enable(shouldFade) EndIf
MyLink03.Enable(shouldFade)
MyLink04.Enable(shouldFade) if( MyLink01 != None )
MyLink01.Enable(shouldFade)
EndIf
if( MyLink02 != None )
MyLink02.Enable(shouldFade)
EndIf
if( MyLink03 != None )
MyLink03.Enable(shouldFade)
EndIf
if( MyLink04 != None )
MyLink04.Enable(shouldFade)
EndIf
endif endif
endEVENT endEVENT
@ -36,10 +50,24 @@ EVENT onTriggerLeave(objectReference triggerRef)
ObjectReference MyLink03 = GetLinkedRef(LinkCustom03) ObjectReference MyLink03 = GetLinkedRef(LinkCustom03)
ObjectReference MyLink04 = GetLinkedRef(LinkCustom04) ObjectReference MyLink04 = GetLinkedRef(LinkCustom04)
MyLink.Disable(shouldFade) if( MyLink != None )
MyLink01.Disable(shouldFade) MyLink.Disable(shouldFade)
MyLink02.Disable(shouldFade) EndIf
MyLink03.Disable(shouldFade)
MyLink04.Disable(shouldFade) if( MyLink01 != None )
MyLink01.Disable(shouldFade)
EndIf
if( MyLink02 != None )
MyLink02.Disable(shouldFade)
EndIf
if( MyLink03 != None )
MyLink03.Disable(shouldFade)
EndIf
if( MyLink04 != None )
MyLink04.Disable(shouldFade)
EndIf
endif endif
endEVENT endEVENT

@ -10,6 +10,8 @@ EVENT OnTriggerEnter(objectReference actronaut)
(actorToForce As Actor).EvaluatePackage() (actorToForce As Actor).EvaluatePackage()
EndIf EndIf
if (aliasToForce != None) if (aliasToForce != None)
aliasToForce.GetActorReference().EvaluatePackage() if( aliasToForce.GetActorReference() != None ) ;USKP 2.0 - Ya just needed one more sanity check guys :P
aliasToForce.GetActorReference().EvaluatePackage()
EndIf
EndIf EndIf
endEVENT endEVENT

@ -51,10 +51,19 @@ Function doorOrDarts()
endif endif
else else
puzzleSolved = false puzzleSolved = false
refActOnFailure01.activate (self as objectReference) ;USKP 2.0.1 - Sanity checks. Not all of these are used in each instance of this script.
refActOnFailure02.activate (self as objectReference) if( refActOnFailure01 != None )
refActOnFailure03.activate (self as objectReference) refActOnFailure01.activate (self as objectReference)
refActOnFailure04.activate (self as objectReference) EndIf
if( refActOnFailure02 != None )
refActOnFailure02.activate (self as objectReference)
EndIf
if( refActOnFailure03 != None )
refActOnFailure03.activate (self as objectReference)
EndIf
if( refActOnFailure04 != None )
refActOnFailure04.activate (self as objectReference)
EndIf
endif endif
endFunction endFunction

@ -51,10 +51,19 @@ Function doorOrDarts()
endif endif
else else
puzzleSolved = false puzzleSolved = false
refActOnFailure01.activate (self as objectReference) ;USKP 2.0.1 - Sanity checks. Not all of these are used in each instance of this script.
refActOnFailure02.activate (self as objectReference) if( refActOnFailure01 != None )
refActOnFailure03.activate (self as objectReference) refActOnFailure01.activate (self as objectReference)
refActOnFailure04.activate (self as objectReference) EndIf
if( refActOnFailure02 != None )
refActOnFailure02.activate (self as objectReference)
EndIf
if( refActOnFailure03 != None )
refActOnFailure03.activate (self as objectReference)
EndIf
if( refActOnFailure04 != None )
refActOnFailure04.activate (self as objectReference)
EndIf
endif endif
endFunction endFunction

@ -51,10 +51,19 @@ Function doorOrDarts()
endif endif
else else
puzzleSolved = false puzzleSolved = false
refActOnFailure01.activate (self as objectReference) ;USKP 2.0.1 - Sanity checks. Not all of these are used in each instance of this script.
refActOnFailure02.activate (self as objectReference) if( refActOnFailure01 != None )
refActOnFailure03.activate (self as objectReference) refActOnFailure01.activate (self as objectReference)
refActOnFailure04.activate (self as objectReference) EndIf
if( refActOnFailure02 != None )
refActOnFailure02.activate (self as objectReference)
EndIf
if( refActOnFailure03 != None )
refActOnFailure03.activate (self as objectReference)
EndIf
if( refActOnFailure04 != None )
refActOnFailure04.activate (self as objectReference)
EndIf
endif endif
endFunction endFunction

@ -41,6 +41,11 @@ EVENT onCellLoad()
gotoState("down") gotoState("down")
endif endif
endif endif
;USKP 2.0.5 - If the door bar is disabled, then the navcut box should be as well or it may lead to NPC pathing problems.
if( IsDisabled() )
myNavCutLink.disable()
EndIf
endEVENT endEVENT
STATE down STATE down

@ -22,6 +22,16 @@ Actor selfRef ;local pointer to the curren dragon priest
EVENT OnEffectStart(Actor Target, Actor Caster) EVENT OnEffectStart(Actor Target, Actor Caster)
selfRef = caster ;local pointer to the curren dragon priest selfRef = caster ;local pointer to the curren dragon priest
;Added by USKP to prevent this effect from appearing on the player.
If selfRef == Game.GetPlayer()
Dispel()
return
EndIf
;USSEP 4.1.5 Bug #13749: added this line:
USSEP_RegisterForAnimationEvents (selfRef)
if (selfRef.GetSleepState() == 3) if (selfRef.GetSleepState() == 3)
; Debug.Trace("DP is sleeping! 3") ; Debug.Trace("DP is sleeping! 3")
else else
@ -35,6 +45,13 @@ ENDEVENT
Event OnGetUp(ObjectReference akFurniture) Event OnGetUp(ObjectReference akFurniture)
; Debug.Trace("Dragon preist just got up from " ) ; Debug.Trace("Dragon preist just got up from " )
;Play all of the magic fx ;Play all of the magic fx
;Added by USKP to prevent this effect from appearing on the player.
If selfRef == Game.GetPlayer()
Dispel()
return
EndIf
selfRef.equipitem(DragonPriestArmor01) selfRef.equipitem(DragonPriestArmor01)
DragonPriestParticlesFX.play(selfRef, -1) DragonPriestParticlesFX.play(selfRef, -1)
DragonPriestEyeGlowFX.play(selfRef, -1) DragonPriestEyeGlowFX.play(selfRef, -1)
@ -66,3 +83,17 @@ EVENT OnDying(Actor akKiller)
ENDEVENT ENDEVENT
;-----------------------------------------------------------------
; Added by USSEP 4.1.5 for Bug #13749
;-----------------------------------------------------------------
Event OnAnimationEvent (ObjectReference akSource, string asEventName)
;do nothing
EndEvent
function USSEP_RegisterForAnimationEvents (actor actorRef)
if actorRef
RegisterForAnimationEvent (actorRef, "stage2")
RegisterForAnimationEvent (actorRef, "stage3")
endif
endFunction

@ -19,9 +19,7 @@ OBJECTREFERENCE victim
EVENT onLoad() EVENT onLoad()
; //setting the master script to be the one with the stored vars ; //setting the master script to be the one with the stored vars
if castSource != None mainScript = castSource AS dunKarthspirePuzzleMaster
mainScript = castSource AS dunKarthspirePuzzleMaster
endif
endEVENT endEVENT
@ -36,13 +34,11 @@ auto STATE Active
playAnimation("Down") playAnimation("Down")
ELSE ELSE
if mainScript != None ;USKP 2.0.5 - Bethesda didn't bother to check their bool to see if the trigger being stepped on is safe!
;USKP 2.0.5 - Bethesda didn't bother to check their bool to see if the trigger being stepped on is safe! IF(!mainScript.plateSolved && !bSafe)
IF(!mainScript.plateSolved && !bSafe) spellDmg.cast(castSource, triggerRef)
spellDmg.cast(castSource, triggerRef) TriggerSound.play(self)
TriggerSound.play(self) ENDIF
ENDIF
endif
playAnimation("Down") playAnimation("Down")

@ -9,7 +9,8 @@ auto State Listening
Event onActivate(objectReference triggerRef) Event onActivate(objectReference triggerRef)
Actor myActor = triggerRef as Actor Actor myActor = triggerRef as Actor
if (myActor.getState() != "Waiting") ;USKP 2.0.1 - Added check to make sure the actor exists.
if (myActor && myActor.getState() != "Waiting")
gotoState("done") gotoState("done")
playAnimation("exit") playAnimation("exit")
endif endif

@ -45,11 +45,11 @@ import debug
; call this to persuade target actor ; call this to persuade target actor
Function Persuade(Actor pTarget) Function Persuade(Actor pTarget)
trace("Persuade: " + pTarget) ;trace("Persuade: " + pTarget)
; give player skill uses ; give player skill uses
SkillUseMultiplier = SpeechSkillMult.value SkillUseMultiplier = SpeechSkillMult.value
SkillUsePersuade = SkillUseMultiplier * Game.GetPlayer().GetAv("Speechcraft") SkillUsePersuade = SkillUseMultiplier * Game.GetPlayer().GetAv("Speechcraft")
trace(self + "Current Skill uses given: " + SkillUsePersuade + " times the Skill Use Multiplier") ;trace(self + "Current Skill uses given: " + SkillUsePersuade + " times the Skill Use Multiplier")
AdvanceSkill("Speechcraft", SkillUsePersuade) AdvanceSkill("Speechcraft", SkillUsePersuade)
Game.IncrementStat( "Persuasions" ) Game.IncrementStat( "Persuasions" )
if ( Game.QueryStat( "Bribes" ) && Game.QueryStat( "Intimidations" ) ) if ( Game.QueryStat( "Bribes" ) && Game.QueryStat( "Intimidations" ) )
@ -58,7 +58,7 @@ Function Persuade(Actor pTarget)
endFunction endFunction
Function ArrestPersuade(Actor pTarget) Function ArrestPersuade(Actor pTarget)
trace("Persuade: " + pTarget) ;trace("Persuade: " + pTarget)
; give player skill uses ; give player skill uses
SkillUseMultiplier = SpeechSkillMult.value SkillUseMultiplier = SpeechSkillMult.value
SkillUsePersuade = SkillUseMultiplier * Game.GetPlayer().GetAv("Speechcraft") SkillUsePersuade = SkillUseMultiplier * Game.GetPlayer().GetAv("Speechcraft")
@ -74,10 +74,10 @@ endFunction
; call this to bribe target actor ; call this to bribe target actor
Function Bribe(Actor pTarget) Function Bribe(Actor pTarget)
trace("Bribe: " + pTarget) ;trace("Bribe: " + pTarget)
SkillUseMultiplier = SpeechSkillMult.value SkillUseMultiplier = SpeechSkillMult.value
SkillUseBribe = SkillUseMultiplier * Game.GetPlayer().GetAv("Speechcraft") SkillUseBribe = SkillUseMultiplier * Game.GetPlayer().GetAv("Speechcraft")
trace(self + "Current Skill uses given: " + SkillUseBribe + " times the Skill Use Multiplier") ;trace(self + "Current Skill uses given: " + SkillUseBribe + " times the Skill Use Multiplier")
if pTarget.GetBribeAmount() <= GetPlayer().GetGoldAmount() if pTarget.GetBribeAmount() <= GetPlayer().GetGoldAmount()
; remove gold ; remove gold
GetPlayer().RemoveItem(Gold, pTarget.GetBribeAmount()) GetPlayer().RemoveItem(Gold, pTarget.GetBribeAmount())
@ -97,10 +97,10 @@ endFunction
; call this to intimidate target actor ; call this to intimidate target actor
Function Intimidate(Actor pTarget) Function Intimidate(Actor pTarget)
trace("Intimidate: " + pTarget) ;trace("Intimidate: " + pTarget)
SkillUseMultiplier = SpeechSkillMult.value SkillUseMultiplier = SpeechSkillMult.value
SkillUseIntimidate = SkillUseMultiplier * Game.GetPlayer().GetAv("Speechcraft") SkillUseIntimidate = SkillUseMultiplier * Game.GetPlayer().GetAv("Speechcraft")
trace(self + "Current Skill uses given: " + SkillUseIntimidate + " times the Skill Use Multiplier") ;trace(self + "Current Skill uses given: " + SkillUseIntimidate + " times the Skill Use Multiplier")
; intimidate actor ; intimidate actor
pTarget.SetIntimidated() pTarget.SetIntimidated()
; give player skill uses. don't if the Brawl quest is running, don't track intimidation stats for Brawl ; give player skill uses. don't if the Brawl quest is running, don't track intimidation stats for Brawl
@ -110,20 +110,20 @@ endFunction
; call this to initiate brawl quest through story manager ; call this to initiate brawl quest through story manager
Function Brawl(Actor pTarget, Actor pTargetFriend = None) Function Brawl(Actor pTarget, Actor pTargetFriend = None)
trace("Brawl: " + pTarget + ", friend=" + pTargetFriend) ;trace("Brawl: " + pTarget + ", friend=" + pTargetFriend)
BrawlKeyword.SendStoryEvent(None, pTarget, pTargetFriend) BrawlKeyword.SendStoryEvent(None, pTarget, pTargetFriend)
endFunction endFunction
; call this to give gift to target actor ; call this to give gift to target actor
Function GiveGift(Actor pTarget) Function GiveGift(Actor pTarget)
FormList giftFilter = pTarget.GetActorBase().GetGiftFilter() FormList giftFilter = pTarget.GetActorBase().GetGiftFilter()
trace("Give Gift: " + pTarget + ", gift filter = " + giftFilter) ;trace("Give Gift: " + pTarget + ", gift filter = " + giftFilter)
int favorPointsEarned = pTarget.ShowGiftMenu(true, giftFilter) int favorPointsEarned = pTarget.ShowGiftMenu(true, giftFilter)
; TEMP cap until we have a formula for this: ; TEMP cap until we have a formula for this:
if favorPointsEarned > 100 if favorPointsEarned > 100
favorPointsEarned = 100 favorPointsEarned = 100
endif endif
; give player skill uses ; give player skill uses
trace("Give Gift: " + favorPointsEarned * SkillUseGiveGiftMult + " skill uses earned") ;trace("Give Gift: " + favorPointsEarned * SkillUseGiveGiftMult + " skill uses earned")
AdvanceSkill("Speechcraft", favorPointsEarned * SkillUseGiveGiftMult) AdvanceSkill("Speechcraft", favorPointsEarned * SkillUseGiveGiftMult)
endFunction endFunction

@ -18,7 +18,16 @@ int atronachHealth
EVENT OnEffectStart(Actor Target, Actor Caster) EVENT OnEffectStart(Actor Target, Actor Caster)
selfRef = caster selfRef = caster
AtronachFlameTrail.Play(selfRef, -1)
;USKP 2.0.1 - Stop this from attaching to the player.
if( selfRef == Game.GetPlayer() )
Return
EndIf
;USKP 2.0.3 - 3D check, shaders, etc
if( selfRef.Is3DLoaded() )
AtronachFlameTrail.Play(selfRef, -1)
EndIf
ENDEVENT ENDEVENT
Event OnEffectFinish(Actor akTarget, Actor akCaster) Event OnEffectFinish(Actor akTarget, Actor akCaster)
@ -44,5 +53,3 @@ int atronachHealth
AtronachFlameDeathFXS.Stop(selfRef) AtronachFlameDeathFXS.Stop(selfRef)
endif endif
ENDEVENT ENDEVENT

@ -16,6 +16,8 @@ int instanceID00
;************************************************* ;*************************************************
Event onCellAttach() Event onCellAttach()
;USKP 2.0.1 - Short delay added to let 3D catch up.
Utility.Wait(0.5)
instanceID00 = BirdFlockSound.Play(Self) instanceID00 = BirdFlockSound.Play(Self)
gotoState("Waiting") gotoState("Waiting")
endEvent endEvent

@ -1,4 +1,4 @@
Scriptname FXDragonBloodDamageScript extends ActiveMagicEffect 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} {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}
;=============================================== ;===============================================
@ -22,7 +22,7 @@ float property HPpctT1 = 0.98 auto
{relative total HP at which first blood should appear DEFAULT: 0.??} {relative total HP at which first blood should appear DEFAULT: 0.??}
float property HPpctT2 = 0.95 auto float property HPpctT2 = 0.95 auto
{relative total HP at which second blood should appear DEFAULT: 0.??} {relative total HP at which second blood should appear DEFAULT: 0.??}
float property HPpctT3 = 0.90auto float property HPpctT3 = 0.90 auto
{relative total HP at which third blood should appear DEFAULT: 0.??} {relative total HP at which third blood should appear DEFAULT: 0.??}
float property HPpctT4 = 0.80 auto float property HPpctT4 = 0.80 auto
{relative total HP at which final blood should appear DEFAULT: "+HPpctT4} {relative total HP at which final blood should appear DEFAULT: "+HPpctT4}
@ -50,311 +50,152 @@ float HPt3
float HPt4 float HPt4
bool bDebug = FALSE bool bDebug = FALSE
;===============================================
EVENT OnEffectStart(Actor Target, Actor Caster) ;2017-01-05 by Taka2nd ========================
;Setup stuff has to go here for activeMagicEffect ;
selfRef = caster ;Nexus ver1.2
; store HP for future use. THis should usually be 100% HP. ;・変数をデフォルトのものに戻す
previousHP = selfRef.getActorValue("health") ;・不要な変数をコメントアウト
; ; debug.TraceConditional("TEST JOEL: Dragon has set previousHP to :"+previousHP, bDebug) ;Nexus ver1.2a
; ; debug.TraceConditional("TEST JOEL: Dragon Blood FX onEffectStart initialized", bDebug) ;・不要な変数をコメントアウトを外す
dragonBloodInit() ;Nexus ver1.2b
ENDEVENT ;・機能していない不要なイベント処理を削除
;
EVENT onLoad() ;
; ; debug.traceConditional("TEST JOEL: Dragon has loaded ("+selfRef+")", bDebug) ;・PlaySubAnimation()の頻繁なエラーおよびエラースタック
endEVENT ;↓
;PlaySubAnimation()へのコマンドが逆行および多重化を起こしていた
EVENT OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) ;→排他制御を行っていなかったのとグローバル変数で計算していたのが原因
;↓
; first intercept to figure out how much damage was done. ;State文によるの排他の追加および変数の見直しにより解決、それにより多少の負荷軽減効果もあり
; ; debug.TraceConditional("||===============================", bDebug) ;
; ; debug.TraceConditional("|| TEST JOEL: DRAGON HP DIAGNOSTIC", bDebug) ;・死亡チェックを追加
; ; debug.TraceConditional("|| TEST JOEL: Dragon previous HP="+previousHP, bDebug) ;・HP計算の不具合→GetActorValuePercentage()に変更
; ; debug.TraceConditional("|| TEST JOEL: Dragon current HP="+selfRef.getActorValue("health"), bDebug) ;
;・PlaySubAnimation()の定期的なエラー、Bleed**を順番通りに実行することで解決
diffHP = previousHP - (selfRef.getActorValue("health")) ;
; ; debug.TraceConditional("|| TEST JOEL: Dragon damaged for "+diffHP+"HP", bDebug) ;
;Entire script rewritten for USLEEP 3.0.10. Used with permission from Taka2nd.
; determine if I was hit in the front/back/left/right
hitAngle = selfRef.GetHeadingAngle(akAggressor) Event OnEffectStart(Actor Target, Actor Caster)
if hitAngle >= -45 && hitAngle <= 45 selfRef = Caster
hitDirection = "FRONT" stateFront = 0
; decrement a fake HP counter for this side of the body stateBack = 0
HPfront = (HPfront - diffHP) stateLeft = 0
endif stateRight = 0
if hitAngle >= 135 || hitAngle <= -135 PreviousHP = 1.0
hitDirection = "BACK" HPfront = 1.0
; decrement a fake HP counter for this side of the body HPback = 1.0
HPback = (HPback - diffHP) HPleft = 1.0
endif HPright = 1.0
if hitAngle < -45 && hitAngle > -135
hitDirection = "LEFT" ;USSEP 4.1.5 for Bug #13547: added this line:
; decrement a fake HP counter for this side of the body USSEP_RegisterForAnimationEvents (selfRef)
HPleft = (HPleft - diffHP) endEvent
endif
if hitAngle > 45 && hitAngle < 135 State __Busy__
hitDirection = "RIGHT" Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
; decrement a fake HP counter for this side of the body endEvent
HPright = (HPright - diffHP) endState
endif
; ; debug.TraceConditional("|| TEST JOEL: Dragon was hit from the "+hitDirection, bDebug)
; ; debug.TraceConditional("|| TEST JOEL: "+hitdirection+" HP = "+HPleft, bDebug)
; ==============================================
; check for updates to blood state
if hitDirection == "FRONT"
int prevStateFront = stateFront
if (HPfront <= HPt1) && (HPfront > HPt2)
stateFront = 1
elseif (HPfront <= HPt2) && (HPfront > HPt3)
stateFront = 2
elseif (HPfront <= HPt3) && (HPfront > HPt4)
stateFront = 3
elseif (HPfront <= HPt4)
stateFront = 4
endif
; see if there was a change in state for this side
if stateFront != prevStateFront
; concatenate and play appropriate blood FX
; ; debug.TraceConditional("|| TEST JOEL: Blood FX State Change: HeadBleed0"+stateFront, bDebug)
selfRef.PlaySubGraphAnimation("HeadBleed0"+stateFront)
endif
endif
if hitDirection == "BACK"
int prevStateback = stateback
if (HPback <= HPt1) && (HPback > HPt2)
stateback = 1
elseif (HPback <= HPt2) && (HPback > HPt3)
stateback = 2
elseif (HPback <= HPt3) && (HPback > HPt4)
stateback = 3
elseif (HPback <= HPt4)
stateback = 4
endif
; see if there was a change in state for this side
if stateback != prevStateback
; concatenate and play appropriate blood FX
; ; debug.TraceConditional("|| TEST JOEL: Blood FX State Change: BackBleed0"+stateback, bDebug)
selfRef.PlaySubGraphAnimation("TailBleed0"+stateback)
endif
endif
if hitDirection == "LEFT"
int prevStateleft = stateleft
if (HPleft <= HPt1) && (HPleft > HPt2)
stateleft = 1
elseif (HPleft <= HPt2) && (HPleft > HPt3)
stateleft = 2
elseif (HPleft <= HPt3) && (HPleft > HPt4)
stateleft = 3
elseif (HPleft <= HPt4)
stateleft = 4
endif
; see if there was a change in state for this side
if stateleft != prevStateleft
; concatenate and play appropriate blood FX
; ; debug.TraceConditional("|| TEST JOEL: Blood FX State Change: WingLBleed0"+stateleft, bDebug)
selfRef.PlaySubGraphAnimation("WingLBleed0"+stateleft)
endif
endif
if hitDirection == "RIGHT"
int prevStateright = stateright
if (HPright <= HPt1) && (HPright > HPt2)
stateright = 1
elseif (HPright <= HPt2) && (HPright > HPt3)
stateright = 2
elseif (HPright <= HPt3) && (HPright > HPt4)
stateright = 3
elseif (HPright <= HPt4)
stateright = 4
endif
; see if there was a change in state for this side
if stateright != prevStateright
; concatenate and play appropriate blood FX
; ; debug.TraceConditional("|| TEST JOEL: Blood FX State Change: WingRBleed0"+stateright, bDebug)
selfRef.PlaySubGraphAnimation("WingRBleed0"+stateright)
endif
endif
; ==============================================
; store our current HP as the previous for accurate maths on future hits.
previousHP = selfRef.getActorValue("health")
if bDebug == TRUE
; ; debug.TraceConditional("|| TEST JOEL: End of onHit()", bDebug)
bDebug = false
debugVars()
endif
endEVENT
; EVENT onDeath(actor myKiller) Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
; utility.wait(8.5)
; selfRef.PlaySubGraphAnimation("BloodFade")
; utility.wait(1.5)
; ENDEVENT
GotoState("__Busy__")
;==================================================================== if !selfRef
; Initialize a bunch of variables return ;OnHit Event Finish
;====================================================================
FUNCTION dragonBloodInit()
; quick safety net to convert percentages if they are entered incorrectly (ie 75% = 0.75)
; ; debug.TraceConditional("convert % values to integers", bDebug)
if HPpctT1 > 1.0 && HPpctT1 < 100
HPpctT1 = HPpctT1*0.01
endif
if HPpctT2 > 1.0 && HPpctT2 < 100
HPpctT2 = HPpctT2*0.01
endif
if HPpctT2 > 1.0 && HPpctT2 < 100
HPpctT2 = HPpctT2*0.01
endif
if HPpctT3 > 1.0 && HPpctT3 < 100
HPpctT3 = HPpctT3*0.01
endif endif
; store hard point values so we don't have to always work in percentages later
HPt1 = HPpctT1 * (selfRef.getBaseAV("health"))
HPt2 = HPpctT2 * (selfRef.getBaseAV("health"))
HPt3 = HPpctT3 * (selfRef.getBaseAV("health"))
HPt4 = HPpctT4 * (selfRef.getBaseAV("health"))
; set fake location HP counters to current(assume full?) HP
HPfront = selfRef.getAV("health")
HPback = selfRef.getAV("health")
HPleft = selfRef.getAV("health")
HPright = selfRef.getAV("health")
if bDebug == TRUE
; ; debug.TraceConditional("|| TEST JOEL : finished Init()", bDebug)
debugVars()
endif
endFUNCTION
FUNCTION debugVars()
; ; debug.TraceConditional("||===============================", bDebug)
; ; debug.TraceConditional("|| DRAGON BLOOD FX VARIABLE READOUT", bDebug)
; ; debug.TraceConditional("|| HPpctT1 = "+HPpctT1, bDebug)
; ; debug.TraceConditional("|| HPpctT2 = "+HPpctT2, bDebug)
; ; debug.TraceConditional("|| HPpctT3 = "+HPpctT3, bDebug)
; ; debug.TraceConditional("|| HPpctT4 = "+HPpctT4, bDebug)
; ; debug.TraceConditional("|| HPFront = "+HPFront, bDebug)
; ; debug.TraceConditional("|| HPBack = "+HPBack, bDebug)
; ; debug.TraceConditional("|| HPLeft = "+HPLeft, bDebug)
; ; debug.TraceConditional("|| HPRight = "+HPRight, bDebug)
; ; debug.TraceConditional("|| stateFront = "+stateFront, bDebug)
; ; debug.TraceConditional("|| stateBack = "+stateBack, bDebug)
; ; debug.TraceConditional("|| stateLeft = "+stateLeft, bDebug)
; ; debug.TraceConditional("|| stateRight = "+stateRight, bDebug)
; ; debug.TraceConditional("|| HPt1 = "+HPt1, bDebug)
; ; debug.TraceConditional("|| HPt2 = "+HPt2, bDebug)
; ; debug.TraceConditional("|| HPt3 = "+HPt3, bDebug)
; ; debug.TraceConditional("|| HPt4 = "+HPt4, bDebug)
endFUNCTION
if akAggressor
STATE markSTATE float fCurrentHP = selfRef.GetActorValuePercentage("health")
if fCurrentHP <= 0
return ;OnHit Event Finish
endif
Event OnLoad() float fDiffHP = PreviousHP - fCurrentHP
; ;Debug.Trace("This dragon is loaded, playing animations should work now") if fDiffHP > 0
PreviousHP = fCurrentHP
float fHitAngle = selfRef.GetHeadingAngle(akAggressor)
;FRONT
if fHitAngle >= -45 && fHitAngle <= 45
HPfront -= fDiffHP
if GetBleedState(HPfront) > stateFront
stateFront += 1
selfRef.PlaySubGraphAnimation("HeadBleed0" + stateFront)
endif
;BACK
elseif fHitAngle >= 135 || fHitAngle <= -135
HPback -= fDiffHP
if GetBleedState(HPback) > stateBack
stateBack += 1
selfRef.PlaySubGraphAnimation("TailBleed0" + stateBack)
endif
;LEFT
elseif fHitAngle < 0
HPleft -= fDiffHP
if GetBleedState(HPleft) > stateLeft
stateLeft += 1
selfRef.PlaySubGraphAnimation("WingLBleed0" + stateLeft)
endif
;RIGHT
else
HPright -= fDiffHP
if GetBleedState(HPright) > stateRight
stateRight += 1
selfRef.PlaySubGraphAnimation("WingRBleed0" + stateRight)
endif
endif
endEvent endif
EVENT OnEffectStart(Actor Target, Actor Caster) endif
;Play your particles.
selfRef = caster
dragonHealth = selfRef.GetAV("Health") as int
ENDEVENT
;Debug.Trace("OnHit : akAggressor=" + akAggressor + " : akSource=" + akSource + " (" + akSource.GetType() + ") : akProjectile=" + akProjectile)
GotoState("")
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) endEVENT
dragonHealth = selfRef.GetAV("Health") as int
; ; Debug.TraceConditional("Dragon's health is" + dragonHealth, bDebug)
hitAngle = selfRef.GetHeadingAngle(akAggressor)
if hitAngle >= -45 && hitAngle <= 45
; ; Debug.TraceConditional(akAggressor + " angle is " + hitAngle, bDebug)
; ; Debug.TraceConditional("Dragon was hit in front", bDebug)
hitDirection = 0
frontBloodStepper = frontBloodStepper + 1
elseIf hitAngle > 45 && hitAngle < 135
; ; Debug.TraceConditional(akAggressor + " angle is " + hitAngle, bDebug)
; ; Debug.TraceConditional("Dragon was hit on right", bDebug)
hitDirection = 1
rightBloodStepper = rightBloodStepper + 1
elseIf hitAngle >= 135 || hitAngle <= -135
; ; Debug.TraceConditional(akAggressor + " angle is " + hitAngle, bDebug)
; ; Debug.TraceConditional("Dragon was hit in back", bDebug)
hitDirection = 2
backBloodStepper = backBloodStepper + 1
elseIf hitAngle < -45 && hitAngle > -135
; ; Debug.TraceConditional(akAggressor + " angle is " + hitAngle, bDebug)
; ; Debug.TraceConditional("Dragon was hit on left", bDebug)
hitDirection = 3
leftBloodStepper = leftBloodStepper + 1
endif
if hitDirection == 0
if frontBloodStepper <= 4
; ; Debug.TraceConditional("Dragon head blood stage0" + frontBloodStepper, bDebug)
selfRef.PlaySubGraphAnimation("HeadBleed0" + frontBloodStepper)
endif
elseif hitDirection == 1
if rightBloodStepper <= 4
; ; Debug.TraceConditional("Dragon wing r blood stage0" + rightBloodStepper, bDebug)
selfRef.PlaySubGraphAnimation("WingRBleed0" + rightBloodStepper)
endif
elseif hitDirection == 2
if backBloodStepper <= 4
; ; Debug.TraceConditional("Dragon back blood stage0" + backBloodStepper, bDebug)
selfRef.PlaySubGraphAnimation("TailBleed0" + backBloodStepper)
endif
elseif hitDirection == 3
if leftBloodStepper <= 4
; ; Debug.TraceConditional("Dragon wing l blood stage0" + leftBloodStepper, bDebug)
selfRef.PlaySubGraphAnimation("WingLBleed0" + leftBloodStepper)
endif
endif
int FUNCTION GetBleedState(float fHP)
ENDEVENT if fHP > HPpctT1
return 0
elseif fHP > HPpctT2
EVENT onDeath(actor myKiller) return 1
elseif fHP > HPpctT3
return 2
elseif fHP > HPpctT4
return 3
endif
return 4
endFUNCTION
; selfRef.UnequipItem(ChaurusSpitSkin) ;-----------------------------------------------------------------
; Added by USSEP 4.1.5 for Bug #13547:
ENDEVENT ;-----------------------------------------------------------------
endSTATE
Event OnAnimationEvent (ObjectReference akSource, string asEventName)
;do nothing
EndEvent
function USSEP_RegisterForAnimationEvents (actor dragonRef)
if dragonRef
RegisterForAnimationEvent (dragonRef, "HeadBleed01")
RegisterForAnimationEvent (dragonRef, "HeadBleed02")
RegisterForAnimationEvent (dragonRef, "HeadBleed03")
RegisterForAnimationEvent (dragonRef, "HeadBleed04")
RegisterForAnimationEvent (dragonRef, "TailBleed01")
RegisterForAnimationEvent (dragonRef, "TailBleed02")
RegisterForAnimationEvent (dragonRef, "TailBleed03")
RegisterForAnimationEvent (dragonRef, "TailBleed04")
RegisterForAnimationEvent (dragonRef, "WingLBleed01")
RegisterForAnimationEvent (dragonRef, "WingLBleed02")
RegisterForAnimationEvent (dragonRef, "WingLBleed03")
RegisterForAnimationEvent (dragonRef, "WingLBleed04")
RegisterForAnimationEvent (dragonRef, "WingRBleed01")
RegisterForAnimationEvent (dragonRef, "WingRBleed02")
RegisterForAnimationEvent (dragonRef, "WingRBleed03")
RegisterForAnimationEvent (dragonRef, "WingRBleed04")
endif
endFunction

@ -23,7 +23,15 @@ weapon property Bow auto
EVENT OnEffectStart(Actor Target, Actor Caster) EVENT OnEffectStart(Actor Target, Actor Caster)
selfRef = caster selfRef = caster
;Added by USKP to prevent this effect from appearing on the player.
If selfRef == Game.GetPlayer()
Dispel()
return
EndIf
myActorBase = caster.GetLeveledActorBase() myActorBase = caster.GetLeveledActorBase()
;add darkened area fx to all magic draugr ;add darkened area fx to all magic draugr
FXMagicDraugrDarkeningEffect.Play(selfRef, -1) FXMagicDraugrDarkeningEffect.Play(selfRef, -1)
@ -50,6 +58,7 @@ weapon property Bow auto
ENDEVENT ENDEVENT
Event OnEffectFinish(Actor akTarget, Actor akCaster) Event OnEffectFinish(Actor akTarget, Actor akCaster)
FXMagicDraugrDarkeningEffect.Stop(selfRef) FXMagicDraugrDarkeningEffect.Stop(selfRef)
if myActorBase.GetSex() == 0 if myActorBase.GetSex() == 0
;Play glow art ;Play glow art
@ -71,7 +80,7 @@ weapon property Bow auto
endEvent endEvent
EVENT onDying(actor myKiller) EVENT onDying(actor myKiller)
;DraugrMaleEyeGlowFX.Stop(selfRef) ;DraugrMaleEyeGlowFX.Stop(selfRef)
;DraugrFemaleEyeGlowFX.Stop(selfRef) ;DraugrFemaleEyeGlowFX.Stop(selfRef)
FXMagicDraugrDarkeningEffect.Stop(selfRef) FXMagicDraugrDarkeningEffect.Stop(selfRef)

@ -12,7 +12,15 @@ VisualEffect Property FXDwarvenCenturionArm02 Auto
int test int test
EVENT OnEffectStart(Actor Target, Actor Caster) EVENT OnEffectStart(Actor Target, Actor Caster)
selfRef = caster selfRef = caster
;Added by USKP to prevent this effect from appearing on the player.
If selfRef == Game.GetPlayer()
Dispel()
return
EndIf
if (selfRef.GetSleepState() == 3) if (selfRef.GetSleepState() == 3)
; Debug.Trace("Dwarven cent is sleeping! 3") ; Debug.Trace("Dwarven cent is sleeping! 3")
selfRef.PlaySubGraphAnimation( "StopEffect" ) selfRef.PlaySubGraphAnimation( "StopEffect" )
@ -24,6 +32,12 @@ int test
ENDEVENT ENDEVENT
Event OnGetUp(ObjectReference akFurniture) Event OnGetUp(ObjectReference akFurniture)
;Added by USKP to prevent this effect from appearing on the player.
If selfRef == Game.GetPlayer()
Dispel()
return
EndIf
; Debug.Trace("Dwarven cent just got up from " ) ; Debug.Trace("Dwarven cent just got up from " )
FXDwarvenCenturion.Play(selfRef, -1) FXDwarvenCenturion.Play(selfRef, -1)
FXDwarvenCenturionArm01.Play(selfRef, -1) FXDwarvenCenturionArm01.Play(selfRef, -1)

@ -10,7 +10,16 @@ VisualEffect Property FXDwarvenSphereEffect Auto
EVENT OnEffectStart(Actor Target, Actor Caster) EVENT OnEffectStart(Actor Target, Actor Caster)
selfRef = caster selfRef = caster
FXDwarvenSphereEffect.Play(selfRef, -1)
;Added by USKP to prevent this effect from appearing on the player.
If selfRef == Game.GetPlayer()
Dispel()
return
EndIf
if( selfRef.Is3DLoaded() ) ; 3D check added by USKP 2.0 - triggers errors without it.
FXDwarvenSphereEffect.Play(selfRef, -1)
EndIf
ENDEVENT ENDEVENT
Event OnEffectFinish(Actor akTarget, Actor akCaster) Event OnEffectFinish(Actor akTarget, Actor akCaster)

@ -13,7 +13,17 @@ Explosion Property ExplosionDwarvenSpider Auto
EVENT OnEffectStart(Actor Target, Actor Caster) EVENT OnEffectStart(Actor Target, Actor Caster)
selfRef = caster selfRef = caster
FXDwarvenSpiderEffect.Play(selfRef, -1)
;Added by USKP to prevent this effect from appearing on the player.
If selfRef == Game.GetPlayer()
Dispel()
return
EndIf
;USKP 2.0.3 - 3D check for shaders.
if( selfRef.Is3DLoaded() )
FXDwarvenSpiderEffect.Play(selfRef, -1)
EndIf
ENDEVENT ENDEVENT
Event OnEffectFinish(Actor akTarget, Actor akCaster) Event OnEffectFinish(Actor akTarget, Actor akCaster)

@ -30,7 +30,7 @@ state playing
; patch 1.9: ; patch 1.9:
event OnCellDetach() event OnCellDetach()
debug.trace(self + "playing: OnCellDetach - enable trigger") ; debug.trace(self + "playing: OnCellDetach - enable trigger")
WordTrigger.Enable() WordTrigger.Enable()
gotoState("waiting") gotoState("waiting")
endEvent endEvent

@ -34,6 +34,11 @@ int doWhileLoop
endif endif
;Loop to change variable over time ;Loop to change variable over time
while doWhileLoop == 1 while doWhileLoop == 1
;USKP 1.3.3 - Bail out of this loop if 3D becomes unloaded.
if( !Is3DLoaded() )
doWhileLoop = 0
EndIf
myRandom = utility.RandomFloat(myfToggleBlendRageMin,myfToggleBlendRageMax) myRandom = utility.RandomFloat(myfToggleBlendRageMin,myfToggleBlendRageMax)
SetAnimationVariableFloat("fToggleBlend", myRandom) SetAnimationVariableFloat("fToggleBlend", myRandom)
myWaitTime = utility.RandomFloat(waitTimeMin,waitTimeMax) myWaitTime = utility.RandomFloat(waitTimeMin,waitTimeMax)

@ -10,6 +10,13 @@ Actor selfRef
EVENT OnEffectStart(Actor Target, Actor Caster) EVENT OnEffectStart(Actor Target, Actor Caster)
selfRef = caster selfRef = caster
;Added by USKP to prevent this effect from appearing on the player.
If selfRef == Game.GetPlayer()
Dispel()
return
EndIf
FXNecroSkeletonMultiEffect.play(selfRef, -1) FXNecroSkeletonMultiEffect.play(selfRef, -1)
FXSkeletonNecroEyeGlowEffect.play(selfRef, -1) FXSkeletonNecroEyeGlowEffect.play(selfRef, -1)
ENDEVENT ENDEVENT

@ -8,8 +8,16 @@ ObjectReference myGlow
EVENT OnEffectStart(Actor Target, Actor Caster) EVENT OnEffectStart(Actor Target, Actor Caster)
selfRef = caster selfRef = caster
;USKP 2.0.1 - Stop this from attaching to the player.
if( selfRef == Game.GetPlayer() )
Return
EndIf
;float myScale = selfRef.getScale() ;float myScale = selfRef.getScale()
; ;debug.trace("my scale is" + myScale) ; ;debug.trace("my scale is" + myScale)
;USKP 2.0.2 - Delay the effect to let 3D catch up.
Utility.Wait(1.0)
myGlow = FXSovengardeGlowEffect.play(selfRef, -1) myGlow = FXSovengardeGlowEffect.play(selfRef, -1)
;myGlow.setScale(myScale) ;myGlow.setScale(myScale)
SovengardeFXS.Play(selfRef) SovengardeFXS.Play(selfRef)

@ -23,12 +23,22 @@ Activator property AshPileObject auto
{The object we use as a pile.} {The object we use as a pile.}
EVENT OnEffectStart(Actor Target, Actor Caster) EVENT OnEffectStart(Actor Target, Actor Caster)
selfRef = caster selfRef = caster
selfRef.setScale(RandomFloat(scaleRangeMin, scaleRangeMax))
IceWraithParticles01.Play(selfRef, -1) ;Added by USKP to prevent this effect from appearing on the player.
If selfRef == Game.GetPlayer()
Dispel()
return
EndIf
;USKP 2.0.3 - 3D check, shaders, etc
if( selfRef.Is3DLoaded() )
selfRef.setScale(RandomFloat(scaleRangeMin, scaleRangeMax))
IceWraithParticles01.Play(selfRef, -1)
FXIceWraith2ndFormEffect.play(selfRef, -1)
EndIf
selfRef.EquipItem(SkinIceWraithSmokeFins) selfRef.EquipItem(SkinIceWraithSmokeFins)
FXIceWraith2ndFormEffect.play(selfRef, -1)
registerForAnimationEvent(selfRef, GroundDiveIceHazard) registerForAnimationEvent(selfRef, GroundDiveIceHazard)
registerForAnimationEvent(selfRef, ChangeForms) registerForAnimationEvent(selfRef, ChangeForms)
ENDEVENT ENDEVENT
@ -53,6 +63,7 @@ Activator property AshPileObject auto
endEVENT endEVENT
EVENT onDying(actor myKiller) EVENT onDying(actor myKiller)
IceWraithParticles01.Stop(selfRef) IceWraithParticles01.Stop(selfRef)
FXIceWraith2ndFormEffect.stop(selfRef) FXIceWraith2ndFormEffect.stop(selfRef)
selfRef.unEquipItem(SkinIceWraithSmokeFins) selfRef.unEquipItem(SkinIceWraithSmokeFins)

@ -44,7 +44,7 @@ bool TargetIsImmune = True
Event OnEffectStart(Actor Target, Actor Caster) Event OnEffectStart(Actor Target, Actor Caster)
victim = target victim = target
; DeadAlready = Victim.IsDead() ; DeadAlready = Victim.IsDead()
trace("victim == " + victim + ", is this right?") ;trace("victim == " + victim + ", is this right?")
EndEvent EndEvent
@ -66,7 +66,7 @@ Event OnDying(Actor Killer)
endif endif
if TargetIsImmune == False if TargetIsImmune == False
trace("victim just died") ;trace("victim just died")
; DeadAlready = true ; DeadAlready = true
victim.SetCriticalStage(Victim.CritStage_DisintegrateStart) victim.SetCriticalStage(Victim.CritStage_DisintegrateStart)
;victim.SetAlpha (0.99,False) ;victim.SetAlpha (0.99,False)

@ -28,13 +28,16 @@ Float Property fDuration = 0.1 auto
;=============/ ;=============/
Event OnEffectFinish(Actor Target, Actor Caster) Event OnEffectFinish(Actor Target, Actor Caster)
if EffectShaderFX01 != None ;USKP 2.0.1 - Can't play stuff if 3D isn't loaded.
EffectShaderFX01.Play(Target,fDuration) if( Target.Is3DLoaded() )
endif if EffectShaderFX01 != None
if EffectShaderFX02 != None EffectShaderFX01.Play(Target,fDuration)
EffectShaderFX02.Play(Target,fDuration) endif
endif if EffectShaderFX02 != None
if EffectShaderFX03 != None EffectShaderFX02.Play(Target,fDuration)
EffectShaderFX03.Play(Target,fDuration) endif
endif if EffectShaderFX03 != None
EffectShaderFX03.Play(Target,fDuration)
endif
EndIf
EndEvent EndEvent

@ -6,8 +6,7 @@ Scriptname PF_CarryFirewood_000D97FA Extends Package Hidden
Function Fragment_2(Actor akActor) Function Fragment_2(Actor akActor)
;BEGIN CODE ;BEGIN CODE
; ; debug.trace(self + " OnEnd") ; ; debug.trace(self + " OnEnd")
;ObjectReference meRef = akActor as ObjectReference ;(akActor as CarryActorScript).ChangeCarryState(false)
;(meRef as CarryActorScript).ChangeCarryState(false)
;END CODE ;END CODE
EndFunction EndFunction
;END FRAGMENT ;END FRAGMENT
@ -16,8 +15,8 @@ EndFunction
Function Fragment_1(Actor akActor) Function Fragment_1(Actor akActor)
;BEGIN CODE ;BEGIN CODE
; ; debug.trace(self + " OnChange") ; ; debug.trace(self + " OnChange")
ObjectReference meRef = akActor as ObjectReference ;USKP 2.0.1 - Properly handling itself as an Actor now.
(meRef as CarryActorScript).ChangeCarryState(false) (akActor as CarryActorScript).ChangeCarryState(false)
;END CODE ;END CODE
EndFunction EndFunction
;END FRAGMENT ;END FRAGMENT
@ -26,8 +25,8 @@ EndFunction
Function Fragment_3(Actor akActor) Function Fragment_3(Actor akActor)
;BEGIN CODE ;BEGIN CODE
; ; debug.trace(self + " OnBegin") ; ; debug.trace(self + " OnBegin")
ObjectReference meRef = akActor as ObjectReference ;USKP 2.0.1 - Properly handling itself as an Actor now.
(meRef as CarryActorScript).ChangeCarryState(true) (akActor as CarryActorScript).ChangeCarryState(true)
;END CODE ;END CODE
EndFunction EndFunction
;END FRAGMENT ;END FRAGMENT

@ -20,7 +20,7 @@ endEVENT
EVENT OnActivate(ObjectReference TriggerRef) EVENT OnActivate(ObjectReference TriggerRef)
Trace("DARYL - " + self + " I've been activated, opening container: " + ShelfContainer) ;Trace("DARYL - " + self + " I've been activated, opening container: " + ShelfContainer)
ShelfContainer.Activate(Game.GetPlayer(), FALSE) ShelfContainer.Activate(Game.GetPlayer(), FALSE)
endEVENT endEVENT

@ -1,4 +1,5 @@
Scriptname PlayerBookShelfContainerScript extends ObjectReference Scriptname PlayerBookShelfContainerScript extends ObjectReference
{This script has been overhauled to fix several issues listed in USLEEP 3.0.1 - Bug #19515. This overhaul was contributed by Adria.}
import debug import debug
import utility import utility
@ -133,6 +134,7 @@ GlobalVariable Property BookShelfGlobal Auto
{Global showing whether or not the player has ever activated a bookshelf} {Global showing whether or not the player has ever activated a bookshelf}
EVENT OnCellLoad() EVENT OnCellLoad()
if AlreadyLoaded == FALSE if AlreadyLoaded == FALSE
;Trace("BOOKCASE - Running OnCellLoad()") ;Trace("BOOKCASE - Running OnCellLoad()")
@ -164,13 +166,23 @@ EVENT OnCellLoad()
AlreadyLoaded = TRUE AlreadyLoaded = TRUE
endif endif
endEVENT
; Check if this shelf has already been messed up by vanilla bug, and issue a warning in a log.
; Actual healing process will trigger when all books are removed from the display shelf.
;if !(CurrentBookAmount >= 0 && CurrentBookAmount <= MaxBooksAllowed && CurrentBookAmount == NumBooksOnShelf())
; Trace("BookShelfFix - An inconsistent bookshelf " + self + " found in " + self.GetCurrentLocation() + ", fix will be applied when you pull out all the books from the shelf.")
;endif
endEVENT
EVENT OnActivate(ObjectReference akActionRef) EVENT OnActivate(ObjectReference akActionRef)
; Removing all items from container as a precaution ; Removing all items from container as a precaution
;Trace("BOOKCASE - I've been ACTIVATED!") ;Trace("BOOKCASE - I've been ACTIVATED!")
;USLEEP 3.0.1 - Bug #19515
CleanInvalidPlacedBooks()
CurrentBookAmount = NumBooksOnShelf()
BlockActivate() BlockActivate()
;Trace("BOOKCASE - Blocking activate on all books") ;Trace("BOOKCASE - Blocking activate on all books")
;Trace("BOOKCASE - BookShelfTrigger01Ref = " + BookShelfTrigger01Ref) ;Trace("BOOKCASE - BookShelfTrigger01Ref = " + BookShelfTrigger01Ref)
@ -202,6 +214,17 @@ EVENT OnActivate(ObjectReference akActionRef)
Wait(0.25) Wait(0.25)
; The following will fire when the player leaves inventory ; The following will fire when the player leaves inventory
;USLEEP 3.0.1 - Bug #19515
; When display shelf becomes empty, reset it to fix corrupted shelves
if NumBooksOnShelf() == 0
RemoveAllItems(akTransferTo = Game.GetPlayer(), abRemoveQuestItems = true) ; make sure all the books are transfered into player's inventory
ClearDisplayShelf()
Wait(0.25) ; wait until RemoveAllItems() is (hopefully) done
CurrentBookAmount = 0
;Trace("BookShelfFix - Cleaned up bookshelf " + self + ". This is not an error.")
endif
;Trace("BOOKCASE - Out of Inventory so placing all the books") ;Trace("BOOKCASE - Out of Inventory so placing all the books")
UpdateBooks() UpdateBooks()
@ -394,7 +417,8 @@ endFunction
Function RemoveBooks(Form BookBase, Int BookAmount) Function RemoveBooks(Form BookBase, Int BookAmount)
; Find an empty book form and place the new book there ; Find the removed book form(s) and remove it from the display
While BookAmount > 0 While BookAmount > 0
if PlacedBook01 == BookBase if PlacedBook01 == BookBase
;Trace("BOOKCASE - PlacedBook01 matches, Removing this book") ;Trace("BOOKCASE - PlacedBook01 matches, Removing this book")
@ -515,7 +539,7 @@ Function AddBooks(Form BookBase, Int BookAmount)
;Trace("BOOKCASE - PlacedBook18 is empty, placing book there") ;Trace("BOOKCASE - PlacedBook18 is empty, placing book there")
PlacedBook18 = BookBase PlacedBook18 = BookBase
endif endif
BookAmount = BookAmount - 1 BookAmount = BookAmount - 1
endWhile endWhile
@ -572,7 +596,8 @@ ObjectReference Function UpdateSingleBook(Form TargetBook, ObjectReference Place
; Note - it would be more efficient to move the book to its home position if the desired ; Note - it would be more efficient to move the book to its home position if the desired
; book matches the placed book, but MoveTo doesn't work correctly with multi-part dynamic ; book matches the placed book, but MoveTo doesn't work correctly with multi-part dynamic
; objects. So we sidestep the issue by always deleting and placing ; objects. So we sidestep the issue by always deleting and placing
if PlacedBookRef ;USLEEP 3.0.1 - Bug #19515 added form ID check here.
if PlacedBookRef && PlacedBookRef.GetFormID()
PlacedBookRef.Disable() PlacedBookRef.Disable()
PlacedBookRef.Delete() PlacedBookRef.Delete()
endIf endIf
@ -613,9 +638,373 @@ Function UpdateBooks()
GoToState("") ; Now allow books to be updated again GoToState("") ; Now allow books to be updated again
EndFunction EndFunction
State PlacingBooks State PlacingBooks
Function UpdateBooks() Function UpdateBooks()
; Already updating books, so ignore ; Already updating books, so ignore
EndFunction EndFunction
EndState EndState
;
; ;USLEEP 3.0.1 - Bug #19515: Everything past this point is new stuff to support fixing the bookshelf containers.
;
Function PickUp(ObjectReference BookRef)
;Trace("BookShelfFix " + self + " PickUp() - " + BookRef + ", Base = " + BookRef.GetBaseObject())
if (BookRef && BookRef.GetBaseObject() as Book)
; Remove a display book first
if RemoveBookByRef(BookRef)
GoToState("PickingUp")
; Then remove a book in container
self.RemoveItem(BookRef.GetBaseObject(), 1)
Wait(0.25) ; wait for OnItemRemoved() event to fire
GoToState("")
endif
endIf
EndFunction
State PickingUp
; Used when a book has been picked up directly from the display
Event OnBeginState() ; You Shall Not Pass!
self.BlockActivation(True)
BlockActivate()
;Trace("BookShelfFix " + self + " PickingUp State - Entered State")
EndEvent
Event OnActivate(ObjectReference akActionRef)
EndEvent
Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
;Trace("BookShelfFix " + self + " PickingUp State - Item " + akBaseItem + " removed from shelf inventory")
CurrentBookAmount -= aiItemCount
EndEvent
Event OnEndState()
;Trace("BookShelfFix " + self + " PickingUp State - Leaving State")
UnblockActivate()
self.BlockActivation(False)
EndEvent
EndState
Bool Function RemoveBookByRef(ObjectReference BookRef)
; If the book had been picked up directly, and if there were multiple copies of it on the shelf,
; we need to determine the exact location of the book rather than the first copy in a list.
; Returns True if BookRef has been successfully dismembered from the list or False when the book was missing
if !BookRef
return False
endif
int BookRefID = BookRef.GetFormID()
; These references could be a derivative of ObjectReference such as DefaultSetStageOnPlayerAcquireItem
; and would never match even if they were cast into ObjectReference, so compare their FormIDs rather than comparing them directly.
if PlacedBook01Ref && PlacedBook01Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook01 matches, Removing this book")
PlacedBook01 = EmptyForm
PlacedBook01Ref = EmptyRef
elseif PlacedBook02Ref && PlacedBook02Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook02 matches, Removing this book")
PlacedBook02 = EmptyForm
PlacedBook02Ref = EmptyRef
elseif PlacedBook03Ref && PlacedBook03Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook03 matches, Removing this book")
PlacedBook03 = EmptyForm
PlacedBook03Ref = EmptyRef
elseif PlacedBook04Ref && PlacedBook04Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook04 matches, Removing this book")
PlacedBook04 = EmptyForm
PlacedBook04Ref = EmptyRef
elseif PlacedBook05Ref && PlacedBook05Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook05 matches, Removing this book")
PlacedBook05 = EmptyForm
PlacedBook05Ref = EmptyRef
elseif PlacedBook06Ref && PlacedBook06Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook06 matches, Removing this book")
PlacedBook06 = EmptyForm
PlacedBook06Ref = EmptyRef
elseif PlacedBook07Ref && PlacedBook07Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook07 matches, Removing this book")
PlacedBook07 = EmptyForm
PlacedBook07Ref = EmptyRef
elseif PlacedBook08Ref && PlacedBook08Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook08 matches, Removing this book")
PlacedBook08 = EmptyForm
PlacedBook08Ref = EmptyRef
elseif PlacedBook09Ref && PlacedBook09Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook09 matches, Removing this book")
PlacedBook09 = EmptyForm
PlacedBook09Ref = EmptyRef
elseif PlacedBook10Ref && PlacedBook10Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook10 matches, Removing this book")
PlacedBook10 = EmptyForm
PlacedBook10Ref = EmptyRef
elseif PlacedBook11Ref && PlacedBook11Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook11 matches, Removing this book")
PlacedBook11 = EmptyForm
PlacedBook11Ref = EmptyRef
elseif PlacedBook12Ref && PlacedBook12Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook12 matches, Removing this book")
PlacedBook12 = EmptyForm
PlacedBook12Ref = EmptyRef
elseif PlacedBook13Ref && PlacedBook13Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook13 matches, Removing this book")
PlacedBook13 = EmptyForm
PlacedBook13Ref = EmptyRef
elseif PlacedBook14Ref && PlacedBook14Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook14 matches, Removing this book")
PlacedBook14 = EmptyForm
PlacedBook14Ref = EmptyRef
elseif PlacedBook15Ref && PlacedBook15Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook15 matches, Removing this book")
PlacedBook15 = EmptyForm
PlacedBook15Ref = EmptyRef
elseif PlacedBook16Ref && PlacedBook16Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook16 matches, Removing this book")
PlacedBook16 = EmptyForm
PlacedBook16Ref = EmptyRef
elseif PlacedBook17Ref && PlacedBook17Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook17 matches, Removing this book")
PlacedBook17 = EmptyForm
PlacedBook17Ref = EmptyRef
elseif PlacedBook18Ref && PlacedBook18Ref.GetFormID() == BookRefID
;Trace("BookShelfFix RemoveBookByRef() - PlacedBook18 matches, Removing this book")
PlacedBook18 = EmptyForm
PlacedBook18Ref = EmptyRef
else
return False
endif
return True
EndFunction
Int Function NumBooksOnShelf()
; Count number of books displayed on shelf (not ones kept in inventory)
int bookCnt = 0
Form[] PlacedBookAr = new Form[18]
PlacedBookAr[0] = PlacedBook01
PlacedBookAr[1] = PlacedBook02
PlacedBookAr[2] = PlacedBook03
PlacedBookAr[3] = PlacedBook04
PlacedBookAr[4] = PlacedBook05
PlacedBookAr[5] = PlacedBook06
PlacedBookAr[6] = PlacedBook07
PlacedBookAr[7] = PlacedBook08
PlacedBookAr[8] = PlacedBook09
PlacedBookAr[9] = PlacedBook10
PlacedBookAr[10] = PlacedBook11
PlacedBookAr[11] = PlacedBook12
PlacedBookAr[12] = PlacedBook13
PlacedBookAr[13] = PlacedBook14
PlacedBookAr[14] = PlacedBook15
PlacedBookAr[15] = PlacedBook16
PlacedBookAr[16] = PlacedBook17
PlacedBookAr[17] = PlacedBook18
int i = 0
while (i < MaxBooksAllowed && i < 18)
if PlacedBookAr[i]
bookCnt += 1
endif
i += 1
endwhile
; Note that number of books in inventory could NOT match this number due to bugs in vanilla script
return bookCnt
EndFunction
Function ClearDisplayShelf()
; Clear BaseID row for display shelf and give back any books in incorrect slots to player
ObjectReference player = Game.GetPlayer()
;Trace("BookShelfFix - ClearDisplayShelf()")
if (MaxBooksAllowed < 1 && PlacedBook01)
player.AddItem(PlacedBook01, 1, true)
endif
if (MaxBooksAllowed < 2 && PlacedBook02)
player.AddItem(PlacedBook02, 1, true)
endif
if (MaxBooksAllowed < 3 && PlacedBook03)
player.AddItem(PlacedBook03, 1, true)
endif
if (MaxBooksAllowed < 4 && PlacedBook04)
player.AddItem(PlacedBook04, 1, true)
endif
if (MaxBooksAllowed < 5 && PlacedBook05)
player.AddItem(PlacedBook05, 1, true)
endif
if (MaxBooksAllowed < 6 && PlacedBook06)
player.AddItem(PlacedBook06, 1, true)
endif
if (MaxBooksAllowed < 7 && PlacedBook07)
player.AddItem(PlacedBook07, 1, true)
endif
if (MaxBooksAllowed < 8 && PlacedBook08)
player.AddItem(PlacedBook08, 1, true)
endif
if (MaxBooksAllowed < 9 && PlacedBook09)
player.AddItem(PlacedBook09, 1, true)
endif
if (MaxBooksAllowed < 10 && PlacedBook10)
player.AddItem(PlacedBook10, 1, true)
endif
if (MaxBooksAllowed < 11 && PlacedBook11)
player.AddItem(PlacedBook11, 1, true)
endif
if (MaxBooksAllowed < 12 && PlacedBook12)
player.AddItem(PlacedBook12, 1, true)
endif
if (MaxBooksAllowed < 13 && PlacedBook13)
player.AddItem(PlacedBook13, 1, true)
endif
if (MaxBooksAllowed < 14 && PlacedBook14)
player.AddItem(PlacedBook14, 1, true)
endif
if (MaxBooksAllowed < 15 && PlacedBook15)
player.AddItem(PlacedBook15, 1, true)
endif
if (MaxBooksAllowed < 16 && PlacedBook16)
player.AddItem(PlacedBook16, 1, true)
endif
if (MaxBooksAllowed < 17 && PlacedBook17)
player.AddItem(PlacedBook17, 1, true)
endif
if (MaxBooksAllowed < 18 && PlacedBook18)
player.AddItem(PlacedBook18, 1, true)
endif
PlacedBook01 = EmptyForm
PlacedBook02 = EmptyForm
PlacedBook03 = EmptyForm
PlacedBook04 = EmptyForm
PlacedBook05 = EmptyForm
PlacedBook06 = EmptyForm
PlacedBook07 = EmptyForm
PlacedBook08 = EmptyForm
PlacedBook09 = EmptyForm
PlacedBook10 = EmptyForm
PlacedBook11 = EmptyForm
PlacedBook12 = EmptyForm
PlacedBook13 = EmptyForm
PlacedBook14 = EmptyForm
PlacedBook15 = EmptyForm
PlacedBook16 = EmptyForm
PlacedBook17 = EmptyForm
PlacedBook18 = EmptyForm
EndFunction
Function CleanInvalidPlacedBooks()
; Clean invalid (nonexistent) forms off PlacedBook**. Invalid forms may be resulted in removed mods.
; Cleaning them will prevent them from eating up PlacedBook slots permanently.
if !(PlacedBook01 && PlacedBook01.GetFormID()) ; nonexistent forms are still cast into True, but their ID are always 0
PlacedBook01 = EmptyForm
endif
if !(PlacedBook02 && PlacedBook02.GetFormID())
PlacedBook02 = EmptyForm
endif
if !(PlacedBook03 && PlacedBook03.GetFormID())
PlacedBook03 = EmptyForm
endif
if !(PlacedBook04 && PlacedBook04.GetFormID())
PlacedBook04 = EmptyForm
endif
if !(PlacedBook05 && PlacedBook05.GetFormID())
PlacedBook05 = EmptyForm
endif
if !(PlacedBook06 && PlacedBook06.GetFormID())
PlacedBook06 = EmptyForm
endif
if !(PlacedBook07 && PlacedBook07.GetFormID())
PlacedBook07 = EmptyForm
endif
if !(PlacedBook08 && PlacedBook08.GetFormID())
PlacedBook08 = EmptyForm
endif
if !(PlacedBook09 && PlacedBook09.GetFormID())
PlacedBook09 = EmptyForm
endif
if !(PlacedBook10 && PlacedBook10.GetFormID())
PlacedBook10 = EmptyForm
endif
if !(PlacedBook11 && PlacedBook11.GetFormID())
PlacedBook11 = EmptyForm
endif
if !(PlacedBook12 && PlacedBook12.GetFormID())
PlacedBook12 = EmptyForm
endif
if !(PlacedBook13 && PlacedBook13.GetFormID())
PlacedBook13 = EmptyForm
endif
if !(PlacedBook14 && PlacedBook14.GetFormID())
PlacedBook14 = EmptyForm
endif
if !(PlacedBook15 && PlacedBook15.GetFormID())
PlacedBook15 = EmptyForm
endif
if !(PlacedBook16 && PlacedBook16.GetFormID())
PlacedBook16 = EmptyForm
endif
if !(PlacedBook17 && PlacedBook17.GetFormID())
PlacedBook17 = EmptyForm
endif
if !(PlacedBook18 && PlacedBook18.GetFormID())
PlacedBook18 = EmptyForm
endif
EndFunction
;USSEP 4.1.5 Bug #13862 - Added to reset all bookshelf form and reference pointers after the chest has been dumped by the prefabs script.
Function USSEP_ClearAllBookForms()
PlacedBook01 = EmptyForm
PlacedBook02 = EmptyForm
PlacedBook03 = EmptyForm
PlacedBook04 = EmptyForm
PlacedBook05 = EmptyForm
PlacedBook06 = EmptyForm
PlacedBook07 = EmptyForm
PlacedBook08 = EmptyForm
PlacedBook09 = EmptyForm
PlacedBook10 = EmptyForm
PlacedBook11 = EmptyForm
PlacedBook12 = EmptyForm
PlacedBook13 = EmptyForm
PlacedBook14 = EmptyForm
PlacedBook15 = EmptyForm
PlacedBook16 = EmptyForm
PlacedBook17 = EmptyForm
PlacedBook18 = EmptyForm
PlacedBook01Ref = EmptyRef
PlacedBook02Ref = EmptyRef
PlacedBook03Ref = EmptyRef
PlacedBook04Ref = EmptyRef
PlacedBook05Ref = EmptyRef
PlacedBook06Ref = EmptyRef
PlacedBook07Ref = EmptyRef
PlacedBook08Ref = EmptyRef
PlacedBook09Ref = EmptyRef
PlacedBook10Ref = EmptyRef
PlacedBook11Ref = EmptyRef
PlacedBook12Ref = EmptyRef
PlacedBook13Ref = EmptyRef
PlacedBook14Ref = EmptyRef
PlacedBook15Ref = EmptyRef
PlacedBook16Ref = EmptyRef
PlacedBook17Ref = EmptyRef
PlacedBook18Ref = EmptyRef
EndFunction

@ -1,4 +1,5 @@
Scriptname PlayerBookShelfTriggerSCRIPT extends ObjectReference Scriptname PlayerBookShelfTriggerSCRIPT extends ObjectReference
{This script has been overhauled to fix several issues listed in USLEEP 3.0.1 - Bug #19515. This overhaul was contributed by Adria.}
import debug import debug
import utility import utility
@ -36,14 +37,16 @@ auto STATE WaitForBooks
;Trace("DARYL - " + self + " Player has a hold of this reference, do nothing") ;Trace("DARYL - " + self + " Player has a hold of this reference, do nothing")
else else
; Player isnt' grabbing this reference, check to see if it's in the container. ; Player isnt' grabbing this reference, check to see if it's in the container.
if Shelfcontainer.GetItemCount(TriggerRef.GetBaseObject()) >= 1 ;Trace("BookShelfFix Trigger - Trying to pick up " + TriggerRef)
Shelfcontainer.RemoveItem(TriggerRef.GetBaseObject(), 1) ;if Shelfcontainer.GetItemCount(TriggerRef.GetBaseObject()) >= 1
(Shelfcontainer as PlayerBookShelfContainerScript).CurrentBookAmount = (Shelfcontainer as PlayerBookShelfContainerScript).CurrentBookAmount - 1 ;USLEEP 3.0.1 - Bug #19515
(ShelfContainer as PlayerBookShelfContainerScript).RemoveBooks((TriggerRef.GetBaseObject()), 1) (Shelfcontainer as PlayerBookShelfContainerScript).PickUp(TriggerRef)
else ;(Shelfcontainer as PlayerBookShelfContainerScript).CurrentBookAmount = (Shelfcontainer as PlayerBookShelfContainerScript).CurrentBookAmount - 1
;(ShelfContainer as PlayerBookShelfContainerScript).RemoveBooks((TriggerRef.GetBaseObject()), 1)
;else
; There is no book based on this form in the container ; There is no book based on this form in the container
;Trace("DARYL - " + self + " Container doesn't contain this book") ;Trace("DARYL - " + self + " Container doesn't contain this book")
endif ;endif
endif endif
endif endif
endEvent endEvent
@ -59,5 +62,4 @@ STATE IgnoreBooks
endSTATE endSTATE
int Property testint Auto int Property testint Auto

@ -20,7 +20,7 @@ endEVENT
EVENT OnActivate(ObjectReference TriggerRef) EVENT OnActivate(ObjectReference TriggerRef)
Trace("DARYL - " + self + " I've been activated, opening container: " + ShelfContainer) ;Trace("DARYL - " + self + " I've been activated, opening container: " + ShelfContainer)
ShelfContainer.Activate(Game.GetPlayer(), FALSE) ShelfContainer.Activate(Game.GetPlayer(), FALSE)
endEVENT endEVENT

@ -19,16 +19,16 @@ endEVENT
STATE WaitForBooks STATE WaitForBooks
EVENT OnBeginState() EVENT OnBeginState()
trace(self + " BOOKTRIGGER - Waiting For Books!") ;trace(self + " BOOKTRIGGER - Waiting For Books!")
endEVENT endEVENT
EVENT OnTriggerEnter(ObjectReference TriggerRef) EVENT OnTriggerEnter(ObjectReference TriggerRef)
Trace("DARYL - " + self + " Reference " + TriggerRef + " has ENTERED") ;Trace("DARYL - " + self + " Reference " + TriggerRef + " has ENTERED")
endEvent endEvent
EVENT OnTriggerLeave(ObjectReference TriggerRef) EVENT OnTriggerLeave(ObjectReference TriggerRef)
Trace("DARYL - " + self + " Reference " + TriggerRef + " has EXITED") ;Trace("DARYL - " + self + " Reference " + TriggerRef + " has EXITED")
Shelfcontainer.RemoveItem(TriggerRef.GetBaseObject(), 1) Shelfcontainer.RemoveItem(TriggerRef.GetBaseObject(), 1)
(Shelfcontainer as PlayerBookShelfContainerScript).CurrentBookAmount = (Shelfcontainer as PlayerBookShelfContainerScript).CurrentBookAmount - 1 (Shelfcontainer as PlayerBookShelfContainerScript).CurrentBookAmount = (Shelfcontainer as PlayerBookShelfContainerScript).CurrentBookAmount - 1
(ShelfContainer as PlayerBookShelfContainerScript).RemoveBooks((TriggerRef.GetBaseObject()), 1) (ShelfContainer as PlayerBookShelfContainerScript).RemoveBooks((TriggerRef.GetBaseObject()), 1)
@ -40,7 +40,7 @@ endSTATE
auto STATE IgnoreBooks auto STATE IgnoreBooks
Event OnBeginState() Event OnBeginState()
trace(self + " BOOKTRIGGER - Ignoring Books!") ;trace(self + " BOOKTRIGGER - Ignoring Books!")
endEVENT endEVENT
endSTATE endSTATE

@ -55,27 +55,33 @@ bool function IsSummoned()
endIf endIf
endFunction endFunction
bool function TurnToAsh() function TurnToAsh()
trace("victim just died") ;trace("victim just died")
victim.SetCriticalStage(Victim.CritStage_DisintegrateStart) victim.SetCriticalStage(Victim.CritStage_DisintegrateStart)
; victim.SetAlpha (0.99,False) ; victim.SetAlpha (0.99,False)
if MagicEffectShader != none ;USKP 2.0.3 - Victim needs to have 3D loaded.
MagicEffectShader.play(Victim,ShaderDuration) if( Victim.Is3DLoaded() )
endif if MagicEffectShader != none
if bSetAlphaToZeroEarly MagicEffectShader.play(Victim,ShaderDuration)
victim.SetAlpha (0.0,True) endif
endif if bSetAlphaToZeroEarly
victim.SetAlpha (0.0,True)
endif
EndIf
utility.wait(fDelay) utility.wait(fDelay)
Victim.AttachAshPile(AshPileObject) Victim.AttachAshPile(AshPileObject)
; AshPileRef = AshPileObject ; AshPileRef = AshPileObject
; AshPileRef.SetAngle(0.0,0.0,(Victim.GetAngleZ())) ; AshPileRef.SetAngle(0.0,0.0,(Victim.GetAngleZ()))
utility.wait(fDelayEnd) utility.wait(fDelayEnd)
if MagicEffectShader != none ;USKP 2.0.3 - Victim needs to have 3D loaded.
MagicEffectShader.stop(Victim) if( Victim.Is3DLoaded() )
endif if MagicEffectShader != none
if bSetAlphaZero == True MagicEffectShader.stop(Victim)
victim.SetAlpha (0.0,True) endif
endif if bSetAlphaZero == True
victim.SetAlpha (0.0,True)
EndIf
EndIf
victim.SetCriticalStage(Victim.CritStage_DisintegrateEnd) victim.SetCriticalStage(Victim.CritStage_DisintegrateEnd)
endFunction endFunction
@ -111,8 +117,11 @@ EndEvent
Event OnEffectFinish(Actor Target, Actor Caster) Event OnEffectFinish(Actor Target, Actor Caster)
if TargetIsImmune == False && AshPileCreated == False if TargetIsImmune == False && AshPileCreated == False
TurnToAsh() ;USLEEP 3.0.1 - Prevent thralls from being purged before they died
AshPileCreated = True if( !Target.IsCommandedActor() )
TurnToAsh()
AshPileCreated = True
endif
endif endif
EndEvent EndEvent

@ -1,11 +1,15 @@
Scriptname SilverSwordScript extends ObjectReference Scriptname SilverSwordScript extends ObjectReference
;Script modified by USKP 2.0.2. Silver weapon perk does not need to constantly be added or removed in order to function.
;This also fixes a bug where dual-wielding and then unequipping one silver weapon would remove the perk even if another silver weapon was still equipped.
Perk Property SilverPerk auto Perk Property SilverPerk auto
Event OnEquipped(Actor akActor) Event OnEquipped(Actor akActor)
akActor.AddPerk(SilverPerk) if( !akActor.HasPerk(SilverPerk) )
akActor.AddPerk(SilverPerk)
EndIf
EndEvent EndEvent
Event OnUnEquipped(Actor akActor) Event OnUnEquipped(Actor akActor)
akActor.RemovePerk(SilverPerk) ;akActor.RemovePerk(SilverPerk)
EndEvent EndEvent

@ -33,8 +33,14 @@ EffectShader Property WebbedFXS auto
Function playWebAnimations(int iRand) Function playWebAnimations(int iRand)
;notification("Rand = " + iRand) ;notification("Rand = " + iRand)
Actor myActor = webActor as Actor Actor myActor = webActor as Actor
;USKP 2.0.1 - If he's dead, don't have him still trying to thrash in the web!
if( myActor.IsDead() )
Return
EndIf
if(iRand == 1 && !stopCondition) if(iRand == 1 && !stopCondition)
myActor.playIdle( idleWebThrashShort ); myActor.playIdle( idleWebThrashShort )
else else
if(iRand == 2 && !stopCondition) if(iRand == 2 && !stopCondition)
myActor.playIdle( idleWebThrashShort2 ) myActor.playIdle( idleWebThrashShort2 )

@ -26,6 +26,13 @@ ObjectReference selfRef
selfRef = caster selfRef = caster
;Added by USKP to prevent this effect from appearing on the player.
If selfRef == Game.GetPlayer()
Dispel()
return
EndIf
selfRef.RegisterForSingleUpdate(0.25) selfRef.RegisterForSingleUpdate(0.25)
int i = 10 ; recursion limiter for 3dLoaded check int i = 10 ; recursion limiter for 3dLoaded check
while selfRef.is3dLoaded() == FALSE while selfRef.is3dLoaded() == FALSE

@ -9,17 +9,20 @@ perk property LightFoot auto
bool property checkForLightFootPerk = true Auto bool property checkForLightFootPerk = true Auto
{default == true} {default == true}
globalVariable property LightFootTriggerPercent auto globalVariable property LightFootTriggerPercent auto
bool BeenReset = False ; USKP 2.0.1 - Used along with StartOpen to open them once on cell reset if necessary.
Event onReset() Event onReset()
goToState("Closed") goToState("Closed")
self.reset() self.reset()
BeenReset = False
endEvent endEvent
event onLoad() event onLoad()
hitBase = (self as objectReference) as TrapHitBase hitBase = (self as objectReference) as TrapHitBase
ResolveLeveledDamage() ResolveLeveledDamage()
if StartOpen if StartOpen && !BeenReset
BeenReset = True
playAnimation("StartOpen") playAnimation("StartOpen")
goToState("Open") goToState("Open")
endif endif

@ -25,10 +25,11 @@ bool property hasPlayedAttackAnimOnce = false auto hidden
event onLoad() event onLoad()
float CV = (rotationSpeed * getAnimationVariableFloat("CV")) ;USSEP 4.2.2 Bug #28456 CV and CCV are not valid animation variables for this object. Attempting to read or set them will cause an error.
float CCV = (rotationSpeed * getAnimationVariableFloat("CCV")) ; float CV = (rotationSpeed * getAnimationVariableFloat("CV"))
SetAnimationVariableFloat("CV", CV) ; float CCV = (rotationSpeed * getAnimationVariableFloat("CCV"))
SetAnimationVariableFloat("CCV", CCV) ; SetAnimationVariableFloat("CV", CV)
; SetAnimationVariableFloat("CCV", CCV)
;hitBase = (self as objectReference) as TrapDweFlamePillarHit ;hitBase = (self as objectReference) as TrapDweFlamePillarHit
endEvent endEvent

@ -83,8 +83,13 @@ state CanHit
actor myTarget actor myTarget
myTarget = akTarget as Actor myTarget = akTarget as Actor
if canDisease && isPlayer ;USSEP 4.2.5 Bug #29500 - Traps weren't accounting for players' disease resistance.
if randomFloat(0.0, 100.0) <= diseaseChance Float diseaseResistMult = (Game.GetForm(0x14) as Actor).GetActorValue("DiseaseResist")
if canDisease && isPlayer && diseaseResistMult < 100.0
Float chance = diseaseChance * (100.0 - diseaseResistMult)
Float result = utility.RandomFloat(1.0, 10000.0)
if result <= chance
int diseasePick int diseasePick
diseasePick = randomInt(1,6) diseasePick = randomInt(1,6)
if diseasePick == 1 if diseasePick == 1

@ -34,7 +34,8 @@ endState
state inMagicTrap state inMagicTrap
event onBeginState() event onBeginState()
(self as objectReference).SetMotionType(4) ;USLEEP 3.08 Bug #14888
;(self as objectReference).SetMotionType(4)
; ;debug.Trace(self + " has begun inMagicTrap") ; ;debug.Trace(self + " has begun inMagicTrap")
;self.TranslateTo(self.getpositionx(), self.getpositiony(), self.getpositionz(), self.getAngleX(), self.getAngleY() + 180, self.getAngleZ(), idleRotateSpeed) ;self.TranslateTo(self.getpositionx(), self.getpositiony(), self.getpositionz(), self.getAngleX(), self.getAngleY() + 180, self.getAngleZ(), idleRotateSpeed)
endEvent endEvent

@ -133,6 +133,11 @@ Event onCellLoad()
endif endif
endEvent endEvent
;USSEP 4.2.2 Bug #28300
Event OnCellDetach()
lastTriggerRef = None
endEvent
;THIS SECTION IS USED FOR TRAP LINKERS ;THIS SECTION IS USED FOR TRAP LINKERS
event onActivate(objectReference akActivator) event onActivate(objectReference akActivator)
; debug.Trace(self + " has been activated by + " + akActivator) ; debug.Trace(self + " has been activated by + " + akActivator)
@ -262,7 +267,7 @@ State Active
endEvent endEvent
event OnMagicEffectApply(objectReference akCaster, MagicEffect akEffect) event OnMagicEffectApply(objectReference akCaster, MagicEffect akEffect)
Trace("MagicEffectHit") ;Trace("MagicEffectHit")
activate(self as objectReference) activate(self as objectReference)
goToState( "Inactive" ) goToState( "Inactive" )
endEvent endEvent

@ -79,7 +79,7 @@ EndState
state Triggered state Triggered
event onBeginState() event onBeginState()
(trapLinkedRef).activate(objectSelf) (trapLinkedRef).activate(self) ; USKP 2.0.1 - No need to have it use a variable with no purpose. "self" works just fine.
setDestroyed(true) setDestroyed(true)
playAnimation("Trigger01") playAnimation("Trigger01")
EndEvent EndEvent

@ -1,81 +1,66 @@
scriptName Tripwire extends TrapTriggerBase scriptName Tripwire extends TrapTriggerBase
;
;
;
;================================================================
; event onActivate(objectReference akActivator)
; if (akActivator as actor) && akActivator != (self as objectReference)
; goToState("Active")
; endif
; endEvent
State Active State Active
Event OnBeginState() Event OnBeginState()
SetMotionType(1) SetMotionType (1)
TriggerSound.play( self as ObjectReference) ;play trigger sound TriggerSound.play (Self as ObjectReference)
self.blockActivation(false) Self.blockActivation (False)
activate(self as objectReference) Activate (Self as ObjectReference)
self.blockActivation(true) Self.blockActivation (True)
PlayAnimation("Trigger") PlayAnimation ("Trigger")
goToState("DoNothing") GoToState ("DoNothing")
;applyHavokImpulse 15 0 0 -1 ;push down at a force of 15 to break the havok constraint. EndEvent
endEvent
event onActivate(objectReference akActivator)
endEvent
event OnTriggerEnter( objectReference triggerRef )
endEvent
event OnTriggerLeave( objectReference triggerRef ) Event OnHit (ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, Bool abBashAttack, Bool abHitBlocked)
endEvent EndEvent
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
endEvent
endState
State DoNothing ;Dummy state, don't do anything if animating EndState
event onBeginState()
setDestroyed(true) State DoNothing
endEvent
Event OnBeginState()
SetDestroyed (True)
EndEvent
Event OnLoad()
EndEvent
event OnTriggerEnter( objectReference triggerRef )
endEvent
event OnTriggerLeave( objectReference triggerRef )
endEvent
event onCellAttach()
endEvent
EndState EndState
Event OnCellAttach() Event OnLoad()
SetMotionType(4) SetMotionType(4)
EndEvent EndEvent
;/ ;/
Event OnCellDetach() Event OnCellDetach()
SetMotionType(1) SetMotionType(1)
EndEvent EndEvent
/; /;
function localActivateFunction() Function LocalActivateFunction()
goToState("Active")
endFunction
Event onReset() GoToState ("Active")
self.reset()
SetMotionType(4) EndFunction
self.clearDestruction()
self.setDestroyed(False) Event OnReset()
goToState("Inactive")
Self.Reset()
;SetMotionType (4) - USKP 2.0.1: Can't do this here, needs to rely on the OnLoad event above.
Self.ClearDestruction()
Self.SetDestroyed (False)
GoToState ("Inactive")
CountUsed = 0 CountUsed = 0
endEvent
EndEvent
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
; ;debug.Trace(self + ": was hit by " + akAggressor + " with " + akSource + " or " + akProjectile) GoToState ("Active")
goToState("Active") EndEvent
endEvent

@ -1,14 +1,20 @@
Scriptname WeaponRackTriggerSCRIPT extends ObjectReference Hidden Scriptname WeaponRackTriggerSCRIPT extends ObjectReference Hidden
;Modifications by Sclerocephalus - debug version 3.4 (10/21/2013)
;modified by taleden - rev 4 (2013-11-01)
;Modifications by DayDreamer - version 5.0 (2014 Mar 15)
import game import game
import debug import debug
import utility import utility
;-------------------------------------------
Keyword Property WRackActivator Auto Keyword Property WRackActivator Auto
;The activator we must disable if there is already something in this trigger ;The activator we must disable if there is already something in this trigger
ObjectReference Property ActivatorRef Auto Hidden ObjectReference Property ActivatorRef Auto Hidden
;///
;Reference that is currently in the trigger ;Reference that is currently in the trigger
ObjectReference Property RefCurrentlyInTrig Auto Hidden ObjectReference Property RefCurrentlyInTrig Auto Hidden
@ -16,87 +22,238 @@ ObjectReference Property RefCurrentlyInTrig Auto Hidden
Bool Property HasBeenTriggered Auto Hidden Bool Property HasBeenTriggered Auto Hidden
Int Property numInTrig Auto Hidden Int Property numInTrig Auto Hidden
///;
Bool Property AlreadyInit Auto Hidden Bool Property AlreadyInit Auto Hidden
Bool Property IgnoreArmor = FALSE Auto Bool Property IgnoreArmor = FALSE Auto
;-------------------------------------------
;*** USKP Properties ***
Keyword Property ArmorShield Auto
;-------------------------------------------
;*** USKP Variables ***
WeaponRackActivateScript ActivatorScript = None
;/------------------------------------------
Handle mis-configured triggers.
Returns False for success.
/;
Bool Function CheckConfiguration(String CallingEvent)
GoToState("ActivatorBusy")
If WRackActivator == None
; script was deleted, properties missing
;~ Trace(Self + CallingEvent + "() CHECK: WRackActivator == None; 'ActivatorBusy' state.")
Return True
EndIf
ActivatorRef = GetLinkedRef(WRackActivator)
If ActivatorRef == Self
; hand fixed, don't disable
;~ Trace(Self + CallingEvent + "() CHECK: WRackActivator == Self; 'ActivatorBusy' state.")
ActivatorRef = None
Return True
EndIf
If ActivatorRef == None
Trace(Self + CallingEvent + "() ERROR: missing WRackActivator; 'ActivatorBusy' state.")
Return True
EndIf
ActivatorScript = ActivatorRef As WeaponRackActivateScript
If ActivatorScript == None
Trace(Self + CallingEvent + "() ERROR: missing WeaponRackActivateScript; 'ActivatorBusy' state.")
ActivatorRef = None
Return True
EndIf
If isDisabled()
GoToState("TriggerDisabled")
ActivatorRef.DisableNoWait()
;~ Trace(Self + CallingEvent + "() CHECK: is disabled; set 'TriggerDisabled' state; " + ActivatorRef + " disabled too.")
ActivatorRef = NONE
ActivatorScript = NONE
Return True
EndIf
Return False
EndFunction
;-------------------------------------------
EVENT OnCellDetach(); replace OnReset()
EVENT OnReset()
AlreadyInit = FALSE AlreadyInit = FALSE
;Trace("DARYL - " + self + " running OnReset() and AlreadyInit = " + AlreadyInit)
endEVENT endEVENT
EVENT OnLoad() ;/------------------------------------------
;Trace("DARYL - " + self + " running OnLoad() and AlreadyInit = " + AlreadyInit) This event must be present to catch extant USKP 2.0.0 racks,
if (AlreadyInit == FALSE) && (self.IsEnabled()) or otherwise without known state.
ActivatorRef = GetLinkedRef(WRackActivator)
if (ActivatorRef) This is present solely for backward compatibility.
ActivatorRef.Enable() /;
endif EVENT OnCellAttach(); replace OnCellLoad()
ActivatorRef = NONE
AlreadyInit = TRUE TriggerSetup("Trigger:OnCellAttach")
;Trace("DARYL - " + self + " The Activator Ref is " + ActivatorRef)
else
;Do nothing
endif
;Trace("DARYL - " + self + " finishing OnLoad() and AlreadyInit = " + AlreadyInit)
endEVENT endEVENT
;EVENT OnCellLoad() ;/------------------------------------------
; ;Trace("DARYL - " + self + " running OnCellLoad() and AlreadyInit = " + AlreadyInit) This state must be present to catch extant USKP 1.3.3 racks.
; if (AlreadyInit == FALSE) && (self.IsEnabled())
; ActivatorRef = GetLinkedRef(WRackActivator) (1) The activator is known to be missing, but can be resuscitated.
; AlreadyInit = TRUE
; ;Trace("DARYL - " + self + " The Activator Ref is " + ActivatorRef) (2) The activator status is currently being tested. Suppress redundant
; else OnLoad() and trigger events.
; ;Do nothing
; endif (3) The activator is either enabled (and the rack empty, so the trigger
; ;Trace("DARYL - " + self + " finishing OnCellLoad() and AlreadyInit = " + AlreadyInit) won't be needed anyway) or running a placement procedure. OnTriggerLeave()
;endEVENT events during placement are from adjacent racks ("cross-activation") or
from a temporary loss of the item's 3D during a MoveToNode command.
Skip them to prevent the items from being mis-interpreted as having been
grabbed from the rack.
/;
STATE ActivatorBusy
EVENT OnCellAttach()
endEVENT
EVENT OnLoad()
endEVENT
EVENT OnTriggerLeave(ObjectReference ItemRef)
;~ Trace(Self + "ActivatorBusy:OnTriggerLeave() " + ItemRef + "; Base = " + ItemRef.GetBaseObject())
endEVENT
endSTATE
;/------------------------------------------
This state must be present to catch extant USKP 2.0.1 racks.
The activator has been detected by OnCellAttach(), this trigger is
currently disabled. Allows OnLoad() to setup.
/;
STATE TriggerDisabled
EVENT OnCellAttach()
endEVENT
;/ Catch newly enabled racks with player present.
Starting items must be done upon constructing the rack at a
workbench in a player home. OnCellAttach() does not fire.
/;
EVENT OnLoad()
If Self == None
Trace(Self + "OnLoad() ERROR!")
return
EndIf
Cell parentCell = GetParentCell()
If parentCell == None
Trace(Self + "OnLoad() ERROR: GetParentCell == None")
return
EndIf
If !parentCell.IsAttached()
Trace(Self + "OnLoad() ERROR: parentCell=" + parentCell + " !IsAttached()")
return
EndIf
TriggerSetup("TriggerDisabled:OnLoad")
endEVENT
EVENT OnTriggerLeave(ObjectReference ItemRef)
;~ Trace(Self + "TriggerDisabled:OnTriggerLeave() " + ItemRef + "; Base = " + ItemRef.GetBaseObject())
endEVENT
endSTATE
;/------------------------------------------
This is a vanilla state and must be present to catch extant vanilla racks.
However, the contents have been significantly revised.
/;
auto STATE WaitingForReference auto STATE WaitingForReference
EVENT onTriggerEnter(objectReference triggerRef)
;Trace("DARYL - " + self + " Just OnTriggerEntered by " + triggerref) ;/ Catch newly enabled racks without player present.
if (IgnoreArmor == TRUE) && (triggerRef.GetBaseObject() as Armor) Previously placed items must be renewed on every cell attach,
;Trace("DARYL - " + self + " I'm ignoring armor, and this is armor, so I'm doing nothing.") re-adjusting to current game mesh defined nodes.
;Do Nothing /;
else EVENT OnCellAttach()
;Trace("DARYL - " + self + " I'm updating as normal")
;numInTrig = (numInTrig + 1) TriggerSetup("WFR:OnCellAttach")
HasBeenTriggered = TRUE
ActivatorRef = GetLinkedRef(WRackActivator)
if ActivatorRef
ActivatorRef.Disable()
endif
ActivatorRef = NONE
endif
endEVENT endEVENT
EVENT OnLoad()
endEVENT
;/ It would be nice if we could filter out spurious events fired by bouncing
clutter etc, but we can't call any native methods on triggerRef such as
GetBaseObject() -- if the retrieved item was scripted, then by the time
this runs it may already be in the player's inventory and our pointer
will be broken. So we'll have to make do with just comparing the pointer
itself to our other stored pointers. --taleden
/;
EVENT OnTriggerLeave(objectReference triggerRef) EVENT OnTriggerLeave(objectReference triggerRef)
;Trace("DARYL - " + self + " A References has EXITED, refs in this trigger now = " + numInTrig)
if (IgnoreArmor == TRUE) && (triggerRef.GetBaseObject() as Armor)
;Trace("DARYL - " + self + " I'm ignoring armor, and this is armor, so I'm doing nothing.")
;Do Nothing
else
;Trace("DARYL - " + self + " I'm updating as normal")
;numInTrig = (numInTrig - 1)
endif
if (GetTriggerObjectCount() == 0)
ActivatorRef = GetLinkedRef(WRackActivator)
HasBeenTriggered = FALSE
ActivatorRef.Enable()
If CheckConfiguration("WFR:OnTriggerLeave")
return
EndIf
; state ActivatorBusy
If !ActivatorRef.IsDisabled()
;~ Trace(Self + "OnTriggerLeave() CHECK: activator was enabled; 'ActivatorBusy' state.")
ActivatorRef = NONE ActivatorRef = NONE
ActivatorScript = NONE
return
EndIf
If ActivatorScript.RackWasTriggered(triggerRef, GetTriggerObjectCount())
GoToState("WaitingForReference")
;~ Trace(Self + "OnTriggerLeave() retain 'WaitingForReference' state.")
EndIf
ActivatorRef = NONE
ActivatorScript = NONE
endif
endEVENT endEVENT
endSTATE endSTATE
;/------------------------------------------
TriggerSetup() CheckConfiguration() immediately changes state,
suppressing OnLoad() and trigger events.
Called from OnLoad() and OnCellAttach() both here and there.
/;
Function TriggerSetup(String CallingEvent)
Bool wasHandled = AlreadyInit
AlreadyInit = True
If wasHandled
;~ Trace(Self + CallingEvent + "() TriggerSetup() was handled.")
Return
EndIf
If CheckConfiguration(CallingEvent)
Return
EndIf
; state ActivatorBusy
;~ Trace(Self + CallingEvent + "() " + ActivatorRef + " update setup.")
ActivatorScript.ActivatorSetup(CallingEvent)
ActivatorRef = NONE
ActivatorScript = NONE
EndFunction

Loading…
Cancel
Save