The nearestBuilding command does not return the position of spawned houses (meaning a house which is created on mission runtime). This can make debugging utterly compilcated.
Description
Details
- Legacy ID
- 2817577395
- Severity
- None
- Resolution
- Open
- Reproducibility
- Always
- Category
- Scripting
1.) Create a house somewhere on the map and stand next to it
2.) Aim at that house and compare <i>player distance cursorTarget</i> with <i>player distance nearestBuilding player</i>
3.) Notice that player distance (nearestBulding player) will be larger, because nearestBuilding is not the cursorTarget
Event Timeline
Works for me, just tested. Would you mind to post a repro?
Or try this:
Go on VR map, execute
"Land_u_House_Small_02_V1_dam_F" createvehicle position player;
then
hint str nearestBuilding player;
OK, I'll do as soon as I get the chance. I've just tested it on Altis so far, but I did do it the exact way as I described and <i>typeOf cursorTarget</i> gave me another className than <i>typeOf nearestBuilding player</i> even though I stood right in front of a building.
Plus, <i>cursorTarget distance nearestBuilding player</i> was more than 70 meters in that test scenario.
It probably works on the VR map, because the placed building might be the only one there and there's no map of that kind like Altis or Stratis.
Yes it fails on Altis and on Stratis. You can use
nearestObject [player, "house"];
in the mean time