Workaround for 'GetClosestActor'

Post » Sun Jun 24, 2012 7:14 pm

I figured this out while screwing around, thought I'd share since 'getclosestactor' not including the player is a pretty common thing on the wishlist. Maybe someone else already figured this out?

Make a copy of the XMarkerHeading base object and name it whatever. Then create an FFSelfArea spell and attach this script to it:

STATIC property akInvisibo autoOBJECTREFERENCE victimEvent OnEffectStart (actor akTarget, actor akCaster)akTarget.placeatme(akInvisibo, 1)victim = Game.FindClosestReferenceOfTypeFromRef(akInvisibo, akCaster, 2048)EndEvent

If you wanted to find the closest three, you can append:

actor Target1 = Game.FindClosestActorFromRef(Victim, 5.0)victim.disablenowait()victim = Game.FindClosestReferenceOfTypeFromRef(akInvisibo, akCaster, 2048)actor Target2 = Game.FindClosestActorFromRef(Victim, 5.0)victim.disablenowait()victim = Game.FindClosestReferenceOfTypeFromRef(akInvisibo, akCaster, 2048)actor Target3 = Game.FindClosestActorFromRef(Victim, 5.0)

This is a relatively slow method, but may have uses. Adjust values up for wider area and lower for more speed, etc.
User avatar
Bambi
 
Posts: 3380
Joined: Tue Jan 30, 2007 1:20 pm

Return to V - Skyrim