Jump to content

Red Diamond Recon Marker. Mesh and Texture?


Recommended Posts

A quest reference alias, or a reference collection alias, can be filled with references depending on the conditions you set.

The aliases of a quest can be automatically filled each time the quest starts by references that match the conditions, it only takes objects that are loaded or are persistent (that's applies for the search function as well), so you might be using, more or less, the same method but, instead of filling the collection alias from the script, you would restart the quest every given distance to get the collection filled with new references that meet the conditions you set for such collection alias.

 

Do I just duplicate the Recon quest they used.

 

I'd recommend creating a new quest. Otherwise, it can get messy very soon.

Edited by DieFeM
Link to comment
Share on other sites

Scriptname oo_RefCollectSpell extends activemagiceffect

RefCollectionAlias Property NewReconTargetCollections Auto Const

Event OnEffectStart(Actor Target, Actor Caster)
	NewReconTargetCollections.AddRef(Target)
EndEvent

I attached this to a clock spell.

And Then I created a new quest and just did exactly same thing as recon quest, but removed the script that is attached to PlayerRef

 

This was the timer to track the distance (1 seconds each Timer):

Scriptname oo_DistanceDetectTimer extends activemagiceffect

RefCollectionAlias Property NewReconTargetCollections Auto Const
Actor Property PlayerRef auto Const
Float Property TimerTime auto Const
Float Property ExpectedDistance auto Const

Int DistanceTimerID = 238

Event OnEffectStart(Actor Target, Actor Caster)
	StartTimer(TimerTime,DistanceTimerID)
EndEvent

Event OnTimer(Int aiTimerID)
	
	If aiTimerID == DistanceTimerID
		Int ICount = NewReconTargetCollections.GetCount()
		Int Index = 0
		ObjectReference PlaceHolder = None
		
		While (Index < ICount)
			PlaceHolder = NewReconTargetCollections.GetAt(Index)
			
			If PlayerRef.GetDistance(PlaceHolder) > ExpectedDistance
				NewReconTargetCollections.RemoveRef(PlaceHolder)
			EndIf
			
			Index += 1
		EndWhile
		
		StartTimer(TimerTime,DistanceTimerID)
	EndIf
	
EndEvent

Event OnEffectFinish(Actor Target, Actor Caster)
	CancelTimer(DistanceTimerID)
EndEvent
Link to comment
Share on other sites

Looks good, but I'd try to implement it using OnDistanceGreaterThan - ScriptObject - Creation Kit instead of a timer, though. Because testing every reference in the collection every second seems a bit "overkill", OnDistanceGreaterThan would do the job whenever the distance event triggers, it seems more reasonable for the script load.

Link to comment
Share on other sites

As above, system events are "free" but starting high frequency timers that iterate functions can cause issues. This looks complicated but is infact an elegant use of system resources;


Add a script to NewReconTargetCollections called NewReconTargetCollectionsScript with the event OnDistanceGreaterThan that unregisters itsef for the event and removes the ref. Also add events to handle removing refs OnUnload and OnDeath or whatever because real time events sometimes do not trigger or are missed when the script system is under load.


Add a line after the .AddRef (NewReconTargetCollections as NewReconTargetCollectionsScript).RegisterForDistanceGreaterThanEvent(PlayerRef, Target, ExpectedDistance)

Link to comment
Share on other sites

I can never figure this out myself :pinch:. I hate to use timer too, but it is the only way I can think about. Anyway, I changed my code here:

Scriptname oo_RefCollectSpell extends activemagiceffect

Actor Property PlayerRef Auto Const
Float Property ExpectedDistance Auto Const
RefCollectionAlias Property NewReconTargetCollections Auto Const

Event OnEffectStart(Actor Target, Actor Caster)
	NewReconTargetCollections.AddRef(Target)
	(NewReconTargetCollections as oo_NewReconTargetsCleanUp).RegisterForDistanceGreaterThanEvent(PlayerRef, Target, ExpectedDistance)
EndEvent

This for clock spell

Scriptname oo_NewReconTargetsCleanUp extends RefCollectionAlias

Event OnUnload(ObjectReference akSender)
	Self.RemoveRef(akSender)
EndEvent

Event OnDistanceGreaterThan(ObjectReference PlayerRef, ObjectReference TargetObj, float afDistance)
	Self.RemoveRef(TargetObj)
EndEvent

This attached to the Reference Collection Alias.

 

By the way, I found there is one section called Quest Objectives. There is one condition write as this:

Target Ref Conditions

ReconTarget (GetDead None == 0.00)

 

I think they use this to get rid of dead actor from their reference collection, I wonder if I can add a condition like NewReconTarget (GetDistance PlayerRef < 4600.0) something like that for my quest. But I don't know which one is best for the performance.

Link to comment
Share on other sites

Yeah, those scripts look a lot better 100%

 

 

By the way, I found there is one section called Quest Objectives. There is one condition write as this:

Target Ref Conditions

ReconTarget (GetDead None == 0.00)

 

I think they use this to get rid of dead actor from their reference collection, I wonder if I can add a condition like NewReconTarget (GetDistance PlayerRef < 4600.0) something like that for my quest. But I don't know which one is best for the performance.

 

I'm positive you can ignore those safely, the function calls in the stage fragments that enable those quest objectives are all commented, looks like something they've used for testing. I don't even think any of the stages is set at any time, I think this is meant to be called from console with setstage. So, I'm pretty sure that the stages and quest objectives are all meant for debugging.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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