Jump to content

"Disabling" NPCs during certain times of the day


fadingsignal

Recommended Posts

Are all of your traveler NPCs new [to reduce incompatibilities]? If so, as another option, then why not attach an Actor script to them?

 

If you have setup your NPCs to have travel packages at certain times of the day, create a package for the times that you want them disabled. Then check at package ending if the last travel package was the final package so you can disable them, and if it is your package for when they are disabled as the final one to re-enable them.

 

Below is an example of an actor script to do this [haven't tested to see if the packages are still evaluated when they are disabled, so you might have to do some GameTime checks]:

 

 

 

Scriptname TravelingEnableDisableScript extends Actor  

Package Property TravelingPackage Auto
Package Property NotTravelingPackage Auto

;When the Actor this script is attached to ends a package, this event will Trigger
Event OnPackageEnd(Package akOldPackage)
	;Check to see if the akOldPackage is our Traveling Package
	if (akOldPackage == TravelingPackage)
		;Disable the NPC
		self.Disable()
		;Register for a GameTime Update in case the next is not evaluated - SET TO DISABLED
		;RegisterForSingleUpdateGameTime(5.0)  Set for an update in 5 hours from the time the Traveling Package ended
	;ElseIf (akOldPackage == NotTravelingPackage)
		;self.Enable()
	Else ;The case where it is the NotTravelingPackage.  You should only use If-Else in the case of two packages.  
		 ;If there are other packages, change this to an ElseIf	in a similar fashion to the TravelingPackage check.
		 self.Enable()
	EndIf	 
EndEvent

{
;When the registered update is completed, it will re-enable the NPC for the TravelingPackage
;Currently Commented Out
Event OnUpdateGameTime()
	self.Enable()
EndEvent
}

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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