4
Fork 0

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

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

Loading…
Cancel
Save