longstreetcsa 1 Posted March 15, 2008 I got the following script used in an add action - it is to stop the group (they are in line formation) following the player (called MisterX) and if works as intended and stops the group from following the player BUT I also want them to check the direction the player is looking the moment he tells the group to stop and to watch that direction (for they are NOT doing that, one half is watching the forward direction the other half is watching the back) but I don't want that... _ _group=_this select 0 _leader = leader _group _direction = getdir MisterX {dostop _x; _x allowFleeing 0; _x disableAI "Target"; _x setdir _direction} forEach units _group Stopm=true comeflag=false Exit __ I thought well I can get the heading the player has with the getdir command, but the boys don't do as I want them to do, they keep turning... (I am thinking it might have to do with the dostop command but I can not use another to stop them as far as I know). Maybe someone can come up with a solution? Share this post Link to post Share on other sites
sanctuary 19 Posted March 15, 2008 If i understand well, MisterX is not a part of the AI group. In that case , this will work : Put a game logic somewhere on the map. Name it by example <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">dummytarget Now the script will be launched like this : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[NameOfAIgroup,dummytarget] exec "scriptname.sqs" scriptname.sqs will be : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_grp=_this select 0 _faketa=_this select 1 _boss=leader _grp _dire=getdir MisterX ~1 _boss move getpos _boss ~1 _faketa setpos [(getpos _boss select 0)+500*sin _dire, (getpos _boss select 1)+500*cos _dire, 2] ~0.5 {_x doWatch [(getpos _faketa select 0),(getpos _faketa select 1),2]} forEach units _grp Exit This script will order the leader of the AI group to stop (and so stop his group), by an alternative to dostop Then it moves the dummytarget gamelogic +/- 500m away of the AI group leader , and in the direction the MisterX unit is looking at. Once done, the script order every unit of the group to watch the game logic location. Share this post Link to post Share on other sites
longstreetcsa 1 Posted March 15, 2008 Hey Sanctuary! First I have to thank you for your quick answer to the question. But the thing is the group is indeed the players group - meaning the player is the groupleader. Still there are some situations where I want to stop the group in a certain position while I can move without them following me and screwing up their formation our leaving the position I want them to keep until I give the "follow me again" command. Hope it is clearer now what I want to do...but maybe the solution you brought up will work here too? BTW in the script you spoke of would such an AI controlled group that is watching that game logic target respond to the appearance of enemy soldiers? Or would they ignore them and keep staring at the specified location oblivious to the threat? Share this post Link to post Share on other sites
sanctuary 19 Posted March 15, 2008 In that case, just use the ingame interface, i mean -select your group , press then 1 then 6, so they stop -select them all again, let your ALT key pressed and click in the direction where you want them all to look at and they will do. But if you need it to be scripted, it is simple Always the game logic, same exec too , but the script this time : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_grp=_this select 0 _faketa=_this select 1 _boss=leader _grp _dire=getdir _boss ~1 {dostop _x} foreach units _grp ~1 _faketa setpos [(getpos _boss select 0)+500*sin _dire, (getpos _boss select 1)+500*cos _dire, 2] ~0.5 {_x doWatch [(getpos _faketa select 0),(getpos _faketa select 1),2]} forEach units _grp Exit For the AI, if it is aware of an enemy, it should logically stop watching the game logic position to engage the targets. Share this post Link to post Share on other sites
longstreetcsa 1 Posted March 18, 2008 thx Sanctuary I will give it a try... Is there a way to put the whole thing in this script so it is executet automatically as soon as you give the order with the addaction command starting this script? ====================================== _group=_this select 0 _leader = leader _group _direction = getdir MisterX {dostop _x; _x allowFleeing 0; _x disableAI "Target"; _x setdir _direction} forEach units _group Stopm=true comeflag=false Exit ====================================== Somehow I couldn't do it...some of my tries did nothing and one did move ME instead of the game logic. I am definitely doing something wrong here.... Share this post Link to post Share on other sites