Jump to content

Little help with a script


faffman

Recommended Posts

So first of all, I'm not a modder myself, and certainly no scripter. I received this script from ymf331 after a little request on the Mod Requests forum, but there's something amiss in it, and he told me to ask if anyone here could tell what it is.

 

With Ordinator, you can place bear traps, which is kind of what my current build centers around. But even if you have the Light Foot perk, which appears to be same as in vanilla, you can still take damage from your own bear traps (and in my case die everytime it happens, because I haven't invested in much health). So this script he made was supposed to make the player safe from their own bear traps, if they have the Light Foot perk, which I do, but it didn't work, and ymf331 couldn't try it out himself for reasons. So can anyone tell where the issue is? Many thanks.

 

Scriptname ORD_BearTrap_Activator_Script extends ObjectReference

; -----

ORD_TrapHitBase_Script HitBase
Bool Property ORD_StartOpen = true Auto
Float Property ORD_LockpickingDamageMult Auto
Perk Property ORD_Loc50_BigGameHunter_Perk_50_OrdASISExclude Auto
Perk Property ORD_Sne50_LightFoot_Perk_50_WasLightFoot_OrdASISExclude Auto
Actor Property PlayerRef Auto

; -----

Event onReset()

GoToState("Closed")
Self.Reset()

EndEvent

; -----

Event OnLoad()

HitBase = (Self as objectReference) as ORD_TrapHitBase_Script
HitBase.ORD_Damage = Math.Ceiling(Game.GetPlayer().GetActorValue("Lockpicking") * ORD_LockpickingDamageMult)
Utility.Wait(0.50)
If ORD_StartOpen
; PlayAnimation("StartOpen")
PlayAnimationAndWait("Reset01","Trans02")
GoToState("Open")
EndIf

EndEvent

; -----

Auto State Closed

Event OnBeginState()
If PlayerRef.HasPerk(ORD_Loc50_BigGameHunter_Perk_50_OrdASISExclude)
BlockActivation(true)
RegisterForSingleUpdate(2.5)
EndIf
EndEvent

Event OnEndState()
UnregisterForUpdate()
EndEvent

Event OnTriggerEnter(objectReference TriggerRef)
EndEvent

Event OnActivate(objectReference akTriggerRef)
PlayAnimationAndWait("Reset01","Trans02")
GoToState("Open")
EndEvent

Event OnUpdate()
PlayAnimationAndWait("Reset01","Trans02")
BlockActivation(false)
GoToState("Open")
EndEvent

EndState

; -----

State Open

Event OnBeginState()
HitBase.GoToState("CanHit")
EndEvent

Event OnTriggerEnter(objectReference TriggerRef)
If (TriggerRef as Actor).HasPerk(ORD_Sne50_LightFoot_Perk_50_WasLightFoot_OrdASISExclude)
Return
Else
PlayAnimation("Trigger01")
HitBase.GoToState("CanHit")
GoToState("Busy")
WaitForAnimationEvent("Trans01")
HitBase.GoToState("CannotHit")
GoToState("Closed")
EndIf
EndEvent

Event OnActivate(objectReference TriggerRef)
GoToState("Busy")
HitBase.GoToState("CannotHit")
PlayAnimationAndWait("Trigger01","Trans01")
GoToState("Closed")
EndEvent

EndState

; -----

State Busy

Event OnBeginState()
EndEvent

EndState

; -----

Event OnTriggerEnter(objectReference akTriggerRef)
EndEvent

Event OnActivate(objectReference akTriggerRef)
EndEvent

; -----

Link to comment
Share on other sites

i had the activators in a new plugin with the property added, but it looked like the mod author changed this from the vanilla script.

Event OnBeginState()
    HitBase.GoToState("CanHit") <---- added this
EndEvent

so i just took it out. i figure there's probably a reason, so maybe now something else don't work but idk. hopefully it's gravy.

Edited by ymf331
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...