After a couple of tests and revisions i just couldn't figure out why I wouldn't work and it ended up being shelved after the two of us got distracted by other things
After being reminded of it today, I thought i'de post it here to maybe get more brains on the case
Here's the setup:
FormList AnimalList (filled with all the animal actors)
GlobalVariable BaitTracker (set to 0)
MiscObject ScentBottle (following script attached to base object)
Spoiler
Activator ScentPile (following script attached to base object)Scriptname RDRScentBottleScript extends ObjectReference Activator Property scentPile autoGlobalVariable Property baitTracker autoEvent OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) If (akOldContainer == game.GetPlayer()) && !akNewContainer If (baitTracker.GetValue() == 0) Utility.Wait(5.0) Self.PlaceAtMe(ScentPile) Debug.Notification("Scent Pile deployed") baitTracker.SetValue(1) Self.Delete() Else Self.Delete() akOldContainer.AddItem(self) Debug.Messagebox("You can only use one bait at a time") EndIf EndIfEndEvent
Spoiler
Scriptname RDRScentPileScript extends ObjectReference FormList Property animalList AutoInt timer = 0Int div = 1Int Property duration = 60 AutoGlobalVariable Property baitTracker AutoActor[] randomActorArrayActor Property playerREF AutoEvent OnInit() Debug.Notification("Initialised") randomActorArray = New Actor[10] GoToState("Start")EndEventState Start Event OnBeginState() RegisterForSingleUpdate(1) Debug.Messagebox("Timer Started") FillArray(randomActorArray) Debug.Messagebox("Animal Array"+"\n Animal 1 = " +randomActorArray[0].GetActorBase()+"\n Animal 2 = " +randomActorArray[1].GetActorBase()+"\n Animal 3 = " +randomActorArray[2].GetActorBase()+"\n Animal 4 = " +randomActorArray[3].GetActorBase()+"\n Animal 5 = " +randomActorArray[4].GetActorBase()+"\n Animal 6 = " +randomActorArray[5].GetActorBase()+"\n Animal 7 = " +randomActorArray[6].GetActorBase()+"\n Animal 8 = " +randomActorArray[7].GetActorBase()+"\n Animal 9 = " +randomActorArray[8].GetActorBase()+"\n Animal 10 = " +randomActorArray[9].GetActorBase()) EndEvent Event OnUpdate() If (timer == 0) PathNthActorArray(randomActorArray, 0) timer += 1 RegisterForSingleUpdate(1) ElseIf(timer < duration) && (timer > 0) SendActorArray(randomActorArray, div) timer += 1 RegisterForSingleUpdate(1) ElseIf (timer >= duration) GoToState("End") EndIf EndEventEndStateState End Event OnBeginState() Debug.Notification("Scent Bait depleted") self.Disable() self.Delete() Timer = 0 baitTracker.SetValue(0) EndEventEndStateFunction FillArray(Actor[] akActorArray, Int aiElement = 0) aiElement = akActorArray.Length While aiElement > 0 aiElement -= 1 akActorArray[aiElement] = (Game.FindRandomReferenceOfAnyTypeInListFromRef(animalList, playerREF, 4096.0) as Actor) EndWhileEndFunctionFunction PathNthActorArray(Actor[] akActorArray, Int aiElement = 0) akActorArray[aiElement].PathToReference(self, 0.7)EndFunctionFunction SendActorArray(Actor[] akActorArray, Int i = 0) If (timer == ((duration / 10) * i)) PathNthActorArray(akActorArray, i) Debug.Notification("Sending Actor "+(i + 1)) div += 1 EndIfEndFunction
When I tried it out in game, the bottle switched for the scent pile "okay" (I use that term loosely because it kept spawning the activator in mid-air). But then, nothing. No animals pathing. Maybe it's because the activator was not on the ground?
Any ideas? Does anything stand out?
- Hypno