Jump to content

Script "Actor activate LinkRef on Hit" just doesn't work.


JPTR1

Recommended Posts

Hello,

I've found this "simple" script (defaultOnHitActivateLinkedRef), it just does not work like intended. Instead of "onHit" the NPC activates the link ref immediately after the cell is loaded.

I would need the Enemy to activate(run to) the lever when the combat begins.

 

 

ScriptName defaultOnHitActivateLinkedRef extends Actor
{Default script that lives on an actor. On hit, activate the specified linkedref.}

import game
import debug

bool property doOnce = false auto
keyword property linkKeyword auto
{if this has a linkedRef with this keyword, we will activate it once when hit}

auto State waiting
Event onHit(objectReference akAggressor, Form akWeapon, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
(getLinkedRef(linkKeyword) as objectReference).activate(self)
if (doOnce)
GoToState("allDone")
EndIf
endEvent
endState

State allDone
;do nothing
endState

 

 

Any idea what i'm doing wrong? Thanks in advance!

 

 

Link to comment
Share on other sites

You make me wonder if havok settling can trigger that event. Suppose I've never particularly looked for that

 

At any rate, two routes off the top of my head. You could simply use a condition for akAggressor. Assuming only the player is eligible, use that. Otherwise what you could do is an OnLoad() Event where then, perhaps after a Wait(1.0) or so, then go to that ready-to-hit state

Link to comment
Share on other sites

  • Recently Browsing   0 members

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