KC Grimes 79 Posted January 9, 2014 Howdy, I just had a quick question for a script that I may setup at some point. So far to get some AI into buildings I have been manually going to the building then cycling through buildingPos's for that structure, picking one I like, and noting the direction I want the AI to face. I went through a town doing this for certain buildings (it IS more efficient then it sounds, thanks to the debug console and copyToClipboard with some formatting!), but eventually wished there was a simple command I could you to setDir or doWatch or anything of the sort to get the individual AI to face a direction that is useful (door, window, etc.) Does anyone know of such a way to do this? Of course it can be done manually like I have been, but I am looking for a lazy but functional way to do it so that making a script that selects random buildingPos's in random buildings within a trigger list is not pointless, due to half of the AI facing the inside corner of a closet. That's what scripting is about! Thanks for any help! Share this post Link to post Share on other sites
YattaYatta 10 Posted January 9, 2014 Im sorry to report that I dont think theres any magical function for "usefull direction". Maybe you could try something dirty like regularly pointing AI in the direction of the closest enemy - that way a player entering a building will not find the enemy facing a corner, and enemy could shoot at the closest enemy thorugh a window. But as I said thats dirty, so it comes with quite some problems. Share this post Link to post Share on other sites
KC Grimes 79 Posted January 9, 2014 Im sorry to report that I dont think theres any magical function for "usefull direction".Maybe you could try something dirty like regularly pointing AI in the direction of the closest enemy - that way a player entering a building will not find the enemy facing a corner, and enemy could shoot at the closest enemy thorugh a window. But as I said thats dirty, so it comes with quite some problems. I thought of that, but was hoping to use this on a large scale, simply too big for that type of demand. However, what I may try is getting individual AI to doWatch nearest enemy if they are within a certain range or, of course, spotted. But even that seems demanding, as its looping until someone is in range. Share this post Link to post Share on other sites
oktyabr 12 Posted January 10, 2014 It's sad that we are on ARMA 3 and this question still needs to be asked. Why hasn't BI figured out how to code a path finding that ends up with an AI looking out a window, off a balcony, or at least in an "intelligent" seeming way??? Unfortunately the "manual" way you have described is the best thing I've found so far too. Share this post Link to post Share on other sites
KC Grimes 79 Posted January 10, 2014 It's sad that we are on ARMA 3 and this question still needs to be asked. Why hasn't BI figured out how to code a path finding that ends up with an AI looking out a window, off a balcony, or at least in an "intelligent" seeming way???Unfortunately the "manual" way you have described is the best thing I've found so far too. I'm sure its not the easiest thing in the world to do, seeing as to how windows are not a separate entity, but instead part of the house entity. I was thinking there may be a command because buildingPos is in there so AI know where they are in the building, thus can route "safely". Was thinking perhaps there was more to it. Oh well. Share this post Link to post Share on other sites
hansson0728 12 Posted January 10, 2014 To get a unit wathing out of a window sort of, you could use this. _Watchdir = (([_soldier, _currentbuild] call BIS_fnc_DirTo)); // this will get you the direction to the centerof the building, so by adding 180 to this, the unit will be looking away from the building _soldier setdir (_Watchdir + 180); its better than nothing. ;) Share this post Link to post Share on other sites
Larrow 2828 Posted January 10, 2014 See THIS thread for finding windows in a building. Share this post Link to post Share on other sites
Rydygier 1325 Posted January 10, 2014 Sometimes also entrances may be direction useful to watch. Another approach may be to chek LOS around to find, where is farthest not obstructed LOS, or where is closest wall or something more complex. Share this post Link to post Share on other sites
KC Grimes 79 Posted January 10, 2014 To get a unit wathing out of a window sort of, you could use this. _Watchdir = (([_soldier, _currentbuild] call BIS_fnc_DirTo)); // this will get you the direction to the centerof the building, so by adding 180 to this, the unit will be looking away from the building _soldier setdir (_Watchdir + 180); its better than nothing. ;) I thought of this, but it is still unfortunately situational, as I am not using window-only positions (ie, closet). In addition, this only works for even some Pos's. For roofs though, it is effective. Will keep in mind. See THIS thread for finding windows in a building. Will definitely keep those detection scripts from windows and doors in mind. Will try out the routing through building as well, as that voids the whole problem. Could setup a patrol that selected buildingPos's on the same Z/floor. Sometimes also entrances may be direction useful to watch. Another approach may be to chek LOS around to find, where is farthest not obstructed LOS, or where is closest wall or something more complex. Never knew that command existed. I definitely see it useful if I place the units, perhaps in a hostage situation type scenario, but find it iffy when it comes to randomly placing units. I don't want them on the 2nd floor watching the boards below their feet. With the door detection in the linked script, I may not need it. Farthest LOS is an awesome idea, once again never thought of it, though I am worried about whether or not windows are considered "in the way", and definitely worried about resource usage if on a big scale. Really trying to stick to watching certain things or moving to certain places, rather than "scanning" type stuff. Thanks for all the help, I really appreciate it! I hope to compile all of this once school gets settled in again, and get a nice script out! Share this post Link to post Share on other sites
Rydygier 1325 Posted January 10, 2014 I don't want them on the 2nd floor watching the boards below their feet. Well, quick height difference check or single LOS check should help with that. With the door detection in the linked script, I may not need it. Yes, still not each door is building entrance, so depends, what you want. Share this post Link to post Share on other sites