2021-10-05 22:15:58 +00:00
|
|
|
scriptName TrapExplosiveGas extends objectReference
|
|
|
|
|
|
|
|
formlist property flExplodesGasTrapOnHit auto
|
|
|
|
{projectiles that will set this off when they hit}
|
|
|
|
|
|
|
|
formlist property flExplodesGasTrapOnEnter auto
|
|
|
|
{objects that will set this off when they enter}
|
|
|
|
|
|
|
|
formlist property flExplodesGasTrapOnMagicEffectApply auto
|
|
|
|
{magicEffects that will set this off when applied}
|
|
|
|
|
|
|
|
formlist property flExplodesGasTrapEquippedSpell auto
|
|
|
|
{Spells that will set this off if equipped and drawn}
|
|
|
|
|
|
|
|
formlist property trapGasWeapon auto
|
|
|
|
{weapons that will set this off on hit, specifically explosions}
|
|
|
|
|
|
|
|
bool property checkActorEquippedItems = TRUE auto
|
|
|
|
{Whether or not to check items the player is carrying
|
|
|
|
default = True on explosive gas
|
|
|
|
set to off on oil pool}
|
|
|
|
bool property checkActorMagic = TRUE auto
|
|
|
|
{check the actors drawn magic
|
|
|
|
default = true on explosive gas
|
|
|
|
set to off on oil pool}
|
|
|
|
|
|
|
|
keyword property flameKeyword Auto
|
|
|
|
keyword property lightningKeyword auto
|
2024-01-19 01:32:53 +00:00
|
|
|
bool property lightningIgnites = TRUE Auto
|
2021-10-05 22:15:58 +00:00
|
|
|
{if this is true lightning should ignite this trap
|
2024-01-19 03:25:20 +00:00
|
|
|
default == true}
|
2021-10-05 22:15:58 +00:00
|
|
|
|
|
|
|
light property Torch01 auto
|
|
|
|
projectile property storedProjectile auto hidden
|
|
|
|
MagicEffect property storedEffect1 auto hidden
|
|
|
|
MagicEffect property storedEffect2 auto hidden
|
|
|
|
MagicEffect property storedEffect3 auto hidden
|
|
|
|
MagicEffect property storedEffect4 auto hidden
|
|
|
|
int property storedEffectIncrement = 1 auto hidden
|
|
|
|
|
|
|
|
auto state waiting
|
|
|
|
;Start of the new script
|
|
|
|
event onHit(objectReference akAggressor, form akWeapon, projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
|
|
|
|
if !akProjectile || akProjectile != storedProjectile
|
|
|
|
storedProjectile = akProjectile
|
|
|
|
|
|
|
|
;USKP 1.3.2 added NONE checks due to numerous Papyrus errors.
|
|
|
|
If( (trapGasWeapon != NONE && trapGasWeapon.hasForm(akWeapon)) || akweapon == torch01 )
|
|
|
|
GasExplode(akAggressor)
|
|
|
|
ElseIf( flExplodesGasTrapOnHit != NONE && flExplodesGasTrapOnHit.hasForm(akProjectile) )
|
|
|
|
GasExplode(akAggressor)
|
2024-01-19 01:32:53 +00:00
|
|
|
ElseIf akWeapon.HasKeyword(flameKeyword) || ( lightningIgnites && akWeapon.HasKeyword(lightningKeyword) )
|
2021-10-05 22:15:58 +00:00
|
|
|
GasExplode(akAggressor)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endEvent
|
|
|
|
|
|
|
|
event OnMagicEffectApply(ObjectReference akCaster, MagicEffect akEffect)
|
|
|
|
if akEffect == storedEffect1 || akEffect == storedEffect2 || akEffect == storedEffect3 || akEffect == storedEffect4
|
|
|
|
;if the effect == any of the stored effects do nothing
|
|
|
|
else
|
|
|
|
if storedEffectIncrement == 1
|
|
|
|
storedEffect1 = akEffect
|
|
|
|
storedEffectIncrement = 2
|
|
|
|
elseif storedEffectIncrement == 2
|
|
|
|
storedEffect2 = akEffect
|
|
|
|
storedEffectIncrement = 3
|
|
|
|
elseif storedEffectIncrement == 3
|
|
|
|
storedEffect3 = akEffect
|
|
|
|
storedEffectIncrement = 4
|
|
|
|
else
|
|
|
|
storedEffect4 = akEffect
|
|
|
|
storedEffectIncrement = 1
|
|
|
|
endif
|
|
|
|
if flExplodesGasTrapOnMagicEffectApply.hasForm(akEffect as form)
|
|
|
|
GasExplode(akCaster)
|
|
|
|
elseif akEffect.hasKeyword(flameKeyword)
|
|
|
|
GasExplode(akCaster)
|
|
|
|
elseif lightningIgnites && akEffect.hasKeyword(lightningKeyword)
|
|
|
|
GasExplode(akCaster)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endEvent
|
|
|
|
|
|
|
|
|
|
|
|
event onTriggerEnter(objectReference triggerRef)
|
2024-01-19 01:32:53 +00:00
|
|
|
if ! triggerRef
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
|
|
|
|
Actor triggerActor = triggerRef as Actor
|
|
|
|
|
|
|
|
if !triggerActor
|
2021-10-05 22:15:58 +00:00
|
|
|
if flExplodesGasTrapOnEnter.hasForm(triggerRef.GetBaseObject())
|
|
|
|
GasExplode(triggerRef)
|
2024-01-19 01:32:53 +00:00
|
|
|
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)
|
2021-10-05 22:15:58 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endEvent
|
|
|
|
|
|
|
|
EndState
|
|
|
|
|
|
|
|
function GasExplode(objectReference causeActor)
|
2024-01-19 03:25:20 +00:00
|
|
|
self.setActorCause(causeActor as actor)
|
2021-10-05 22:15:58 +00:00
|
|
|
self.damageObject(5)
|
|
|
|
endFunction
|
|
|
|
|
2024-01-19 01:32:53 +00:00
|
|
|
bool function checkActorWeapons(actor triggerActor)
|
2021-10-05 22:15:58 +00:00
|
|
|
; Checking if Torch is equipped
|
|
|
|
if triggerActor.GetEquippedItemType(0) == 11 || triggerActor.GetEquippedItemType(1) == 11
|
|
|
|
GasExplode(triggerActor)
|
2024-01-19 01:32:53 +00:00
|
|
|
return true
|
|
|
|
endif
|
|
|
|
If triggerActor.IsWeaponDrawn()
|
|
|
|
if IsIgnitingSpell(triggerActor.GetEquippedSpell(1)) || IsIgnitingSpell(triggerActor.GetEquippedSpell(0))
|
2021-10-05 22:15:58 +00:00
|
|
|
GasExplode(triggerActor)
|
2024-01-19 01:32:53 +00:00
|
|
|
return true
|
2021-10-05 22:15:58 +00:00
|
|
|
endif
|
|
|
|
endif
|
2024-01-19 01:32:53 +00:00
|
|
|
return false
|
2021-10-05 22:15:58 +00:00
|
|
|
endFunction
|
|
|
|
|
2024-01-19 01:32:53 +00:00
|
|
|
bool function IsIgnitingSpell(Spell aSpell)
|
|
|
|
return aSpell && ( aSpell.hasKeyword(flameKeyword) || ( lightningIgnites && aSpell.hasKeyword(lightningKeyword) ) || flExplodesGasTrapEquippedSpell.hasForm(aSpell as form) )
|
|
|
|
endfunction
|
|
|
|
|
2021-10-05 22:15:58 +00:00
|
|
|
event onReset()
|
|
|
|
self.reset()
|
|
|
|
self.clearDestruction()
|
|
|
|
goToState("waiting")
|
|
|
|
endEvent
|
|
|
|
|
|
|
|
event OnDestructionStageChanged(int aiOldStage, int aiCurrentStage)
|
2024-01-19 03:25:20 +00:00
|
|
|
;
|
2021-10-05 22:15:58 +00:00
|
|
|
endEvent
|