Jump to content

Recommended Posts

Posted

Hi, I have a script that I require each "Human" actor to run OnLoad. Its pretty cumbersome to manually add a script to every human actor in the CK (given there are hundreds). I've tried to look up some workarounds, most of the examples I've seen don't quite hit the mark. The script compares forms in the actor's inventory to a formlist and equips or unequips any matches based on conditional statements. This is preferably done before the Player is within the immediate vicinity (for visual consistency)

 

TL:DR - Are there any simple ways I can add a script to every raceHuman actor without manually adding the script to each actor?

Posted

I'm actually not adding forms to the actors themselves, they currently already have the items I am checking against (Gasmasks) but I do need to check against the Gasmasks' forms to determine whether it is or isn't in the actors inventory. Formlist of GasMasks [ i ] -> Actor has this GasMask? -> Equip

 

This isn't the most efficient method because it has to run through the form list for every actor encountered, but since I can't get access to the items in their inventory directly it's my workaround. Will FindRandomActor find a new actor on each call or do I need to filter it as the actors are found?

Posted (edited)

Can I filter FindRandomActor in some way? Doesn't seem like I would be able to control how I get "fresh" actors. Do you know if Actors who inherit a template will inherit corresponding scripts?

Edited by D1v1ne122
Posted

If actors are based off a template actor, they should inherit the template actor's scripts. And there is no way to filter FindRandomActor directly, since it is a native function and it doesn't offer any built-in filtering capabilities. There are certainly other methods to find nearby actors (such as using a cloak spell AoE) but using FindRandomActor is much less complicated to implement.

Posted (edited)

After reviewing the RegisterForUpdate I realized Timers have replaced it, problem fixed:)

 

 

  Reveal hidden contents

 

Edited by D1v1ne122
  • Recently Browsing   0 members

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