Jump to content

Having difficulty in 'triggering' script event.


TheCutSnake

Recommended Posts

Scriptname SDPAInterfaceScript extends Quest

Keyword Property FurnitureTypePowerArmor Auto
Quest Property SDPAInterfaceQuest Auto 

Function SDPAPowerArmorSearch()

		;Check for nearby power armors
	
		ObjectReference[] nearbyPowerArmors = Game.GetPlayer().FindAllReferencesWithKeyword(FurnitureTypePowerArmor, 100)

		debug.trace( "Found " + nearbyPowerArmors.Length + " nearby unoccupied power armors" )

			If nearbyPowerArmors.Length > 0

				ObjectReference nearestPowerArmor
				float fnearestDistance = 9999.0
				int i = 0

				while (i < nearbyPowerArmors.Length)

					float fcurrentDistance = Game.GetPlayer().GetDistance(nearbyPowerArmors[i])

						if( fcurrentDistance < fnearestDistance )
						nearestPowerArmor = nearbyPowerArmors[i]
						fnearestDistance = fcurrentDistance
					endIf

					i = i + 1

				endWhile

			Endif

			If (nearbyPowerArmors == none)
				SDPAInterfaceQuest.setstage (10)
			Else
				SDPAInterfaceQuest.setstage (20)
			endif

EndFunction

Ahh. There you go. It works and I'm happy.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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