zonekiller 175 Posted March 28, 2007 i wrote this on the weekend and it works realy well If you have empty vehicles in a town and when the AI move into town they will jump into whatever is there and if it fills up the rest of the group will find a new vehicle ect ;; IE 1 group of 20 will fill 2 tanks, 1 vulcan, 3 jeeps ect  THE TRIGGER [thislist] exec "getin.sqs     trigger array --- set a delay so the group have time to get in the trigger or [alpha] exec "getin.sqs      group or [man1] exec "getin.sqs      leader unit ;Script By Michael ---  www.zonekiller.ath.cx --- zonekiller@iinet.net.au _grp = _this select 0 _aunits = units _grp ~0.1 ;makes an array of all empty vehicles on the island of these types , Add more types if needed  _objects = nearestObjects [leader _grp,["jeep","car","air","Tank",truck"," ship"],6000] _b = 0 _t = 0 _s = count _aunits ; if no empty vehicles exit ?count _objects == 0 : goto "exit" ;if unit is already in a vehicle goto next unit #loop ? vehicle (_aunits select _t) != (_aunits select _t) : _t =_t + 1; goto "loop" ~0.1 ;selects first vehicle in the array _truck = _objects select _b ;if no vehicles within 200 mtrs exit, change to suit ? _truck distance (_aunits select _t) > 200 : exit ~0.1 ; check for empty positions in vehicle _freecommander = _truck emptyPositions "commander" _freedriver = _truck emptyPositions "driver" _freegunner = _truck emptyPositions "gunner" _com = 0 _driver = 0 _gunner = 0 ;if you set this number to 2 it will leave 2 empty spaces in the vehicle. 1 for 1 , 3 for 3 _cargo = 0 ;if vehicle is not empty get next vehicle ; take this line out --?(_h > 0) : _b = _b + 1 ; goto "loop"-- if you want ai to get into a vehicle that has some units in it _c = units _truck ~0.1 _h = count _c ~0.1 ?(_h > 0) : _b = _b + 1 ; goto "loop" ; puts unit into these position if available ~0.2 ?(alive (_aunits select _t)) && (_freedriver > _driver) : _driver = 1; (_aunits select _t) AssignAsdriver _truck; _t = _t + 1 ~0.2 ?(alive (_aunits select _t)) && (_freegunner > _gunner) : _gunner = 1; (_aunits select _t) AssignAsgunner _truck; _t = _t + 1 ~0.2 ?(alive (_aunits select _t)) && (_freecommander > _com) : _com = 1;(_aunits select _t) AssignAscommander _truck; _t = _t + 1  ~0.2 _b = _b + 1 ~1 ;check how many cargo positions are available _freecargo = _truck emptyPositions "cargo" #getin ;if unit is already in a vehicle goto next unit ? vehicle (_aunits select _t) != (_aunits select _t) : _t =_t + 1; goto "getin" ~0.5 ?(alive (_aunits select _t)) && (_freecargo > _cargo) : (_aunits select _t) AssignAscargo _truck ~0.1 ;when vehicle is full it will look for next vehicle ?(alive (_aunits select _t)) && (_freecargo <= _cargo) : goto "loop" _t = _t + 1 _cargo = _cargo + 1 ;selects next unit to get in the vehicle ~0.1 ?(_t < _s) : goto "getin" _aunits orderGetIn true exit i have found no problems with it as long as there is some empty vehicles on the map and they are within 6000 mtrs of the unit Michael Share this post Link to post Share on other sites
-SPA-LynxEye 0 Posted March 28, 2007 You got it! Only one doubt as a way to test your script: With: _freegunner = _truck emptyPositions "gunner" it will check for free 2nd gunner seats too? And the last evil doubt... If AI is inside a vehicle, and got killed... emptypositions will not remove that 'seat' in its counter till the 'corpse' is outside. Test it. Maybe i'm wrong... Simply, you got it. Share this post Link to post Share on other sites
colligpip 0 Posted March 28, 2007 how do i get this to work with respawning units? Share this post Link to post Share on other sites
zonekiller 175 Posted March 28, 2007 With revive respawn i find if the vehicle is still alive the ai will remount you could try setting a trigger with activation alive myman1 for each unit as if some of the units are in a vehicle the script will skip them and get units not in vehicles to get in one Michael Share this post Link to post Share on other sites
zonekiller 175 Posted March 28, 2007 the command _truck emptyPositions "gunner" only reports 1 gun position even in choppers so it appears just dump some vehicles in front of a squad set a trigger to [alpha] exec "getin.sqs" and and on the leader put in alpha = group this see what happens Michael Share this post Link to post Share on other sites
-SPA-LynxEye 0 Posted March 28, 2007 When me at home, i will give you a simple lines to check if 2nd Gunner is present (if alive or dead) in a UH60MG. I think that UH60MG has to be named. Not sure. Can't remember. Reargunner in RHIB2Turret can be checked too in the same way but with a little difference. Can't remember who wrote a piece of script in this forum to check 2nd turrets. Search tool. If when you reading those solutions, still you want another way to check it... just say me it, and when me at home again (today) i will post it. Maybe a little long lines, but is 99% perfect. 1% is fault by Mikrosoft lol , just a joke. Share this post Link to post Share on other sites
zonekiller 175 Posted March 28, 2007 Thanks I would like to know how to check for the second gunner Share this post Link to post Share on other sites
-SPA-LynxEye 0 Posted March 28, 2007 This is the links to posts when i was saying 'who wrote that posts'. Please, read first this one: http://www.flashpoint1985.com/cgi-bin....t=55222 And then this one: http://www.flashpoint1985.com/cgi-bin....1037349 Probably it exists more posts or even Wiki places to read about this turrets-questions. Ah, if the way that i'm linking the posts is not a legal/good one, please, give me a little light to do it legal/better. Share this post Link to post Share on other sites