Jump to content

Q. about setup for a script involving a map marker


Recommended Posts

Do not worry overmuch about performance.  The game can take it.  What you are describing looks ok to me (I am doing 1000 times worse in my own WIP).

On using the OnLocationChange event...

Many areas do not have a location set (getCurrentLocation returns None).  There are vast stretches of wilderness where you will get no events.  This may be an issue if some of your target markers are in these areas.

Not all cells for a given location will be loaded when you enter the location.  Your alias fill may not see them (well, perhaps I am wrong on this seeing as they all seem to be marked "persistent"; I have not tested how the aliasfill behaves wrt persistent references in unloaded cells).

Another possible approach is to place your own XMarker (activator) on top of each target mapmarker, and use its OnCellAttach/OnCellDetach event to trigger your processing.  These shadow xmarkers would have an ObjectReference script with a property pointing to the actual mapmarker.  To avoid having to manually create 100s of xmarkers, if you have a static list of target mapmarkers, you can set them up when your mod 1st loads and initializes (using placeAtMe).

Activator property myShadowXMarker Auto ; must have the "myShadowXMarkerScript"

function placeShadowMapMarker( ObjectReference targetMapMarker)
	myShadowXMarkerScript shadow = targetMapMarker.placeAtMe( myShadowXMarker, 1, True) as myShadowXMarkerScript
	shadow.targetMapMarker = targetMapMarker
endfunction

However, I am now wondering whether you should reconsider the trigger box approach.  If you use a triggerbox as a dynamically placed shadow, instead of an xmarker, you can use the distance to the player to trigger your processing (and change the "True" to "False" in my example code above).

Do not worry about creating these extra objects and extra script instances.  As long as there are no visual elements, the performance impact will be minimal.  Trigger boxes will check conditions frequently, but the condition system already evaluates millions of conditions per second;  I doubt you can make a dent.

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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