Jump to content
Sign in to follow this  
Daskidd821

unitReady problems

Recommended Posts

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 :391:. 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:

_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 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.

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:

 [this, 12, "Middle"] exec "Building.sqf" 

but am now using:

 test = [this, 12, "Middle"] execVM "Building.sqf" 

Edited by Daskidd821
Resolved

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×