Identifying actors around the caster ?

Post » Wed Jun 20, 2012 10:29 am

So, let's say I have a magic effect running on the player, and this effect has a script attached. The script will override the OnHit event, and when the player gets hit I also want allied actors around the player to do something.

Question is:

Is there a way to get a reference to every actor within xx yards around the caster from inside that script?

If not, at least could I immediately "cast" a fake self area spell from inside the script during the OnHit event, without any visual effect, as if I was just simulating an event on the actors around? (hope you guys get it, I want the allies around to do something when the player gets hit)
User avatar
Markie Mark
 
Posts: 3420
Joined: Tue Dec 04, 2007 7:24 am

Post » Wed Jun 20, 2012 6:36 pm

You could make a quest with aliases that fill with only NPCs that are in the player faction that are within the radius you want, in a manner similar to the way http://www.youtube.com/watch?v=Qfcet5hf5bspicks the two barstools (Instead of checking for the keyword IsBarstool, you would check for PlayerFaction I believe.) You could then start the quest on an "onhit" event, get the references, do what you want to do, then Stop the quest so you can restart it on the next OnHit() event.
User avatar
Emmi Coolahan
 
Posts: 3335
Joined: Wed Jan 24, 2007 9:14 pm

Post » Wed Jun 20, 2012 5:39 pm

To reference every actor from inside the script is possible, but not very efficient. You would need to have a while loop using the FindRandomActorFromRef function, and store the result somewhere, maybe a formlist.

Casting a fake spell is a good idea. If you use the Cast() or RemoteCast() functions, there is no visual effect.

You could also try using quest aliases.
User avatar
Marta Wolko
 
Posts: 3383
Joined: Mon Aug 28, 2006 6:51 am


Return to V - Skyrim