Jump to content

[LE] Does Skyrim have equivalent RegisterForDistanceLessThanEvent


Recommended Posts

Hey Guys,

I'm just playing around with some ideas for tracking Distance between objects in Skyrim to trigger a function such as spawning an Enemy Actor.

Normally I would just use a trigger box, but I'm trying to make the event trigger whenever the Player is anywhere near the object regardless of player angle to that object.

 

Here's an example of what I was attempting:

Scriptname _TestNPCSpawnOnProximity extends ObjectReference  
{Spawn an NPC of the appropriate type when Proximity distance trigger is met.}

Actor Property Player Auto

Event OnInit()
	;Test Script is running
	Debug.MessageBox("SpawnOnProximity Script Is Running...")
	;Assigning the Player
	Player = Game.GetPlayer()
	; Register Script for Proximity Tracking to Base Object
	ScriptObject.RegisterForDistanceLessThanEvent(Player, self, 25.0)
EndEvent

Event OnDistanceLessThan(ObjectReference akObj1, ObjectReference akObj2, float afDistance)
	Debug.MessageBox("Player is now " + afDistance + " units away from " + self)
EndEvent

When running the above I get the error:

 

- RegisterForDistanceLessThanEvent is not a function or does not exist

After some research It seems like this perfect event function i needed doesn't exist for Skyrim but only Fallout 4.

Is there an equivalent event for Skyrim that can do something similar to the above, and still can consistently run checks until distance to that object has been met?

 

Thanks ^^

 

Link to comment
Share on other sites

I'd honestly still use triggerboxes unless this other object is supposed to move around somehow.

 

Failing that you could put a magic effect on a player with a GetDistance conditional on the effect in the spell window. It'd poll, which is not ideal, but you'd get a MagicEffectStart event whenever the condition was met, which you could use to signal everything else.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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