1
Fork 0

Oil traps ignite from lightning spells, fixed logical mistakes in TrapExplosiveGas, preventing ignition in some cases

development
Eddoursul 4 months ago
parent 6fd74fd583
commit 8c999a6fd6
  1. BIN
      Skyrim.esm
  2. BIN
      scripts/trapexplosivegas.pex
  3. 81
      source/scripts/trapexplosivegas.psc

Binary file not shown.

Binary file not shown.

@ -30,7 +30,7 @@ bool property checkActorMagic = TRUE auto
keyword property flameKeyword Auto keyword property flameKeyword Auto
keyword property lightningKeyword auto keyword property lightningKeyword auto
bool property lightningIgnites = FALSE Auto bool property lightningIgnites = TRUE Auto
{if this is true lightning should ignite this trap {if this is true lightning should ignite this trap
default == false} default == false}
@ -57,7 +57,7 @@ auto state waiting
ElseIf( flExplodesGasTrapOnHit != NONE && flExplodesGasTrapOnHit.hasForm(akProjectile) ) ElseIf( flExplodesGasTrapOnHit != NONE && flExplodesGasTrapOnHit.hasForm(akProjectile) )
; debug.Trace(self + " is exploding due to " + akProjectile) ; debug.Trace(self + " is exploding due to " + akProjectile)
GasExplode(akAggressor) GasExplode(akAggressor)
ElseIf akWeapon.HasKeyword(flameKeyword) ElseIf akWeapon.HasKeyword(flameKeyword) || ( lightningIgnites && akWeapon.HasKeyword(lightningKeyword) )
; debug.Trace(self + " is exploding due to " + akWeapon + " - hasKeyword") ; debug.Trace(self + " is exploding due to " + akWeapon + " - hasKeyword")
GasExplode(akAggressor) GasExplode(akAggressor)
endif endif
@ -97,37 +97,34 @@ auto state waiting
event onTriggerEnter(objectReference triggerRef) event onTriggerEnter(objectReference triggerRef)
if (triggerRef as Actor) || !storedObjRef || storedObjRef.getBaseObject() != triggerRef.getBaseObject() if ! triggerRef
if !(triggerRef as Actor) return
storedObjRef = triggerRef endif
endIf
; debug.Trace(self + " is testing " + triggerRef + " due to onTriggerEnter") Actor triggerActor = triggerRef as Actor
if !triggerActor
if flExplodesGasTrapOnEnter.hasForm(triggerRef.GetBaseObject()) if flExplodesGasTrapOnEnter.hasForm(triggerRef.GetBaseObject())
; debug.Trace(self + " is exploding due to " + triggerRef)
GasExplode(triggerRef) GasExplode(triggerRef)
; Checking to see if the entering ref is an actor endif
elseif (triggerRef as Actor) return
;check actor equipped items if necessary endif
if checkActorEquippedItems
checkActorWeapons(triggerRef as actor) if checkActorEquippedItems && checkActorWeapons(triggerActor)
elseif checkActorMagic return
If (triggerRef as actor).hasMagicEffectWithKeyword(flameKeyword) endif
; debug.Trace(self + " is exploding due to " + triggerRef + " having flame effect")
GasExplode(triggerRef) if checkActorMagic
ElseIf lightningIgnites If triggerActor.hasMagicEffectWithKeyword(flameKeyword)
if (triggerRef as actor).hasMagicEffectWithKeyword(lightningKeyword) GasExplode(triggerRef)
; debug.Trace(self + " is exploding due to " + triggerRef + " having lightning effect") ElseIf lightningIgnites
GasExplode(triggerRef) if triggerActor.hasMagicEffectWithKeyword(lightningKeyword)
endif GasExplode(triggerRef)
endif
endif endif
endif endif
endif endif
endEvent endEvent
EndState EndState
function GasExplode(objectReference causeActor) function GasExplode(objectReference causeActor)
@ -138,41 +135,31 @@ function GasExplode(objectReference causeActor)
self.damageObject(5) self.damageObject(5)
endFunction endFunction
function checkActorWeapons(actor triggerActor) bool function checkActorWeapons(actor triggerActor)
; Checking if Torch is equipped ; Checking if Torch is equipped
if triggerActor.GetEquippedItemType(0) == 11 || triggerActor.GetEquippedItemType(1) == 11 if triggerActor.GetEquippedItemType(0) == 11 || triggerActor.GetEquippedItemType(1) == 11
GasExplode(triggerActor) GasExplode(triggerActor)
; Checking if the player has weapons drawn return true
ElseIf triggerActor.IsWeaponDrawn() ;This should be a function check later endif
;if the player has a flamable spell equiped and drawn If triggerActor.IsWeaponDrawn()
; debug.Trace(self + " is testing " + (triggerActor).GetEquippedSpell(0) + " due to onTriggerEnter") if IsIgnitingSpell(triggerActor.GetEquippedSpell(1)) || IsIgnitingSpell(triggerActor.GetEquippedSpell(0))
; debug.Trace(self + " is testing " + (triggerActor).GetEquippedSpell(1) + " due to onTriggerEnter")
;USKP 2.0.1 - Make sure they have something equipped before checking it.
if triggerActor.GetEquippedSpell(0) && triggerActor.GetEquippedSpell(0).hasKeyword(flameKeyword) ;check left hand
GasExplode(triggerActor)
elseif triggerActor.GetEquippedSpell(1) && flExplodesGasTrapEquippedSpell.hasForm(triggerActor.GetEquippedSpell(1) as form) ;check right hand
GasExplode(triggerActor) GasExplode(triggerActor)
return true
endif endif
endif endif
return false
endFunction endFunction
bool function IsIgnitingSpell(Spell aSpell)
return aSpell && ( aSpell.hasKeyword(flameKeyword) || ( lightningIgnites && aSpell.hasKeyword(lightningKeyword) ) || flExplodesGasTrapEquippedSpell.hasForm(aSpell as form) )
endfunction
event onReset() event onReset()
self.reset() self.reset()
self.clearDestruction() self.clearDestruction()
goToState("waiting") goToState("waiting")
endEvent endEvent
event OnDestructionStageChanged(int aiOldStage, int aiCurrentStage) event OnDestructionStageChanged(int aiOldStage, int aiCurrentStage)
; debug.Trace(self + " has received destruction event #" + aiCurrentStage) ; debug.Trace(self + " has received destruction event #" + aiCurrentStage)
endEvent endEvent

Loading…
Cancel
Save