Estroya Posted October 5, 2015 Share Posted October 5, 2015 I'm currently trying to get NPCs to go a specific place or use a specific furniture when the player enters a trigger. What I want to have is that I could let the Merhcant walk around in his shop, but when the player goes to the counter then the merchant should come to the player to sell his stuff, so you don't have to search the merchant or have to walk behind the counter. I tried it with this script: Reveal hidden contents Actor Property Merchant Auto GlobalVariable Property InTrigger Auto Package Property WorkPackage Auto Event OnTriggerEnter(ObjectReference akTriggerRef) If akTriggerRef == Game.GetPlayer() ;checks for player debug.notification("Entered Trigger") If (Merchant.GetCurrentPackage() == WorkPackage) ;checks if NPC is working InTrigger.SetValue(1) ;set global to 1 so alternate package should become active Debug.notification("global is set") EndIf EndIf EndEvent Event OnTriggerLeave(ObjectReference akTriggerRef) If akTriggerRef == Game.GetPlayer() debug.notification("Leaving Trigger") InTrigger.SetValue(0) ;reset global to 0 to make previous package active Endif EndEvent And that didn't work. I couldn't find any scripting reference that forces NPCs to use a furniture, thats why i did the step with the package. Link to comment Share on other sites More sharing options...
fore Posted October 6, 2015 Share Posted October 6, 2015 Your script seems ok, except that you might need an evaluatepackage() after setvalue(). What we don't see is the package itself. Is it a sittarget with the proper condition, overruling other packages? Link to comment Share on other sites More sharing options...
Estroya Posted October 6, 2015 Author Share Posted October 6, 2015 Thanks for the help, I got it to work. I had to add a evalutatepackage() and a utility.wait() after setvalue(). Seems like the game needs a short time to tell the package that the global has changed. Link to comment Share on other sites More sharing options...
Recommended Posts