Script to find close by traps not working.

Post » Mon Jun 20, 2016 2:36 am

Anyone see what could be wrong with this? It never seems to trigger:



.
aadpTraps is a formlist of the hazards forms.

.



if (Game.FindClosestReferenceOfAnyTypeInListFromRef(aadpTraps, Playerref, 1200.0))
debug.messagebox("Hazzard near by.")
endif
User avatar
Alisha Clarke
 
Posts: 3461
Joined: Tue Jan 16, 2007 2:53 am

Post » Sun Jun 19, 2016 1:21 pm

Try:



ObjectReference AnyTrap = Game.FindClosestReferenceOfAnyTypeInListFromRef(aadpTraps, Playerref, 1200.0)

if AnyTrap == True
debug.messagebox("Hazzard near by.")
endif
User avatar
Star Dunkels Macmillan
 
Posts: 3421
Joined: Thu Aug 31, 2006 4:00 pm

Post » Sun Jun 19, 2016 2:10 pm

if (Game.FindClosestReferenceOfAnyTypeInListFromRef(aadpTraps, Playerref, 1200.0)) != None
should work, too.

The function returns an ObjectReference, and it's not clear how it would internally be cast to boolean.
User avatar
Claudia Cook
 
Posts: 3450
Joined: Mon Oct 30, 2006 10:22 am

Post » Sun Jun 19, 2016 5:12 pm


ObjectReferences should return true as long as they aren't None. http://www.creationkit.com/index.php?title=Cast_Reference

User avatar
Lew.p
 
Posts: 3430
Joined: Thu Jun 07, 2007 5:31 pm


Return to V - Skyrim