User:PROXiCiDE/CreateSlowEffectTrigger
Creating a Slow Effect TriggerEdit
Requires knowledge of using Triggers in Creation Kit
ScriptName _PX_SpeedTriggerScript Extends ObjectReference
;=================================================================================
; Properties
;=================================================================================
Faction Property pExcludeFaction Auto
{Effects are not applied to Actors that are in this specific Faction}
Spell Property pExcludeGhostAbility Auto
{Effects are not applied to Actors that have the Ghost Ability}
Float Property fSpeedMult = 75.0 Auto
{Speed Multiplier, Do not asign this value a negative number}
Float Property fCarryWeight = 200.0 Auto
{Add weight to the Actor, Do not asign this value a negative number}
Bool Property bForceSneaking = True Auto
{Forces the Actor to crouch / sneak to make it look As they are weighed down}
;=================================================================================
; Events
;=================================================================================
Bool bIsAlreadySneaking = False
Event OnTriggerEnter(ObjectReference akActionRef)
Actor pActor = akActionRef As Actor
If pActor
If !pActor.IsInFaction(pExcludeFaction) && !pActor.HasSpell(pExcludeGhostAbility)
bIsAlreadySneaking = pActor.IsSneaking()
pActor.ModAV("SpeedMult", -fSpeedMult)
pActor.ModAV("CarryWeight", fCarryWeight)
If !bIsAlreadySneaking && bForceSneaking
pActor.StartSneaking()
EndIf
Else
;Do code here for specific actors are in the faction or a ghost
EndIf
EndIf
EndEvent
Event OnTriggerLeave(ObjectReference akActionRef)
Actor pActor = akActionRef As Actor
If pActor
If !pActor.IsInFaction(pExcludeFaction) && !pActor.HasSpell(pExcludeGhostAbility)
pActor.ModAV("SpeedMult", fSpeedMult)
pActor.ModAV("CarryWeight", -fCarryWeight)
If !bIsAlreadySneaking && bForceSneaking
;Recheck incase Actor is no longer sneaking, this
If pActor.IsSneaking()
pActor.StartSneaking()
EndIf
EndIf
Else
;Do code here for specific actors are in the faction or a ghost
EndIf
EndIf
EndEvent