Jump to content

Maintaining an Array of current objects within a trigger box


jangofett890

Recommended Posts

So I added a script to a trigger box because I'm trying to detect when two things are within this trigger box but for some reason when I add something to an array it just stays blank

Scriptname MQNS_MRPH_ROBOTRETURNSCRIPT extends ObjectReference

ObjectReference Property Actor1 Auto

ObjectReference Property Actor2 Auto

Quest Property SelectedQuest Auto

ObjectReference[] Property ObjectsInMe Auto

//Ignore this
Int Property timerID Auto Const

Event OnInit()
	if SelectedQuest.GetStage() == 10
		StartTimer(2, timerID)
	endif
EndEvent
//stop ignoring

Event OnTriggerEnter(ObjectReference akActionRef)
	ObjectsInMe.Add(akActionRef)
	Debug.Notification(ObjectsInMe)
EndEvent

Event OnTriggerLeave(ObjectReference akActionRef)
	int i = 0
	int arrLeng = ObjectsInMe.Length
	While i < arrLeng
		if ObjectsInMe[i] == akActionRef
			ObjectsInMe.Remove(i)
			Debug.Notification(ObjectsInMe[i])
			i += 1
		endif
	endWhile
EndEvent

The notification debug that pops up says [] otherwise an empty array. What am I doing wrong? Would I declare the array somewhere else?

Thanks

Link to comment
Share on other sites

  • Recently Browsing   0 members

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