diff --git a/scripts/atronachfrostscript.pex b/scripts/atronachfrostscript.pex index 64afa328..ba4fd294 100644 Binary files a/scripts/atronachfrostscript.pex and b/scripts/atronachfrostscript.pex differ diff --git a/scripts/blackreachdoorscript.pex b/scripts/blackreachdoorscript.pex index bada758f..27e86bd1 100644 Binary files a/scripts/blackreachdoorscript.pex and b/scripts/blackreachdoorscript.pex differ diff --git a/scripts/blacksmithforge01.pex b/scripts/blacksmithforge01.pex index 3fd28cf5..60c3d1ff 100644 Binary files a/scripts/blacksmithforge01.pex and b/scripts/blacksmithforge01.pex differ diff --git a/scripts/carryactorscript.pex b/scripts/carryactorscript.pex index 373b8918..b2572653 100644 Binary files a/scripts/carryactorscript.pex and b/scripts/carryactorscript.pex differ diff --git a/scripts/defaultdisableexitenableenter.pex b/scripts/defaultdisableexitenableenter.pex index dc3b8e42..3569cc75 100644 Binary files a/scripts/defaultdisableexitenableenter.pex and b/scripts/defaultdisableexitenableenter.pex differ diff --git a/scripts/defaultforceevaluatepackagetrigger.pex b/scripts/defaultforceevaluatepackagetrigger.pex index 91d388ba..d6a76709 100644 Binary files a/scripts/defaultforceevaluatepackagetrigger.pex and b/scripts/defaultforceevaluatepackagetrigger.pex differ diff --git a/scripts/defaultpillarpuzzlelever.pex b/scripts/defaultpillarpuzzlelever.pex index f5bfefee..a57bc0e4 100644 Binary files a/scripts/defaultpillarpuzzlelever.pex and b/scripts/defaultpillarpuzzlelever.pex differ diff --git a/scripts/defaultpillarpuzzlelevernofurn.pex b/scripts/defaultpillarpuzzlelevernofurn.pex index c6b7ce20..37bbc2cb 100644 Binary files a/scripts/defaultpillarpuzzlelevernofurn.pex and b/scripts/defaultpillarpuzzlelevernofurn.pex differ diff --git a/scripts/defaultpillarpuzzlepullbarnofurn.pex b/scripts/defaultpillarpuzzlepullbarnofurn.pex index 0482bbd9..69f90564 100644 Binary files a/scripts/defaultpillarpuzzlepullbarnofurn.pex and b/scripts/defaultpillarpuzzlepullbarnofurn.pex differ diff --git a/scripts/doorbar.pex b/scripts/doorbar.pex index b7f99f9b..0923e18c 100644 Binary files a/scripts/doorbar.pex and b/scripts/doorbar.pex differ diff --git a/scripts/dragonpriestactorscript.pex b/scripts/dragonpriestactorscript.pex index d94ef7a2..fd813a56 100644 Binary files a/scripts/dragonpriestactorscript.pex and b/scripts/dragonpriestactorscript.pex differ diff --git a/scripts/dunkarthspireplatepuzzlescript.pex b/scripts/dunkarthspireplatepuzzlescript.pex index dc8f00ea..6f16ca74 100644 Binary files a/scripts/dunkarthspireplatepuzzlescript.pex and b/scripts/dunkarthspireplatepuzzlescript.pex differ diff --git a/scripts/dwespidercenturionpipescript.pex b/scripts/dwespidercenturionpipescript.pex index 3647d0fc..f036e989 100644 Binary files a/scripts/dwespidercenturionpipescript.pex and b/scripts/dwespidercenturionpipescript.pex differ diff --git a/scripts/favordialoguescript.pex b/scripts/favordialoguescript.pex index 3cd7b1b4..8f5f3db5 100644 Binary files a/scripts/favordialoguescript.pex and b/scripts/favordialoguescript.pex differ diff --git a/scripts/flameatronacheffectscript.pex b/scripts/flameatronacheffectscript.pex index ee911805..247e36ce 100644 Binary files a/scripts/flameatronacheffectscript.pex and b/scripts/flameatronacheffectscript.pex differ diff --git a/scripts/fxbirdfleescript.pex b/scripts/fxbirdfleescript.pex index f1d61d10..3f1d9852 100644 Binary files a/scripts/fxbirdfleescript.pex and b/scripts/fxbirdfleescript.pex differ diff --git a/scripts/fxdragonblooddamagescript.pex b/scripts/fxdragonblooddamagescript.pex index b283089f..97c6828b 100644 Binary files a/scripts/fxdragonblooddamagescript.pex and b/scripts/fxdragonblooddamagescript.pex differ diff --git a/scripts/fxdraugrmagicscript.pex b/scripts/fxdraugrmagicscript.pex index 44a03ace..3581a12d 100644 Binary files a/scripts/fxdraugrmagicscript.pex and b/scripts/fxdraugrmagicscript.pex differ diff --git a/scripts/fxdwarvencenturionscript.pex b/scripts/fxdwarvencenturionscript.pex index 7dc559ec..abc8e3d3 100644 Binary files a/scripts/fxdwarvencenturionscript.pex and b/scripts/fxdwarvencenturionscript.pex differ diff --git a/scripts/fxdwarvenspherescript.pex b/scripts/fxdwarvenspherescript.pex index 3a7ec313..b24fa04f 100644 Binary files a/scripts/fxdwarvenspherescript.pex and b/scripts/fxdwarvenspherescript.pex differ diff --git a/scripts/fxdwarvenspiderscript.pex b/scripts/fxdwarvenspiderscript.pex index cf1d0473..08d37a58 100644 Binary files a/scripts/fxdwarvenspiderscript.pex and b/scripts/fxdwarvenspiderscript.pex differ diff --git a/scripts/fxgreybeardshoutscript.pex b/scripts/fxgreybeardshoutscript.pex index f2da8c3f..9bc19332 100644 Binary files a/scripts/fxgreybeardshoutscript.pex and b/scripts/fxgreybeardshoutscript.pex differ diff --git a/scripts/fxsetblendvariablescript.pex b/scripts/fxsetblendvariablescript.pex index 1a1fac67..f82321d4 100644 Binary files a/scripts/fxsetblendvariablescript.pex and b/scripts/fxsetblendvariablescript.pex differ diff --git a/scripts/fxskeletonnecroscript.pex b/scripts/fxskeletonnecroscript.pex index 1ca316f8..acf50315 100644 Binary files a/scripts/fxskeletonnecroscript.pex and b/scripts/fxskeletonnecroscript.pex differ diff --git a/scripts/fxsovengardescript.pex b/scripts/fxsovengardescript.pex index 78b68ae1..00cad0fc 100644 Binary files a/scripts/fxsovengardescript.pex and b/scripts/fxsovengardescript.pex differ diff --git a/scripts/icewraithparticlesscript.pex b/scripts/icewraithparticlesscript.pex index 847ab92a..5d6ee283 100644 Binary files a/scripts/icewraithparticlesscript.pex and b/scripts/icewraithparticlesscript.pex differ diff --git a/scripts/magicattachashpileondeath.pex b/scripts/magicattachashpileondeath.pex index afa516f2..1222632d 100644 Binary files a/scripts/magicattachashpileondeath.pex and b/scripts/magicattachashpileondeath.pex differ diff --git a/scripts/magiceffectshadersonendscript.pex b/scripts/magiceffectshadersonendscript.pex index ec960472..0726ec4c 100644 Binary files a/scripts/magiceffectshadersonendscript.pex and b/scripts/magiceffectshadersonendscript.pex differ diff --git a/scripts/pf_carryfirewood_000d97fa.pex b/scripts/pf_carryfirewood_000d97fa.pex index c10091f8..94edd345 100644 Binary files a/scripts/pf_carryfirewood_000d97fa.pex and b/scripts/pf_carryfirewood_000d97fa.pex differ diff --git a/scripts/playerbookshelfclicktriggerscript.pex b/scripts/playerbookshelfclicktriggerscript.pex index 1e64bac3..d8ea298b 100644 Binary files a/scripts/playerbookshelfclicktriggerscript.pex and b/scripts/playerbookshelfclicktriggerscript.pex differ diff --git a/scripts/playerbookshelfcontainerscript.pex b/scripts/playerbookshelfcontainerscript.pex index 6cf52a62..d39d020e 100644 Binary files a/scripts/playerbookshelfcontainerscript.pex and b/scripts/playerbookshelfcontainerscript.pex differ diff --git a/scripts/playerbookshelftriggerscript.pex b/scripts/playerbookshelftriggerscript.pex index 596a4f97..98fdc60e 100644 Binary files a/scripts/playerbookshelftriggerscript.pex and b/scripts/playerbookshelftriggerscript.pex differ diff --git a/scripts/playerpotionrackclicktriggerscript.pex b/scripts/playerpotionrackclicktriggerscript.pex index add70cbd..ec0f14b7 100644 Binary files a/scripts/playerpotionrackclicktriggerscript.pex and b/scripts/playerpotionrackclicktriggerscript.pex differ diff --git a/scripts/playerpotionracktriggerscript.pex b/scripts/playerpotionracktriggerscript.pex index 58c1a5aa..9991735a 100644 Binary files a/scripts/playerpotionracktriggerscript.pex and b/scripts/playerpotionracktriggerscript.pex differ diff --git a/scripts/reanimateashpile.pex b/scripts/reanimateashpile.pex index 2b4355cb..a0ed179e 100644 Binary files a/scripts/reanimateashpile.pex and b/scripts/reanimateashpile.pex differ diff --git a/scripts/silverswordscript.pex b/scripts/silverswordscript.pex index b07995c0..5764008b 100644 Binary files a/scripts/silverswordscript.pex and b/scripts/silverswordscript.pex differ diff --git a/scripts/spiderwebanimationsscript.pex b/scripts/spiderwebanimationsscript.pex index d1f5950b..a1427cc5 100644 Binary files a/scripts/spiderwebanimationsscript.pex and b/scripts/spiderwebanimationsscript.pex differ diff --git a/scripts/sprigganswarmactorscript.pex b/scripts/sprigganswarmactorscript.pex index bf4f581f..d925d71e 100644 Binary files a/scripts/sprigganswarmactorscript.pex and b/scripts/sprigganswarmactorscript.pex differ diff --git a/scripts/trapbear.pex b/scripts/trapbear.pex index 02262893..0c46794c 100644 Binary files a/scripts/trapbear.pex and b/scripts/trapbear.pex differ diff --git a/scripts/trapdweflamepillar.pex b/scripts/trapdweflamepillar.pex index 077fd373..050686f8 100644 Binary files a/scripts/trapdweflamepillar.pex and b/scripts/trapdweflamepillar.pex differ diff --git a/scripts/traphitbase.pex b/scripts/traphitbase.pex index 676f6743..365c9d04 100644 Binary files a/scripts/traphitbase.pex and b/scripts/traphitbase.pex differ diff --git a/scripts/trapsoulgemcontroller.pex b/scripts/trapsoulgemcontroller.pex index 9e45ec77..51fc9af0 100644 Binary files a/scripts/trapsoulgemcontroller.pex and b/scripts/trapsoulgemcontroller.pex differ diff --git a/scripts/traptriggerbase.pex b/scripts/traptriggerbase.pex index ef07f151..7477913b 100644 Binary files a/scripts/traptriggerbase.pex and b/scripts/traptriggerbase.pex differ diff --git a/scripts/traptriggerhinge.pex b/scripts/traptriggerhinge.pex index eb439c42..8ee84a39 100644 Binary files a/scripts/traptriggerhinge.pex and b/scripts/traptriggerhinge.pex differ diff --git a/scripts/tripwire.pex b/scripts/tripwire.pex index 389460ac..763bd881 100644 Binary files a/scripts/tripwire.pex and b/scripts/tripwire.pex differ diff --git a/scripts/weaponracktriggerscript.pex b/scripts/weaponracktriggerscript.pex index 17f070d0..c796ba91 100644 Binary files a/scripts/weaponracktriggerscript.pex and b/scripts/weaponracktriggerscript.pex differ diff --git a/source/scripts/atronachfrostscript.psc b/source/scripts/atronachfrostscript.psc index 43765dd6..08c89a34 100644 --- a/source/scripts/atronachfrostscript.psc +++ b/source/scripts/atronachfrostscript.psc @@ -10,8 +10,17 @@ Actor selfRef int atronachHealth EVENT OnEffectStart(Actor Target, Actor Caster) - selfRef = caster - AtronachFrostFXS.Play(selfRef) + selfRef = caster + + ;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 Event OnEffectFinish(Actor akTarget, Actor akCaster) diff --git a/source/scripts/blackreachdoorscript.psc b/source/scripts/blackreachdoorscript.psc index bab8e1fa..12a475af 100644 --- a/source/scripts/blackreachdoorscript.psc +++ b/source/scripts/blackreachdoorscript.psc @@ -38,7 +38,7 @@ endState STATE busy ; This is the state when I'm busy animating EVENT onActivate (objectReference triggerRef) - trace (self + " Busy") + ;trace (self + " Busy") endEVENT endSTATE @@ -51,10 +51,10 @@ function SetOpen(bool abOpen = true) isAnimating = true if !isOpen gotoState ("busy") - trace(self + " Opening") + ;trace(self + " Opening") playAnimationandWait(openAnim, openEvent) ; Animate Open endif - trace(self + " Opened") + ;trace(self + " Opened") isOpen = true gotoState("done") isAnimating = false diff --git a/source/scripts/blacksmithforge01.psc b/source/scripts/blacksmithforge01.psc index 2a1e8ee0..1fa2ccaa 100644 --- a/source/scripts/blacksmithforge01.psc +++ b/source/scripts/blacksmithforge01.psc @@ -9,6 +9,6 @@ endEvent Event OnTriggerEnter ( objectReference triggerRef ) if (triggerRef == Game.GetPlayer()) - FlameDamage.Cast(triggerRef, triggerRef) + FlameDamage.Cast(self, triggerRef) endIf endEvent diff --git a/source/scripts/carryactorscript.psc b/source/scripts/carryactorscript.psc index 931c6e23..d9cc1972 100644 --- a/source/scripts/carryactorscript.psc +++ b/source/scripts/carryactorscript.psc @@ -1,5 +1,6 @@ -Scriptname CarryActorScript extends ObjectReference +Scriptname CarryActorScript extends Actor {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 {item being carried - MiscObject} @@ -47,8 +48,7 @@ function ChangeCarryState(bool bBeginCarrying, bool bDropItem = false) ; I'm not carrying anything any more bCarryFlag = 0 ; get rid of anim object - Actor selfActor = (self as ObjectReference) as Actor - selfActor.PlayIdle(StopCarryingEvent) + Self.PlayIdle(StopCarryingEvent) endif endFunction diff --git a/source/scripts/defaultdisableexitenableenter.psc b/source/scripts/defaultdisableexitenableenter.psc index db32a29c..bc2737aa 100644 --- a/source/scripts/defaultdisableexitenableenter.psc +++ b/source/scripts/defaultdisableexitenableenter.psc @@ -20,11 +20,25 @@ EVENT onTriggerEnter(objectReference triggerRef) ObjectReference MyLink03 = GetLinkedRef(LinkCustom03) ObjectReference MyLink04 = GetLinkedRef(LinkCustom04) - MyLink.Enable(shouldFade) - MyLink01.Enable(shouldFade) - MyLink02.Enable(shouldFade) - MyLink03.Enable(shouldFade) - MyLink04.Enable(shouldFade) + if( MyLink != None ) + MyLink.Enable(shouldFade) + EndIf + + 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 endEVENT @@ -36,10 +50,24 @@ EVENT onTriggerLeave(objectReference triggerRef) ObjectReference MyLink03 = GetLinkedRef(LinkCustom03) ObjectReference MyLink04 = GetLinkedRef(LinkCustom04) - MyLink.Disable(shouldFade) - MyLink01.Disable(shouldFade) - MyLink02.Disable(shouldFade) - MyLink03.Disable(shouldFade) - MyLink04.Disable(shouldFade) + if( MyLink != None ) + MyLink.Disable(shouldFade) + EndIf + + 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 -endEVENT \ No newline at end of file +endEVENT diff --git a/source/scripts/defaultforceevaluatepackagetrigger.psc b/source/scripts/defaultforceevaluatepackagetrigger.psc index 5ba7b9f2..af549bfb 100644 --- a/source/scripts/defaultforceevaluatepackagetrigger.psc +++ b/source/scripts/defaultforceevaluatepackagetrigger.psc @@ -10,6 +10,8 @@ EVENT OnTriggerEnter(objectReference actronaut) (actorToForce As Actor).EvaluatePackage() EndIf 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 endEVENT diff --git a/source/scripts/defaultpillarpuzzlelever.psc b/source/scripts/defaultpillarpuzzlelever.psc index 86079750..a81f1df3 100644 --- a/source/scripts/defaultpillarpuzzlelever.psc +++ b/source/scripts/defaultpillarpuzzlelever.psc @@ -51,10 +51,19 @@ Function doorOrDarts() endif else puzzleSolved = false - refActOnFailure01.activate (self as objectReference) - refActOnFailure02.activate (self as objectReference) - refActOnFailure03.activate (self as objectReference) - refActOnFailure04.activate (self as objectReference) + ;USKP 2.0.1 - Sanity checks. Not all of these are used in each instance of this script. + if( refActOnFailure01 != None ) + refActOnFailure01.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 endFunction diff --git a/source/scripts/defaultpillarpuzzlelevernofurn.psc b/source/scripts/defaultpillarpuzzlelevernofurn.psc index 77e61bd1..3f20fc7b 100644 --- a/source/scripts/defaultpillarpuzzlelevernofurn.psc +++ b/source/scripts/defaultpillarpuzzlelevernofurn.psc @@ -51,10 +51,19 @@ Function doorOrDarts() endif else puzzleSolved = false - refActOnFailure01.activate (self as objectReference) - refActOnFailure02.activate (self as objectReference) - refActOnFailure03.activate (self as objectReference) - refActOnFailure04.activate (self as objectReference) + ;USKP 2.0.1 - Sanity checks. Not all of these are used in each instance of this script. + if( refActOnFailure01 != None ) + refActOnFailure01.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 endFunction diff --git a/source/scripts/defaultpillarpuzzlepullbarnofurn.psc b/source/scripts/defaultpillarpuzzlepullbarnofurn.psc index 74ea34e5..18a88366 100644 --- a/source/scripts/defaultpillarpuzzlepullbarnofurn.psc +++ b/source/scripts/defaultpillarpuzzlepullbarnofurn.psc @@ -51,10 +51,19 @@ Function doorOrDarts() endif else puzzleSolved = false - refActOnFailure01.activate (self as objectReference) - refActOnFailure02.activate (self as objectReference) - refActOnFailure03.activate (self as objectReference) - refActOnFailure04.activate (self as objectReference) + ;USKP 2.0.1 - Sanity checks. Not all of these are used in each instance of this script. + if( refActOnFailure01 != None ) + refActOnFailure01.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 endFunction diff --git a/source/scripts/doorbar.psc b/source/scripts/doorbar.psc index ac3c06ed..c9fb9b7f 100644 --- a/source/scripts/doorbar.psc +++ b/source/scripts/doorbar.psc @@ -41,6 +41,11 @@ EVENT onCellLoad() gotoState("down") 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 STATE down diff --git a/source/scripts/dragonpriestactorscript.psc b/source/scripts/dragonpriestactorscript.psc index 4e64ef35..3bfd8ed0 100644 --- a/source/scripts/dragonpriestactorscript.psc +++ b/source/scripts/dragonpriestactorscript.psc @@ -22,6 +22,16 @@ Actor selfRef ;local pointer to the curren dragon priest EVENT OnEffectStart(Actor Target, Actor Caster) 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) ; Debug.Trace("DP is sleeping! 3") else @@ -35,6 +45,13 @@ ENDEVENT Event OnGetUp(ObjectReference akFurniture) ; Debug.Trace("Dragon preist just got up from " ) ;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) DragonPriestParticlesFX.play(selfRef, -1) DragonPriestEyeGlowFX.play(selfRef, -1) @@ -66,3 +83,17 @@ EVENT OnDying(Actor akKiller) 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 diff --git a/source/scripts/dunkarthspireplatepuzzlescript.psc b/source/scripts/dunkarthspireplatepuzzlescript.psc index 20b3eae7..7cfa7428 100644 --- a/source/scripts/dunkarthspireplatepuzzlescript.psc +++ b/source/scripts/dunkarthspireplatepuzzlescript.psc @@ -19,9 +19,7 @@ OBJECTREFERENCE victim EVENT onLoad() ; //setting the master script to be the one with the stored vars - if castSource != None - mainScript = castSource AS dunKarthspirePuzzleMaster - endif + mainScript = castSource AS dunKarthspirePuzzleMaster endEVENT @@ -36,13 +34,11 @@ auto STATE Active playAnimation("Down") 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! - IF(!mainScript.plateSolved && !bSafe) - spellDmg.cast(castSource, triggerRef) - TriggerSound.play(self) - ENDIF - endif + ;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) + spellDmg.cast(castSource, triggerRef) + TriggerSound.play(self) + ENDIF playAnimation("Down") diff --git a/source/scripts/dwespidercenturionpipescript.psc b/source/scripts/dwespidercenturionpipescript.psc index 8c338e5a..2f1e4092 100644 --- a/source/scripts/dwespidercenturionpipescript.psc +++ b/source/scripts/dwespidercenturionpipescript.psc @@ -9,7 +9,8 @@ auto State Listening Event onActivate(objectReference triggerRef) 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") playAnimation("exit") endif diff --git a/source/scripts/favordialoguescript.psc b/source/scripts/favordialoguescript.psc index f9c2b1e6..11a87ae3 100644 --- a/source/scripts/favordialoguescript.psc +++ b/source/scripts/favordialoguescript.psc @@ -45,11 +45,11 @@ import debug ; call this to persuade target actor Function Persuade(Actor pTarget) - trace("Persuade: " + pTarget) + ;trace("Persuade: " + pTarget) ; give player skill uses SkillUseMultiplier = SpeechSkillMult.value 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) Game.IncrementStat( "Persuasions" ) if ( Game.QueryStat( "Bribes" ) && Game.QueryStat( "Intimidations" ) ) @@ -58,7 +58,7 @@ Function Persuade(Actor pTarget) endFunction Function ArrestPersuade(Actor pTarget) - trace("Persuade: " + pTarget) + ;trace("Persuade: " + pTarget) ; give player skill uses SkillUseMultiplier = SpeechSkillMult.value SkillUsePersuade = SkillUseMultiplier * Game.GetPlayer().GetAv("Speechcraft") @@ -74,10 +74,10 @@ endFunction ; call this to bribe target actor Function Bribe(Actor pTarget) - trace("Bribe: " + pTarget) + ;trace("Bribe: " + pTarget) SkillUseMultiplier = SpeechSkillMult.value 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() ; remove gold GetPlayer().RemoveItem(Gold, pTarget.GetBribeAmount()) @@ -97,10 +97,10 @@ endFunction ; call this to intimidate target actor Function Intimidate(Actor pTarget) - trace("Intimidate: " + pTarget) + ;trace("Intimidate: " + pTarget) SkillUseMultiplier = SpeechSkillMult.value 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 pTarget.SetIntimidated() ; 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 Function Brawl(Actor pTarget, Actor pTargetFriend = None) - trace("Brawl: " + pTarget + ", friend=" + pTargetFriend) + ;trace("Brawl: " + pTarget + ", friend=" + pTargetFriend) BrawlKeyword.SendStoryEvent(None, pTarget, pTargetFriend) endFunction ; call this to give gift to target actor Function GiveGift(Actor pTarget) 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) ; TEMP cap until we have a formula for this: if favorPointsEarned > 100 favorPointsEarned = 100 endif ; give player skill uses - trace("Give Gift: " + favorPointsEarned * SkillUseGiveGiftMult + " skill uses earned") + ;trace("Give Gift: " + favorPointsEarned * SkillUseGiveGiftMult + " skill uses earned") AdvanceSkill("Speechcraft", favorPointsEarned * SkillUseGiveGiftMult) endFunction diff --git a/source/scripts/flameatronacheffectscript.psc b/source/scripts/flameatronacheffectscript.psc index f3d24963..d8058ea1 100644 --- a/source/scripts/flameatronacheffectscript.psc +++ b/source/scripts/flameatronacheffectscript.psc @@ -18,7 +18,16 @@ int atronachHealth EVENT OnEffectStart(Actor Target, Actor 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 Event OnEffectFinish(Actor akTarget, Actor akCaster) @@ -44,5 +53,3 @@ int atronachHealth AtronachFlameDeathFXS.Stop(selfRef) endif ENDEVENT - - diff --git a/source/scripts/fxbirdfleescript.psc b/source/scripts/fxbirdfleescript.psc index 8921ec91..4a5bf78b 100644 --- a/source/scripts/fxbirdfleescript.psc +++ b/source/scripts/fxbirdfleescript.psc @@ -16,6 +16,8 @@ int instanceID00 ;************************************************* Event onCellAttach() + ;USKP 2.0.1 - Short delay added to let 3D catch up. + Utility.Wait(0.5) instanceID00 = BirdFlockSound.Play(Self) gotoState("Waiting") endEvent diff --git a/source/scripts/fxdragonblooddamagescript.psc b/source/scripts/fxdragonblooddamagescript.psc index 08209b8b..9c9d83a3 100644 --- a/source/scripts/fxdragonblooddamagescript.psc +++ b/source/scripts/fxdragonblooddamagescript.psc @@ -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} ;=============================================== @@ -22,7 +22,7 @@ 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.90auto +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} @@ -50,311 +50,152 @@ float HPt3 float HPt4 bool bDebug = FALSE - -;=============================================== - -EVENT OnEffectStart(Actor Target, Actor Caster) - ;Setup stuff has to go here for activeMagicEffect - selfRef = caster - ; 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) -; ; debug.TraceConditional("TEST JOEL: Dragon Blood FX onEffectStart initialized", bDebug) - dragonBloodInit() -ENDEVENT - -EVENT onLoad() -; ; debug.traceConditional("TEST JOEL: Dragon has loaded ("+selfRef+")", bDebug) -endEVENT - -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. -; ; debug.TraceConditional("||===============================", bDebug) -; ; debug.TraceConditional("|| TEST JOEL: DRAGON HP DIAGNOSTIC", bDebug) -; ; debug.TraceConditional("|| TEST JOEL: Dragon previous HP="+previousHP, bDebug) -; ; debug.TraceConditional("|| TEST JOEL: Dragon current HP="+selfRef.getActorValue("health"), bDebug) - - diffHP = previousHP - (selfRef.getActorValue("health")) -; ; debug.TraceConditional("|| TEST JOEL: Dragon damaged for "+diffHP+"HP", bDebug) - - ; determine if I was hit in the front/back/left/right - hitAngle = selfRef.GetHeadingAngle(akAggressor) - if hitAngle >= -45 && hitAngle <= 45 - hitDirection = "FRONT" - ; decrement a fake HP counter for this side of the body - HPfront = (HPfront - diffHP) - endif - if hitAngle >= 135 || hitAngle <= -135 - hitDirection = "BACK" - ; decrement a fake HP counter for this side of the body - HPback = (HPback - diffHP) - endif - if hitAngle < -45 && hitAngle > -135 - hitDirection = "LEFT" - ; decrement a fake HP counter for this side of the body - HPleft = (HPleft - diffHP) - endif - if hitAngle > 45 && hitAngle < 135 - hitDirection = "RIGHT" - ; decrement a fake HP counter for this side of the body - HPright = (HPright - diffHP) - 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 +;2017-01-05 by Taka2nd ======================== +; +;Nexus ver1.2 +;・変数をデフォルトのものに戻す +;・不要な変数をコメントアウト +;Nexus ver1.2a +;・不要な変数をコメントアウトを外す +;Nexus ver1.2b +;・機能していない不要なイベント処理を削除 +; +; +;・PlaySubAnimation()の頻繁なエラーおよびエラースタック +;↓ +;PlaySubAnimation()へのコマンドが逆行および多重化を起こしていた +;→排他制御を行っていなかったのとグローバル変数で計算していたのが原因 +;↓ +;State文によるの排他の追加および変数の見直しにより解決、それにより多少の負荷軽減効果もあり +; +;・死亡チェックを追加 +;・HP計算の不具合→GetActorValuePercentage()に変更 +; +;・PlaySubAnimation()の定期的なエラー、Bleed**を順番通りに実行することで解決 +; +; +;Entire script rewritten for USLEEP 3.0.10. Used with permission from Taka2nd. + +Event OnEffectStart(Actor Target, Actor Caster) + selfRef = Caster + stateFront = 0 + stateBack = 0 + stateLeft = 0 + stateRight = 0 + PreviousHP = 1.0 + HPfront = 1.0 + HPback = 1.0 + HPleft = 1.0 + HPright = 1.0 + + ;USSEP 4.1.5 for Bug #13547: added this line: + USSEP_RegisterForAnimationEvents (selfRef) +endEvent + +State __Busy__ + Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) + endEvent +endState -; EVENT onDeath(actor myKiller) - ; utility.wait(8.5) - ; selfRef.PlaySubGraphAnimation("BloodFade") - ; utility.wait(1.5) -; ENDEVENT +Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) + GotoState("__Busy__") -;==================================================================== -; Initialize a bunch of variables -;==================================================================== -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 + if !selfRef + return ;OnHit Event Finish 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() -; ;Debug.Trace("This dragon is loaded, playing animations should work now") - + float fDiffHP = PreviousHP - fCurrentHP + 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) - ;Play your particles. - selfRef = caster - dragonHealth = selfRef.GetAV("Health") as int - ENDEVENT + endif + ;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) - - 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 +endEVENT - - ENDEVENT - - - EVENT onDeath(actor myKiller) +int FUNCTION GetBleedState(float fHP) + if fHP > HPpctT1 + return 0 + elseif fHP > HPpctT2 + return 1 + elseif fHP > HPpctT3 + return 2 + elseif fHP > HPpctT4 + return 3 + endif + return 4 +endFUNCTION - ; selfRef.UnequipItem(ChaurusSpitSkin) - - ENDEVENT -endSTATE - +;----------------------------------------------------------------- +; Added by USSEP 4.1.5 for Bug #13547: +;----------------------------------------------------------------- + +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 diff --git a/source/scripts/fxdraugrmagicscript.psc b/source/scripts/fxdraugrmagicscript.psc index 93b59b67..d218d431 100644 --- a/source/scripts/fxdraugrmagicscript.psc +++ b/source/scripts/fxdraugrmagicscript.psc @@ -23,7 +23,15 @@ weapon property Bow auto EVENT OnEffectStart(Actor Target, Actor 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() ;add darkened area fx to all magic draugr FXMagicDraugrDarkeningEffect.Play(selfRef, -1) @@ -50,6 +58,7 @@ weapon property Bow auto ENDEVENT Event OnEffectFinish(Actor akTarget, Actor akCaster) + FXMagicDraugrDarkeningEffect.Stop(selfRef) if myActorBase.GetSex() == 0 ;Play glow art @@ -71,7 +80,7 @@ weapon property Bow auto endEvent EVENT onDying(actor myKiller) - + ;DraugrMaleEyeGlowFX.Stop(selfRef) ;DraugrFemaleEyeGlowFX.Stop(selfRef) FXMagicDraugrDarkeningEffect.Stop(selfRef) diff --git a/source/scripts/fxdwarvencenturionscript.psc b/source/scripts/fxdwarvencenturionscript.psc index 61af39c3..5ec96e64 100644 --- a/source/scripts/fxdwarvencenturionscript.psc +++ b/source/scripts/fxdwarvencenturionscript.psc @@ -12,7 +12,15 @@ VisualEffect Property FXDwarvenCenturionArm02 Auto int test EVENT OnEffectStart(Actor Target, Actor 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) ; Debug.Trace("Dwarven cent is sleeping! 3") selfRef.PlaySubGraphAnimation( "StopEffect" ) @@ -24,6 +32,12 @@ int test ENDEVENT 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 " ) FXDwarvenCenturion.Play(selfRef, -1) FXDwarvenCenturionArm01.Play(selfRef, -1) diff --git a/source/scripts/fxdwarvenspherescript.psc b/source/scripts/fxdwarvenspherescript.psc index af9be74b..32f584b9 100644 --- a/source/scripts/fxdwarvenspherescript.psc +++ b/source/scripts/fxdwarvenspherescript.psc @@ -10,7 +10,16 @@ VisualEffect Property FXDwarvenSphereEffect Auto EVENT OnEffectStart(Actor Target, Actor 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 Event OnEffectFinish(Actor akTarget, Actor akCaster) diff --git a/source/scripts/fxdwarvenspiderscript.psc b/source/scripts/fxdwarvenspiderscript.psc index 6347e9fa..ec53c200 100644 --- a/source/scripts/fxdwarvenspiderscript.psc +++ b/source/scripts/fxdwarvenspiderscript.psc @@ -13,7 +13,17 @@ Explosion Property ExplosionDwarvenSpider Auto EVENT OnEffectStart(Actor Target, Actor 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 Event OnEffectFinish(Actor akTarget, Actor akCaster) diff --git a/source/scripts/fxgreybeardshoutscript.psc b/source/scripts/fxgreybeardshoutscript.psc index f9126657..4e5be822 100644 --- a/source/scripts/fxgreybeardshoutscript.psc +++ b/source/scripts/fxgreybeardshoutscript.psc @@ -30,7 +30,7 @@ state playing ; patch 1.9: event OnCellDetach() - debug.trace(self + "playing: OnCellDetach - enable trigger") +; debug.trace(self + "playing: OnCellDetach - enable trigger") WordTrigger.Enable() gotoState("waiting") endEvent diff --git a/source/scripts/fxsetblendvariablescript.psc b/source/scripts/fxsetblendvariablescript.psc index b5787154..f1284f44 100644 --- a/source/scripts/fxsetblendvariablescript.psc +++ b/source/scripts/fxsetblendvariablescript.psc @@ -34,6 +34,11 @@ int doWhileLoop endif ;Loop to change variable over time 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) SetAnimationVariableFloat("fToggleBlend", myRandom) myWaitTime = utility.RandomFloat(waitTimeMin,waitTimeMax) diff --git a/source/scripts/fxskeletonnecroscript.psc b/source/scripts/fxskeletonnecroscript.psc index 1221f689..2732ba2a 100644 --- a/source/scripts/fxskeletonnecroscript.psc +++ b/source/scripts/fxskeletonnecroscript.psc @@ -10,6 +10,13 @@ Actor selfRef EVENT OnEffectStart(Actor Target, Actor 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) FXSkeletonNecroEyeGlowEffect.play(selfRef, -1) ENDEVENT diff --git a/source/scripts/fxsovengardescript.psc b/source/scripts/fxsovengardescript.psc index bcb56502..4de0a0c1 100644 --- a/source/scripts/fxsovengardescript.psc +++ b/source/scripts/fxsovengardescript.psc @@ -8,8 +8,16 @@ ObjectReference myGlow EVENT OnEffectStart(Actor Target, Actor Caster) selfRef = caster + + ;USKP 2.0.1 - Stop this from attaching to the player. + if( selfRef == Game.GetPlayer() ) + Return + EndIf + ;float myScale = selfRef.getScale() ; ;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.setScale(myScale) SovengardeFXS.Play(selfRef) diff --git a/source/scripts/icewraithparticlesscript.psc b/source/scripts/icewraithparticlesscript.psc index 3d5dcec4..74b1333e 100644 --- a/source/scripts/icewraithparticlesscript.psc +++ b/source/scripts/icewraithparticlesscript.psc @@ -23,12 +23,22 @@ Activator property AshPileObject auto {The object we use as a pile.} - EVENT OnEffectStart(Actor Target, Actor Caster) - selfRef = caster - selfRef.setScale(RandomFloat(scaleRangeMin, scaleRangeMax)) - IceWraithParticles01.Play(selfRef, -1) + EVENT OnEffectStart(Actor Target, Actor Caster) + selfRef = caster + + ;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) - FXIceWraith2ndFormEffect.play(selfRef, -1) registerForAnimationEvent(selfRef, GroundDiveIceHazard) registerForAnimationEvent(selfRef, ChangeForms) ENDEVENT @@ -53,6 +63,7 @@ Activator property AshPileObject auto endEVENT EVENT onDying(actor myKiller) + IceWraithParticles01.Stop(selfRef) FXIceWraith2ndFormEffect.stop(selfRef) selfRef.unEquipItem(SkinIceWraithSmokeFins) diff --git a/source/scripts/magicattachashpileondeath.psc b/source/scripts/magicattachashpileondeath.psc index 45012052..a47583da 100644 --- a/source/scripts/magicattachashpileondeath.psc +++ b/source/scripts/magicattachashpileondeath.psc @@ -44,7 +44,7 @@ bool TargetIsImmune = True Event OnEffectStart(Actor Target, Actor Caster) victim = target ; DeadAlready = Victim.IsDead() - trace("victim == " + victim + ", is this right?") + ;trace("victim == " + victim + ", is this right?") EndEvent @@ -66,7 +66,7 @@ Event OnDying(Actor Killer) endif if TargetIsImmune == False - trace("victim just died") + ;trace("victim just died") ; DeadAlready = true victim.SetCriticalStage(Victim.CritStage_DisintegrateStart) ;victim.SetAlpha (0.99,False) diff --git a/source/scripts/magiceffectshadersonendscript.psc b/source/scripts/magiceffectshadersonendscript.psc index c8de1197..fee9c618 100644 --- a/source/scripts/magiceffectshadersonendscript.psc +++ b/source/scripts/magiceffectshadersonendscript.psc @@ -28,13 +28,16 @@ Float Property fDuration = 0.1 auto ;=============/ Event OnEffectFinish(Actor Target, Actor Caster) - if EffectShaderFX01 != None - EffectShaderFX01.Play(Target,fDuration) - endif - if EffectShaderFX02 != None - EffectShaderFX02.Play(Target,fDuration) - endif - if EffectShaderFX03 != None - EffectShaderFX03.Play(Target,fDuration) - endif + ;USKP 2.0.1 - Can't play stuff if 3D isn't loaded. + if( Target.Is3DLoaded() ) + if EffectShaderFX01 != None + EffectShaderFX01.Play(Target,fDuration) + endif + if EffectShaderFX02 != None + EffectShaderFX02.Play(Target,fDuration) + endif + if EffectShaderFX03 != None + EffectShaderFX03.Play(Target,fDuration) + endif + EndIf EndEvent diff --git a/source/scripts/pf_carryfirewood_000d97fa.psc b/source/scripts/pf_carryfirewood_000d97fa.psc index d64bff40..9fac3906 100644 --- a/source/scripts/pf_carryfirewood_000d97fa.psc +++ b/source/scripts/pf_carryfirewood_000d97fa.psc @@ -6,8 +6,7 @@ Scriptname PF_CarryFirewood_000D97FA Extends Package Hidden Function Fragment_2(Actor akActor) ;BEGIN CODE ; ; debug.trace(self + " OnEnd") -;ObjectReference meRef = akActor as ObjectReference -;(meRef as CarryActorScript).ChangeCarryState(false) +;(akActor as CarryActorScript).ChangeCarryState(false) ;END CODE EndFunction ;END FRAGMENT @@ -16,8 +15,8 @@ EndFunction Function Fragment_1(Actor akActor) ;BEGIN CODE ; ; debug.trace(self + " OnChange") -ObjectReference meRef = akActor as ObjectReference -(meRef as CarryActorScript).ChangeCarryState(false) +;USKP 2.0.1 - Properly handling itself as an Actor now. +(akActor as CarryActorScript).ChangeCarryState(false) ;END CODE EndFunction ;END FRAGMENT @@ -26,8 +25,8 @@ EndFunction Function Fragment_3(Actor akActor) ;BEGIN CODE ; ; debug.trace(self + " OnBegin") -ObjectReference meRef = akActor as ObjectReference -(meRef as CarryActorScript).ChangeCarryState(true) +;USKP 2.0.1 - Properly handling itself as an Actor now. +(akActor as CarryActorScript).ChangeCarryState(true) ;END CODE EndFunction ;END FRAGMENT diff --git a/source/scripts/playerbookshelfclicktriggerscript.psc b/source/scripts/playerbookshelfclicktriggerscript.psc index 90ab7ee9..b5c0eeca 100644 --- a/source/scripts/playerbookshelfclicktriggerscript.psc +++ b/source/scripts/playerbookshelfclicktriggerscript.psc @@ -20,7 +20,7 @@ endEVENT 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) endEVENT diff --git a/source/scripts/playerbookshelfcontainerscript.psc b/source/scripts/playerbookshelfcontainerscript.psc index f93dc73d..20a58148 100644 --- a/source/scripts/playerbookshelfcontainerscript.psc +++ b/source/scripts/playerbookshelfcontainerscript.psc @@ -1,4 +1,5 @@ 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 utility @@ -133,6 +134,7 @@ GlobalVariable Property BookShelfGlobal Auto {Global showing whether or not the player has ever activated a bookshelf} + EVENT OnCellLoad() if AlreadyLoaded == FALSE ;Trace("BOOKCASE - Running OnCellLoad()") @@ -164,13 +166,23 @@ EVENT OnCellLoad() AlreadyLoaded = TRUE 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) ; Removing all items from container as a precaution ;Trace("BOOKCASE - I've been ACTIVATED!") + + ;USLEEP 3.0.1 - Bug #19515 + CleanInvalidPlacedBooks() + CurrentBookAmount = NumBooksOnShelf() + BlockActivate() ;Trace("BOOKCASE - Blocking activate on all books") ;Trace("BOOKCASE - BookShelfTrigger01Ref = " + BookShelfTrigger01Ref) @@ -202,6 +214,17 @@ EVENT OnActivate(ObjectReference akActionRef) Wait(0.25) ; 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") UpdateBooks() @@ -394,7 +417,8 @@ endFunction 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 if PlacedBook01 == BookBase ;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") PlacedBook18 = BookBase endif - + BookAmount = BookAmount - 1 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 ; 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 - if PlacedBookRef + ;USLEEP 3.0.1 - Bug #19515 added form ID check here. + if PlacedBookRef && PlacedBookRef.GetFormID() PlacedBookRef.Disable() PlacedBookRef.Delete() endIf @@ -613,9 +638,373 @@ Function UpdateBooks() GoToState("") ; Now allow books to be updated again EndFunction + State PlacingBooks Function UpdateBooks() ; Already updating books, so ignore EndFunction EndState - \ No newline at end of file + + +; +; ;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 diff --git a/source/scripts/playerbookshelftriggerscript.psc b/source/scripts/playerbookshelftriggerscript.psc index c0a40da8..2c56b9d1 100644 --- a/source/scripts/playerbookshelftriggerscript.psc +++ b/source/scripts/playerbookshelftriggerscript.psc @@ -1,4 +1,5 @@ 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 utility @@ -36,14 +37,16 @@ auto STATE WaitForBooks ;Trace("DARYL - " + self + " Player has a hold of this reference, do nothing") else ; Player isnt' grabbing this reference, check to see if it's in the container. - if Shelfcontainer.GetItemCount(TriggerRef.GetBaseObject()) >= 1 - Shelfcontainer.RemoveItem(TriggerRef.GetBaseObject(), 1) - (Shelfcontainer as PlayerBookShelfContainerScript).CurrentBookAmount = (Shelfcontainer as PlayerBookShelfContainerScript).CurrentBookAmount - 1 - (ShelfContainer as PlayerBookShelfContainerScript).RemoveBooks((TriggerRef.GetBaseObject()), 1) - else + ;Trace("BookShelfFix Trigger - Trying to pick up " + TriggerRef) + ;if Shelfcontainer.GetItemCount(TriggerRef.GetBaseObject()) >= 1 + ;USLEEP 3.0.1 - Bug #19515 + (Shelfcontainer as PlayerBookShelfContainerScript).PickUp(TriggerRef) + ;(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 ;Trace("DARYL - " + self + " Container doesn't contain this book") - endif + ;endif endif endif endEvent @@ -59,5 +62,4 @@ STATE IgnoreBooks endSTATE - int Property testint Auto diff --git a/source/scripts/playerpotionrackclicktriggerscript.psc b/source/scripts/playerpotionrackclicktriggerscript.psc index 29a1aee0..a4d64af4 100644 --- a/source/scripts/playerpotionrackclicktriggerscript.psc +++ b/source/scripts/playerpotionrackclicktriggerscript.psc @@ -20,7 +20,7 @@ endEVENT 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) endEVENT diff --git a/source/scripts/playerpotionracktriggerscript.psc b/source/scripts/playerpotionracktriggerscript.psc index 870a15ef..12f764d5 100644 --- a/source/scripts/playerpotionracktriggerscript.psc +++ b/source/scripts/playerpotionracktriggerscript.psc @@ -19,16 +19,16 @@ endEVENT STATE WaitForBooks EVENT OnBeginState() - trace(self + " BOOKTRIGGER - Waiting For Books!") + ;trace(self + " BOOKTRIGGER - Waiting For Books!") endEVENT EVENT OnTriggerEnter(ObjectReference TriggerRef) - Trace("DARYL - " + self + " Reference " + TriggerRef + " has ENTERED") + ;Trace("DARYL - " + self + " Reference " + TriggerRef + " has ENTERED") endEvent EVENT OnTriggerLeave(ObjectReference TriggerRef) - Trace("DARYL - " + self + " Reference " + TriggerRef + " has EXITED") + ;Trace("DARYL - " + self + " Reference " + TriggerRef + " has EXITED") Shelfcontainer.RemoveItem(TriggerRef.GetBaseObject(), 1) (Shelfcontainer as PlayerBookShelfContainerScript).CurrentBookAmount = (Shelfcontainer as PlayerBookShelfContainerScript).CurrentBookAmount - 1 (ShelfContainer as PlayerBookShelfContainerScript).RemoveBooks((TriggerRef.GetBaseObject()), 1) @@ -40,7 +40,7 @@ endSTATE auto STATE IgnoreBooks Event OnBeginState() - trace(self + " BOOKTRIGGER - Ignoring Books!") + ;trace(self + " BOOKTRIGGER - Ignoring Books!") endEVENT endSTATE diff --git a/source/scripts/reanimateashpile.psc b/source/scripts/reanimateashpile.psc index f71f6ec8..2bf9f6f0 100644 --- a/source/scripts/reanimateashpile.psc +++ b/source/scripts/reanimateashpile.psc @@ -55,27 +55,33 @@ bool function IsSummoned() endIf endFunction -bool function TurnToAsh() - trace("victim just died") +function TurnToAsh() + ;trace("victim just died") victim.SetCriticalStage(Victim.CritStage_DisintegrateStart) ; victim.SetAlpha (0.99,False) - if MagicEffectShader != none - MagicEffectShader.play(Victim,ShaderDuration) - endif - if bSetAlphaToZeroEarly - victim.SetAlpha (0.0,True) - endif + ;USKP 2.0.3 - Victim needs to have 3D loaded. + if( Victim.Is3DLoaded() ) + if MagicEffectShader != none + MagicEffectShader.play(Victim,ShaderDuration) + endif + if bSetAlphaToZeroEarly + victim.SetAlpha (0.0,True) + endif + EndIf utility.wait(fDelay) Victim.AttachAshPile(AshPileObject) ; AshPileRef = AshPileObject ; AshPileRef.SetAngle(0.0,0.0,(Victim.GetAngleZ())) utility.wait(fDelayEnd) - if MagicEffectShader != none - MagicEffectShader.stop(Victim) - endif - if bSetAlphaZero == True - victim.SetAlpha (0.0,True) - endif + ;USKP 2.0.3 - Victim needs to have 3D loaded. + if( Victim.Is3DLoaded() ) + if MagicEffectShader != none + MagicEffectShader.stop(Victim) + endif + if bSetAlphaZero == True + victim.SetAlpha (0.0,True) + EndIf + EndIf victim.SetCriticalStage(Victim.CritStage_DisintegrateEnd) endFunction @@ -111,8 +117,11 @@ EndEvent Event OnEffectFinish(Actor Target, Actor Caster) if TargetIsImmune == False && AshPileCreated == False - TurnToAsh() - AshPileCreated = True + ;USLEEP 3.0.1 - Prevent thralls from being purged before they died + if( !Target.IsCommandedActor() ) + TurnToAsh() + AshPileCreated = True + endif endif EndEvent diff --git a/source/scripts/silverswordscript.psc b/source/scripts/silverswordscript.psc index 03c8852f..7689aefb 100644 --- a/source/scripts/silverswordscript.psc +++ b/source/scripts/silverswordscript.psc @@ -1,11 +1,15 @@ 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 Event OnEquipped(Actor akActor) - akActor.AddPerk(SilverPerk) + if( !akActor.HasPerk(SilverPerk) ) + akActor.AddPerk(SilverPerk) + EndIf EndEvent Event OnUnEquipped(Actor akActor) - akActor.RemovePerk(SilverPerk) -EndEvent \ No newline at end of file + ;akActor.RemovePerk(SilverPerk) +EndEvent \ No newline at end of file diff --git a/source/scripts/spiderwebanimationsscript.psc b/source/scripts/spiderwebanimationsscript.psc index cce8d4ad..0b606e0d 100644 --- a/source/scripts/spiderwebanimationsscript.psc +++ b/source/scripts/spiderwebanimationsscript.psc @@ -33,8 +33,14 @@ EffectShader Property WebbedFXS auto Function playWebAnimations(int iRand) ;notification("Rand = " + iRand) 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) - myActor.playIdle( idleWebThrashShort ); + myActor.playIdle( idleWebThrashShort ) else if(iRand == 2 && !stopCondition) myActor.playIdle( idleWebThrashShort2 ) diff --git a/source/scripts/sprigganswarmactorscript.psc b/source/scripts/sprigganswarmactorscript.psc index c426e795..8d926681 100644 --- a/source/scripts/sprigganswarmactorscript.psc +++ b/source/scripts/sprigganswarmactorscript.psc @@ -26,6 +26,13 @@ ObjectReference selfRef 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) int i = 10 ; recursion limiter for 3dLoaded check while selfRef.is3dLoaded() == FALSE diff --git a/source/scripts/trapbear.psc b/source/scripts/trapbear.psc index 2e04b679..10a9e022 100644 --- a/source/scripts/trapbear.psc +++ b/source/scripts/trapbear.psc @@ -9,17 +9,20 @@ perk property LightFoot auto bool property checkForLightFootPerk = true Auto {default == true} 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() goToState("Closed") self.reset() + + BeenReset = False endEvent - event onLoad() hitBase = (self as objectReference) as TrapHitBase ResolveLeveledDamage() - if StartOpen + if StartOpen && !BeenReset + BeenReset = True playAnimation("StartOpen") goToState("Open") endif diff --git a/source/scripts/trapdweflamepillar.psc b/source/scripts/trapdweflamepillar.psc index 0e6bbeea..666e84f4 100644 --- a/source/scripts/trapdweflamepillar.psc +++ b/source/scripts/trapdweflamepillar.psc @@ -25,10 +25,11 @@ bool property hasPlayedAttackAnimOnce = false auto hidden event onLoad() - float CV = (rotationSpeed * getAnimationVariableFloat("CV")) - float CCV = (rotationSpeed * getAnimationVariableFloat("CCV")) - SetAnimationVariableFloat("CV", CV) - SetAnimationVariableFloat("CCV", CCV) +;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 CV = (rotationSpeed * getAnimationVariableFloat("CV")) +; float CCV = (rotationSpeed * getAnimationVariableFloat("CCV")) +; SetAnimationVariableFloat("CV", CV) +; SetAnimationVariableFloat("CCV", CCV) ;hitBase = (self as objectReference) as TrapDweFlamePillarHit endEvent diff --git a/source/scripts/traphitbase.psc b/source/scripts/traphitbase.psc index 25a75d22..1817af6e 100644 --- a/source/scripts/traphitbase.psc +++ b/source/scripts/traphitbase.psc @@ -83,8 +83,13 @@ state CanHit actor myTarget myTarget = akTarget as Actor - if canDisease && isPlayer - if randomFloat(0.0, 100.0) <= diseaseChance + ;USSEP 4.2.5 Bug #29500 - Traps weren't accounting for players' disease resistance. + 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 diseasePick = randomInt(1,6) if diseasePick == 1 diff --git a/source/scripts/trapsoulgemcontroller.psc b/source/scripts/trapsoulgemcontroller.psc index 1806c24c..91336a31 100644 --- a/source/scripts/trapsoulgemcontroller.psc +++ b/source/scripts/trapsoulgemcontroller.psc @@ -34,7 +34,8 @@ endState state inMagicTrap event onBeginState() - (self as objectReference).SetMotionType(4) + ;USLEEP 3.08 Bug #14888 + ;(self as objectReference).SetMotionType(4) ; ;debug.Trace(self + " has begun inMagicTrap") ;self.TranslateTo(self.getpositionx(), self.getpositiony(), self.getpositionz(), self.getAngleX(), self.getAngleY() + 180, self.getAngleZ(), idleRotateSpeed) endEvent diff --git a/source/scripts/traptriggerbase.psc b/source/scripts/traptriggerbase.psc index a62e23a6..8ec97952 100644 --- a/source/scripts/traptriggerbase.psc +++ b/source/scripts/traptriggerbase.psc @@ -133,6 +133,11 @@ Event onCellLoad() endif endEvent +;USSEP 4.2.2 Bug #28300 +Event OnCellDetach() + lastTriggerRef = None +endEvent + ;THIS SECTION IS USED FOR TRAP LINKERS event onActivate(objectReference akActivator) ; debug.Trace(self + " has been activated by + " + akActivator) @@ -262,7 +267,7 @@ State Active endEvent event OnMagicEffectApply(objectReference akCaster, MagicEffect akEffect) - Trace("MagicEffectHit") + ;Trace("MagicEffectHit") activate(self as objectReference) goToState( "Inactive" ) endEvent diff --git a/source/scripts/traptriggerhinge.psc b/source/scripts/traptriggerhinge.psc index 23ee264a..9893b21e 100644 --- a/source/scripts/traptriggerhinge.psc +++ b/source/scripts/traptriggerhinge.psc @@ -79,7 +79,7 @@ EndState state Triggered 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) playAnimation("Trigger01") EndEvent diff --git a/source/scripts/tripwire.psc b/source/scripts/tripwire.psc index 03178d51..9a20cf62 100644 --- a/source/scripts/tripwire.psc +++ b/source/scripts/tripwire.psc @@ -1,81 +1,66 @@ scriptName Tripwire extends TrapTriggerBase -; -; -; -;================================================================ -; event onActivate(objectReference akActivator) - ; if (akActivator as actor) && akActivator != (self as objectReference) - ; goToState("Active") - ; endif -; endEvent State Active + Event OnBeginState() - SetMotionType(1) - TriggerSound.play( self as ObjectReference) ;play trigger sound - self.blockActivation(false) - activate(self as objectReference) - self.blockActivation(true) - PlayAnimation("Trigger") - goToState("DoNothing") - ;applyHavokImpulse 15 0 0 -1 ;push down at a force of 15 to break the havok constraint. - - endEvent - - event onActivate(objectReference akActivator) - endEvent - - event OnTriggerEnter( objectReference triggerRef ) - endEvent + SetMotionType (1) + TriggerSound.play (Self as ObjectReference) + Self.blockActivation (False) + Activate (Self as ObjectReference) + Self.blockActivation (True) + PlayAnimation ("Trigger") + GoToState ("DoNothing") + EndEvent - event OnTriggerLeave( objectReference triggerRef ) - endEvent - - Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) - endEvent -endState + Event OnHit (ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, Bool abBashAttack, Bool abHitBlocked) + EndEvent -State DoNothing ;Dummy state, don't do anything if animating - event onBeginState() - setDestroyed(true) - endEvent +EndState + +State DoNothing + + Event OnBeginState() + SetDestroyed (True) + EndEvent + + Event OnLoad() + EndEvent - event OnTriggerEnter( objectReference triggerRef ) - endEvent - - event OnTriggerLeave( objectReference triggerRef ) - endEvent - - event onCellAttach() - endEvent EndState -Event OnCellAttach() +Event OnLoad() + SetMotionType(4) + EndEvent ;/ Event OnCellDetach() + SetMotionType(1) + EndEvent /; -function localActivateFunction() - goToState("Active") -endFunction +Function LocalActivateFunction() -Event onReset() - self.reset() - SetMotionType(4) - self.clearDestruction() - self.setDestroyed(False) - goToState("Inactive") + GoToState ("Active") + +EndFunction + +Event OnReset() + + 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 -endEvent + +EndEvent 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") -endEvent + GoToState ("Active") +EndEvent diff --git a/source/scripts/weaponracktriggerscript.psc b/source/scripts/weaponracktriggerscript.psc index 456e2a30..4d662f0c 100644 --- a/source/scripts/weaponracktriggerscript.psc +++ b/source/scripts/weaponracktriggerscript.psc @@ -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 debug import utility +;------------------------------------------- + Keyword Property WRackActivator Auto ;The activator we must disable if there is already something in this trigger ObjectReference Property ActivatorRef Auto Hidden - +;/// ;Reference that is currently in the trigger ObjectReference Property RefCurrentlyInTrig Auto Hidden @@ -16,87 +22,238 @@ ObjectReference Property RefCurrentlyInTrig Auto Hidden Bool Property HasBeenTriggered Auto Hidden Int Property numInTrig Auto Hidden - +///; Bool Property AlreadyInit Auto Hidden 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 - ;Trace("DARYL - " + self + " running OnReset() and AlreadyInit = " + AlreadyInit) + endEVENT -EVENT OnLoad() - ;Trace("DARYL - " + self + " running OnLoad() and AlreadyInit = " + AlreadyInit) - if (AlreadyInit == FALSE) && (self.IsEnabled()) - ActivatorRef = GetLinkedRef(WRackActivator) - if (ActivatorRef) - ActivatorRef.Enable() - endif - ActivatorRef = NONE - AlreadyInit = TRUE - ;Trace("DARYL - " + self + " The Activator Ref is " + ActivatorRef) - else - ;Do nothing - endif - ;Trace("DARYL - " + self + " finishing OnLoad() and AlreadyInit = " + AlreadyInit) +;/------------------------------------------ + This event must be present to catch extant USKP 2.0.0 racks, + or otherwise without known state. + + This is present solely for backward compatibility. +/; +EVENT OnCellAttach(); replace OnCellLoad() + + TriggerSetup("Trigger:OnCellAttach") + endEVENT -;EVENT OnCellLoad() -; ;Trace("DARYL - " + self + " running OnCellLoad() and AlreadyInit = " + AlreadyInit) -; if (AlreadyInit == FALSE) && (self.IsEnabled()) -; ActivatorRef = GetLinkedRef(WRackActivator) -; AlreadyInit = TRUE -; ;Trace("DARYL - " + self + " The Activator Ref is " + ActivatorRef) -; else -; ;Do nothing -; endif -; ;Trace("DARYL - " + self + " finishing OnCellLoad() and AlreadyInit = " + AlreadyInit) -;endEVENT +;/------------------------------------------ + This state must be present to catch extant USKP 1.3.3 racks. + + (1) The activator is known to be missing, but can be resuscitated. + + (2) The activator status is currently being tested. Suppress redundant + OnLoad() and trigger events. + + (3) The activator is either enabled (and the rack empty, so the trigger + won't be needed anyway) or running a placement procedure. OnTriggerLeave() + 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 - EVENT onTriggerEnter(objectReference triggerRef) - ;Trace("DARYL - " + self + " Just OnTriggerEntered by " + triggerref) - - 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) - HasBeenTriggered = TRUE - ActivatorRef = GetLinkedRef(WRackActivator) - if ActivatorRef - ActivatorRef.Disable() - endif - ActivatorRef = NONE - endif - - + +;/ Catch newly enabled racks without player present. + + Previously placed items must be renewed on every cell attach, + re-adjusting to current game mesh defined nodes. +/; + EVENT OnCellAttach() + + TriggerSetup("WFR:OnCellAttach") + 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) - ;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 + ActivatorScript = NONE + return + EndIf + + If ActivatorScript.RackWasTriggered(triggerRef, GetTriggerObjectCount()) + GoToState("WaitingForReference") + ;~ Trace(Self + "OnTriggerLeave() retain 'WaitingForReference' state.") + EndIf + + ActivatorRef = NONE + ActivatorScript = NONE - endif endEVENT 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