Jump to content

[LE] trouble with FindClosestReferenceOfAnyTypeInListFromRef()


Recommended Posts

I cannot seem to get this function to return a value. I'm trying to detect the nearest Geode vein but it always returns nothing. There is what I have:

Event OnAnimationEvent(ObjectReference akSource, string asEventName)
     if (akSource == Game.GetPlayer()) && (asEventName == "SoundPlay.NPCHumanPickAxe")
        Strikes += 1
        if Strikes >= 6                             ; when you have struck an ore deposit 6 times
            FindGeode()                       ; check for geodes nearby less than 500 units
                if Geode != NONE                 ; if a geode is found within 500 units
                if PlayerREF.GetDistance(Geode) <= 50
Debug.Notification("Geode found here")
                    PlayerREF.Additem(FOS_LItemFossilGeodeDrop, 1)               ; if Geode is within 15 units give geode drop
                Endif
                Endif

                if Geode == NONE || PlayerREF.GetDistance(Geode) > 50           ; otherwise if no Geode is found within 500 or Geode found under 500 is farther than 15, give normal drop
                    PlayerREF.Additem(FOS_LItemFossilTierOneyum, 1)
                Endif
            Strikes = 0            ; reset strikes and geode reference
            Geode = NONE
        Endif
     endIf
endEvent

Function FindGeode()
    debug.notification("Geode is " + Geode.GetBaseObject().GetName() + " ")
    Geode = Game.FindClosestReferenceOfAnyTypeInListFromRef(FOS_GeodeList, PlayerREF, 5000.0)       ; get nearest Geode deposit within 500 units
EndFunction

The rest of the function works perfectly, and the code defaults to the !Geode branch of the IF check and gives the designated item, but it never detects geodes. I have the activator base forms loaded up into the FormList but I'm not having any luck, even jacked the distance up to 5000 and still nothing.

Link to comment
Share on other sites

Are you sure you have the right base objects? This is an activator you are looking for (or is it furniture?).

 

The reason I say it my be furnature is because I discovered one of my scripts that detects if the player is SITTING was being activated by the player mining for ore. So I am suspecting the base object may be something "tricky".

Link to comment
Share on other sites

  • Recently Browsing   0 members

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