Jump to content

How to get NPCs to use furniture when player enters a trigger?


Estroya

Recommended Posts

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:

 

 

 

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

  • Recently Browsing   0 members

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