Second 0 Posted March 18, 2007 Dang! I'm trying to upgrade one of my scripts to be able to handle Mech-inf tactics: The situation is following: They do not work by waypoints, they have multiple possible attackroutes for several objectives they are having, they has to act with out player affecting anyway to that (so player can be civilian or other out-sider which watches how attack goes). Here's reason why i'm not using waypoints: Defender has possibility to counterattack and drive mech-inf out of some spot, which after mech-inf has to regroup, supply (they receive new men and vehicles to replace lost ones) and attack again (or defend against another counterattack)... mission should last several days in gametime, and battle should wave to both directions (defender becomes attacker and attacker becomes defender). There is one BIG flaw! I don't know how to force cargo out of their group's vehicles (which doesn't have a specific name) by scripting solution. Let's say that part of company has moved to their routepoint in some "safe" spot away from defender's eye, after that they should start to close in defenders positions, but unload cargo before defenders AT-men can shred attack to bits. So here's my problem: Group's vehicles carry only vehicles's gunner, driver and commander, other groupmembers are on foot when they against attack enemy positions before defender has change to destroy vehicles and their cargo, without premade waypoints and only when script tells them to unload cargo. How to do this? In OFP i didn't found way to tell script how to seperate group's vehicle (without specific name) from other groupmembers and then force cargo out from vehicle. And now with ArmA i can't still find it... Is there? Another thing is also simple, but i haven't found way to do it: How to issue "stay back" (same which player can give to it's groupmembers by command-menu) to those same vehicles? Share this post Link to post Share on other sites
zwobot 22 Posted March 18, 2007 I am not really sure what you want but those are the commands to make AI disembark from vehicles: Action eject unassignVehicle to prevent ejected units from trying to embark again allowGetIn false To check which units of a group are in a vehicle use these: Driver Gunner crew Share this post Link to post Share on other sites
shuko 59 Posted March 18, 2007 Another possible approach: I assume since they arent named, they are dynamically created? So, if you cant use them in script since they are nameless, how about you try to name them with the init parameter when creating them? Share this post Link to post Share on other sites
Second 0 Posted March 18, 2007 To check which units of a group are in a vehicle use these:Driver Gunner crew To my understanding gunner, driver etc. aren't suitable, because it returns everyone was he gunner in vehicle or man out side vehicle in group ... If i type like '?(_man != gunner vehicle): unassignvehicle _man' gunner is still ordered to disembark. I haven't used this much, so it might be that i just doing something wrong. Shuko: Quote[/b] ]So, if you cant use them in script since they are nameless, how about you try to name them with the init parameter when creating them? Most likely that is the solution... I have to test it. I thank both of you very much. Share this post Link to post Share on other sites
zwobot 22 Posted March 18, 2007 because it returns everyone was he gunner in vehicle or man out side vehicle in group ... If i type like '?(_man != gunner vehicle): unassignvehicle _man' gunner is still ordered to disembark. I haven't used this much, so it might be that i just doing something wrong. I think this it what it is about? You want everybody to disembark except drivers and gunners. If you use "crew vehicle" you get an array that contains all units currently in this vehicle (including driver, gunner, commander). You can let the cargo units disembark with a forEach loop and check for driver, gunner and commander everytime so they don't are ordered to disembark. Share this post Link to post Share on other sites
Second 0 Posted March 18, 2007 If you use "crew vehicle" you get an array that contains all units currently in this vehicle (including driver, gunner, commander). You can let the cargo units disembark with a forEach loop and check for driver, gunner and commander everytime so they don't are ordered to disembark. That seems to work too... I made it like this: Quote[/b] ]_men = count units player #loop _group = units player ?((_men) < 0): hint "valmis"; exit ?(crew (_group select _men)): _men = _men - 1; goto "loop" ?(_group select _men) == gunner vehicle (_group select _men):[(_group select _men)] allowgetin true; _men = _men - 1; goto "loop" ?(_group select _men) == driver vehicle (_group select _men):[(_group select _men)] allowgetin true; _men = _men - 1; goto "loop" ?(_group select _men) == commander vehicle (_group select _men): [(_group select _men)] allowgetin true; _men = _men - 1; goto "loop" [(_group select _men)] allowgetin false _men = _men - 1 goto "loop" exit Oh well... now i have two of them. Both works same way. Here's what i made up: Quote[/b] ]_men = count units player #loop _group = units player ?((_men) < 0): exit ?(vehicle (_group select _men) isKindOf "LandVehicle" and (_group select _men) == gunner vehicle (_group select _men)): _men = _men - 1; goto "loop" ?(vehicle (_group select _men) isKindOf "LandVehicle" and (_group select _men) == driver vehicle (_group select _men)): _men = _men - 1; goto "loop" ?(vehicle (_group select _men) isKindOf "LandVehicle" and (_group select _men) == commander vehicle (_group select _men)): _men = _men - 1; goto "loop" [(_group select _men)] allowgetin false _men = _men - 1 goto "loop" exit Share this post Link to post Share on other sites
Big Dawg KS 6 Posted March 18, 2007 So unnessessary... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{unassignvehicle _X} foreach ((crew veh) - [driver veh,gunner veh,commander veh]) Share this post Link to post Share on other sites
Second 0 Posted March 18, 2007 So unnessessary...<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{unassignvehicle _X} foreach ((crew veh) - [driver veh,gunner veh,commander veh]) Yes it truly is ... As it doesn't work the way it should for my script, as script doesn't have name of vehicle... And basicaly it cannot as it has to work with every imaginable situation: Vehicles might be forced to join other groups by situation etc + there might be total of 20 vehicles for one side... Those two earlier do the job... just bit more optimizing. But thanks anyway as this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">((crew veh) - [driver veh,gunner veh,commander veh]) is something that will be very-very usefull to me. Share this post Link to post Share on other sites
cheezy_ofp 0 Posted September 7, 2008 So unnessessary...<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{unassignvehicle _X} foreach ((crew veh) - [driver veh,gunner veh,commander veh]) Yes it truly is ... As it doesn't work the way it should for my script, as script doesn't have name of vehicle... And basicaly it cannot as it has to work with every imaginable situation: Vehicles might be forced to join other groups by situation etc + there might be total of 20 vehicles for one side... Those two earlier do the job... just bit more optimizing. But thanks anyway as this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">((crew veh) - [driver veh,gunner veh,commander veh]) is something that will be very-very usefull to me. So unnessessary...<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{unassignvehicle _X} foreach ((crew veh) - [driver veh,gunner veh,commander veh]) What is the syntax to unassignVehicle more than one gunner? Is it something to do with turret instead of gunner? Ie. To assign two gunners to a vehicle can be... gunner1 MoveinTurret [Veh, [0]]; gunner2 MoveinTurret [Veh, [1]]; Share this post Link to post Share on other sites