killshot 5 Posted January 26, 2015 Hello everybody. I want a civilian unit to turn hostile (after a conversation), so I create a new group on enemy side and let the unit joinSilent. _grp = createGroup WEST; [badguy] joinSilent _grp; Then add magazine and weapon to it. The problem is, when the unit looks in a southern direction it will turn itself to north (~340° or ~40°) / turn it's back on me and will be no real threat but rather easy prey. Otherwise, when the unit looks north it won't turn to south direction. How come the unit turns north after joining a group and how am I able to stop that behaviour? Thanks for help. Share this post Link to post Share on other sites
dreadedentity 278 Posted January 26, 2015 I believe this happens because when you create a new group, all default information about it is created. One of those attributes is the groups "Formation Direction" and that is probably 0 default. So what's happening is that he joins the group, sees the formation direction is 0 so he turns to it, then since he's the group leader he may issue a new direction formation if there are nearby threats. Use the command setFormDir to manually change the formation direction (the wiki says you can use a group as input but I wouldn't trust an empty group). It may also stop him from turning if you simply order him to shoot at you using 1 of the 3 commands that do that, doFire, commandFire, fireAtTarget Share this post Link to post Share on other sites
killshot 5 Posted January 26, 2015 (edited) Thanks for your answer. I already tried it with doTarget before and now with the other commands you wrote, but it is not preventing the unit from turning. I'm not even sure if the unit is turning straight north to 0° everytime, it looks like it's something between 340° and 40° depending on which direction is closer to the former one. I will check it with a hint-message later, when I find the right command line :rolleyes: Now I have the idea to save the direction of the unit, before letting it join a new group and then directly setFormDir to it, after joinSilent. _dir = getDir badguy; _grp = createGroup WEST; [badguy] joinSilent _grp; badguy setFormDir _dir; At least it seems to work and makes the unit dangerous, hopefully in multiplayer-game, too. There's maybe a millisecond where you can see, that the unit gets redirected, but maybe that's the only (and best?) way to stop it from turning? Regards. :) Edit: I've checked unit's directions after joinSilent with unitDir = getDir badguy; hint format ["Unit Direction: %1,unitDir]; and unit is always turning to 330° or 30° unless it's between these two values, e.g. 335 or 25, then it will keep this direction. Edited January 26, 2015 by killshot Share this post Link to post Share on other sites
zapat 56 Posted January 26, 2015 Until you doStop a unit it will follow formation. So doStop it, and then make him doWatch a position. Share this post Link to post Share on other sites
killshot 5 Posted November 4, 2015 Could someone please provide the solution to summarize the code when there are more than just a few units? So instead of _dir1 = getDir badguy1; _grp1 = createGroup WEST; [badguy1] joinSilent _grp1; badguy1 setFormDir _dir1; ... _dir20 = getDir badguy20; _grp20 = createGroup WEST; [badguy20] joinSilent _grp20; badguy20 setFormDir _dir20; there will be only a few lines of code (more performant?). Thanks for the help. Share this post Link to post Share on other sites