Jump to content

How to tell if a mountain area is close to player location


tonycubed2

Recommended Posts

Ok, this is maddening! :facepalm: . I cannot figure out how to detect mountains or marshes.

 

I made a formlist and dumped in it all statics with word "mountain" and "cliff" in it. Then I put together the code below. Add yes i set up properties properly, the mod is now a year old and working otherwise. Do I need to extend something besides ObjectReference? I am desperate. I tried both FindClosest below.

 

Scriptname WalkingDangers15 extends Quest  

Event OnUpdate()
;check for mountains
PlayerRef = Game.GetPlayer()
closestmountain = None
;closestmountain = Game.FindClosestReferenceOfAnyTypeInListFromRef(Mountain, PlayerRef, 200.0)
closestmountain = Game.FindClosestReferenceOfAnyTypeInList(Mountain, playerref.getPositionX(), playerref.getPositionY(), playerref.getPositionZ(), 500.00) 
if closestmountain != None
debug.Notification("mountain is nearby")
Else
debug.Notification("no mountain")
EndIf

800 more lines of code that do not relate

Link to comment
Share on other sites

"closestmountain" should be an ObjectReference variable, which I presume you declared correctly in your script.

 

200 is much too short a distance to test in FindClosestReference, try 5000 or more. Mountains are very big.

 

However, FindClosestReference... (or the FindRandomReference,,,) functions don't seem to work with the mountain objects, which is why I'm having trouble stopping my SkyBirdies from flying through mountains :sad:

 

Only some types of object seem to get detected (MountainCliffSlopePineForest01, MountainCliffSlopePineForest02, MountainCliffSlopeFieldGrass02 and MountainCliffSlope), but unfortunately those pieces are generally used for landscape and not just the mountains.

 

I'm not sure why that is. Maybe the mountain meshes are somehow different from other landscape building blocks??? Maybe the LOD? (Edit: I tried disabling the LOD in the mountain landscape objects but it made no difference).

 

Edit: actually this is really weird, because the 4 objects above that do get detected use the same nifs as many of the mountain objects that don't get detected :confused: .

 

The only work-around that I can think of atm is to place custom markers on all the mountains, then detect the markers instead. Not a very elegant solution, however.

Edited by steve40
Link to comment
Share on other sites

  • Recently Browsing   0 members

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