I am trying to write a script in which AI moves into positions within a building then do some action like go prone or kneel or w/e.
From everything I've read a simple waitUntil { unitReady _unit } should do the trick but it's not working at all. These units aren't grouped because I noticed that when assigning house positions to units in a group via move the whole group is given that waypoint so I have the group move up to the building, ungroup and then move to their positions. The script currently looks something like:
I also noticed that the sleep keyword doesn't seem to do anything and if you place a ; after ~# it fails as well. I've been through a bunch of different versions. All of which had specifically assigned the variable values. Was trying a more ambiguous version with this one. I also tried doMove with the same results.Code:_nBuilding = getPos player nearestObject 7024; _unit = _this select 0; _pos = _this select 1; _stance = _this select 2; _unit move (_nBuilding buildingPos _pos); waitUntil { unitReady _unit }; _unit setUnitPos _stance; _unit disableAI "MOVE";
I placed a hint immediately after the waitUntil statement and it fired as soon as the script did so I'm really at a loss. Any help would be appreciated, thanks in advance!
Edit:
I think I solved the problem by using execVM instead of exec... :P testing some more now but it seems to have resolved the issue.
If you're having this problem too in the init (or however you call the script) I had been using:
but am now using:Code:[this, 12, "Middle"] exec "Building.sqf"
Code:test = [this, 12, "Middle"] execVM "Building.sqf"
HOME
. These units aren't grouped because I noticed that when assigning house positions to units in a group via move the whole group is given that waypoint so I have the group move up to the building, ungroup and then move to their positions. The script currently looks something like:
Reply With Quote