Jump to content

Meddle with the time Actors evaluate packages


Smig

Recommended Posts

I have a package that makes the actor cast a spell on the player under certain conditions. The problem is that, after those conditions turn true, I have to wait anywhere from 5 to 10 seconds for the package to actually activate. I assume this is just a timer on the actor, that makes him evaluate the package stack at certain intervals.

 

My intention is to have the package activate instantly (or almost, 2 second maximum, lets say). I could make a script but I can't see suitable events on the API that I could use. Or I could force the actors (or that one in particular) to evaluate packages at smaller intervals. Is this possible? Any other ideas?

Link to comment
Share on other sites

What are the conditions that make the package run?

 

I can't check the actual function names right now but it's basically:

 

Player's health < 100%

AND

LineOfSight with the player = 1

AND

Hostile with the player != 1

 

I attack someone in the room, I get injured and then kill him. I stand in front of the actor with the said package. He continues in another sandbox package that is in the bottom of the stack. He gets up, sits down, etc, for more than 5 seconds before the package activates.

 

Can I assume from your question that this is not a case of package evaluation interval? That the package should activate immediately?

Link to comment
Share on other sites

http://www.creationkit.com/OnGainLOS_-_Form

 

This seems to do what you need.

 

Even if you have to register the form you're attaching the script to for LOS gaining.

 

If you want the NPC to set a single cast, there wouldbe something like this on him.

 

Event OnLoad()
    RegisterForSingleLOSGain(self, Game.GetPlayer())
EndEvent

Event OnGainLOS(Actor akViewer, ObjectReference akTarget)
     Self.EvaluatePackage()
EndEvent

 

This should register your NPC for a single LOS gain as soon as he is loaded. So leaving the cell should also unload him, giving the opportunity to re-run the script when you come back.

 

If you have problems (it's reported that references may not unload when leaving the cell) you can try with OnCellAttach() instead of OnLoad().

 

This is far away from my knowledges and it's all done guessing with the CKwiki, so don't blame me if it doesn't work ;)

 

EDIT: you may need to replace both the "self" with "(self as actor)", since i don't remember if the script will extend actor or actorbase.

Edited by gasti89
Link to comment
Share on other sites

  • Recently Browsing   0 members

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