Alpine_gremlin 13 Posted October 18, 2017 So I am writing script that returns whether the player is inside certain types of enterable buildings. To accomplish this I am using the distance and nearestBuilding commands. The check works well with buildings such as the fire station and pub, but it does not seem to work with the general store. I am running the check with the general store in Elektrozavodsk. I have attempted to use the following classnames: "Land_A_GeneralStore_01a" "Land_A_GeneralStore_01a_dam" "Land_A_GeneralStore_01" "Land_A_GeneralStore_01_dam" None of these seem to work. I realize that the nearestBuilding command requires the building to be of class "House". Is the general store not of this class? Should I be using a different command such as nearestObject? If anyone is curious about the script itself: if (((_playerPos distance nearestBuilding player) < 15) && ((typeOf nearestBuilding player) == (_enterableBuildings select 28))) then { systemChat format ["%1 is inside a general store", name player]; //_enterableBuildings is my array with all enterable building classnames in it. Any help would be appreciated! Cheers! Share this post Link to post Share on other sites
alpha993 121 Posted October 18, 2017 (edited) Try this perhaps: _inBuilding = lineIntersectsWith [eyePos player, [getPos player select 0, getPos player select 1, 20]]; if ((typeOf (_inBuilding select 0)) == (_enterableBuildings select 28)) then { systemChat format ["%1 is inside a general store", name player]; }; This projects an invisible line from the eyes of your character and looks for any objects that intersect with it, in this case, it could be a general store. This way you can check if someone is inside a building without having to check for distance with nearestBuilding. You can also use this like this to tell you what the class name of any building you enter is: hint typeOf ((lineIntersectsWith [eyePos player, [getPos player select 0, getPos player select 1, 20]]) select 0); Also, make sure you triple-check your _enterableBuildings array for any typos or any other mistakes. Edited October 18, 2017 by alpha993 Fixed stupid mistake on my part 1 Share this post Link to post Share on other sites
Alpine_gremlin 13 Posted October 18, 2017 Your solution works! Thank you so much! 1 Share this post Link to post Share on other sites
alpha993 121 Posted October 18, 2017 Glad I could help Share this post Link to post Share on other sites