Added USSEP fixes to 47 scripts

This commit is contained in:
Eddoursul 2023-12-06 16:31:10 +01:00
parent 3bdb55885c
commit ae5bb8af7d
92 changed files with 1157 additions and 559 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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)

View File

@ -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

View File

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

View File

@ -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

View File

@ -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
endEVENT

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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")

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
;===============================================
;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)
;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
; EVENT onDeath(actor myKiller)
; utility.wait(8.5)
; selfRef.PlaySubGraphAnimation("BloodFade")
; utility.wait(1.5)
; ENDEVENT
;====================================================================
; 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
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
STATE markSTATE
Event OnLoad()
; ;Debug.Trace("This dragon is loaded, playing animations should work now")
endEvent
EVENT OnEffectStart(Actor Target, Actor Caster)
;Play your particles.
selfRef = caster
dragonHealth = selfRef.GetAV("Health") as int
ENDEVENT
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)
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
endState
ENDEVENT
EVENT onDeath(actor myKiller)
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
; selfRef.UnequipItem(ChaurusSpitSkin)
ENDEVENT
endSTATE
GotoState("__Busy__")
if !selfRef
return ;OnHit Event Finish
endif
if akAggressor
float fCurrentHP = selfRef.GetActorValuePercentage("health")
if fCurrentHP <= 0
return ;OnHit Event Finish
endif
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
endif
endif
;Debug.Trace("OnHit : akAggressor=" + akAggressor + " : akSource=" + akSource + " (" + akSource.GetType() + ") : akProjectile=" + akProjectile)
GotoState("")
endEVENT
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
;-----------------------------------------------------------------
; 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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
;
; ;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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
;akActor.RemovePerk(SilverPerk)
EndEvent

View File

@ -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 )

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.
SetMotionType (1)
TriggerSound.play (Self as ObjectReference)
Self.blockActivation (False)
Activate (Self as ObjectReference)
Self.blockActivation (True)
PlayAnimation ("Trigger")
GoToState ("DoNothing")
EndEvent
Event OnHit (ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, Bool abBashAttack, Bool abHitBlocked)
EndEvent
endEvent
event onActivate(objectReference akActivator)
endEvent
event OnTriggerEnter( objectReference triggerRef )
endEvent
event OnTriggerLeave( objectReference triggerRef )
endEvent
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
endEvent
endState
State DoNothing ;Dummy state, don't do anything if animating
event onBeginState()
setDestroyed(true)
endEvent
event OnTriggerEnter( objectReference triggerRef )
endEvent
event OnTriggerLeave( objectReference triggerRef )
endEvent
event onCellAttach()
endEvent
EndState
Event OnCellAttach()
State DoNothing
Event OnBeginState()
SetDestroyed (True)
EndEvent
Event OnLoad()
EndEvent
EndState
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

View File

@ -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 ***
EVENT OnReset()
AlreadyInit = FALSE
;Trace("DARYL - " + self + " running OnReset() and AlreadyInit = " + AlreadyInit)
endEVENT
Keyword Property ArmorShield Auto
EVENT OnLoad()
;Trace("DARYL - " + self + " running OnLoad() and AlreadyInit = " + AlreadyInit)
if (AlreadyInit == FALSE) && (self.IsEnabled())
ActivatorRef = GetLinkedRef(WRackActivator)
if (ActivatorRef)
ActivatorRef.Enable()
endif
;-------------------------------------------
;*** 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
AlreadyInit = TRUE
;Trace("DARYL - " + self + " The Activator Ref is " + ActivatorRef)
else
;Do nothing
endif
;Trace("DARYL - " + self + " finishing OnLoad() and AlreadyInit = " + AlreadyInit)
ActivatorScript = NONE
Return True
EndIf
Return False
EndFunction
;-------------------------------------------
EVENT OnCellDetach(); replace OnReset()
AlreadyInit = FALSE
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 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()
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
TriggerSetup("Trigger:OnCellAttach")
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
;/ 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