OldGrandad 0 Posted March 30, 2004 All I want is a script that will be triggered that will move a crew into a tank (or multiple crews into multiple tanks) and then move on to a particular marker and patrol. Firstly is my poor attempt to script (never done it before) <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_c1 moveincommander _tank1 _c2 moveingunner _tank1 _c3 moveindriver _tank1 ~1 _tank1 move getmarkerpos "tank1move" ~2 _c4 moveincommander _tank2 _c5 moveingunner _tank2 _c6 moveindriver _tank2 ~1 _tank2 move getmarkerpos "tank2move" exit 2 tanks and 2 sets of crew already waiting. The trigger gets activated and my crews jump into their tanks and rush off to investigate, well that's my intention. I have spent a few fruitless hours mucking around without any joy. Please help an old frustrated wannabe OPF scripter. Share this post Link to post Share on other sites
m21man 0 Posted March 30, 2004 Putting an underscore before a word makes it a private variable that works only in the script. Therefore, if your tanks are tank1 and tank2 and your guys are c1, c2, c3, c4, c5, and c6 (Don't use underscores while naming units in the editor), then your script will look like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">c1 moveincommander tank1 c2 moveingunner tank1 c3 moveindriver tank1 ~1 (commander tank1) move getmarkerpos "tank1move" ~2 c4 moveincommander tank2 c5 moveingunner tank2 c6 moveindriver tank2 ~1 (commander tank2) move getmarkerpos "tank2move" exit Share this post Link to post Share on other sites
havocsquad 0 Posted March 30, 2004 Should the word move be commandmove instead, in order for a script to command a unit to move to a direction and take all under his command with him. Share this post Link to post Share on other sites
m21man 0 Posted March 30, 2004 Quote[/b] ]Should the word move be commandmove instead, in order for a script to command a unit to move to a direction and take all under his command with him. I'm pretty sure that move or domove will work too. Share this post Link to post Share on other sites
OldGrandad 0 Posted March 30, 2004 Well commandmove got them into the tanks, but they refused to go anywhere after starting the tanks up In the on activation field in the trigger I had <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[tank1,tank2] exec "tanksupport.sqs" with 2 invisible "H"s named tank1move and tank2move respectively. Um, any more ideas? Many thanks for your help so far  Share this post Link to post Share on other sites
Taurus 20 Posted March 30, 2004 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(commander tank1) move getmarkerpos "tank1move" getMarkerPos is only used for markers. your invisible h is an object an it's posistion is called by using getPos e.g <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(commander tank1) move getpos tank1move Hopes this helps Share this post Link to post Share on other sites
OldGrandad 0 Posted March 30, 2004 Thank you it worked but, I now have another problem which I find rather strange. The tanks and crew were already on the map ready to roll but at the same time the tanks are triggered so is a spawn trigger spawning 8 troops. Trouble is the troops start taking on the tanks and they are all "east"!!! How or why is this happening? I can't believe I get over one issue only to be faced with another. Share this post Link to post Share on other sites
hellfish6 7 Posted March 30, 2004 Well... when you spawn East troops on top of West units, they're gonna fight. Or do you mean that you don't want your East troops spawning on top of West unit? Is the East spawn supposed to be off in the distance? Share this post Link to post Share on other sites
OldGrandad 0 Posted March 30, 2004 No, all units on the map are exclusively "east" with no sign of an "enemy" unit. Share this post Link to post Share on other sites
m21man 0 Posted March 30, 2004 this setcaptive true might come in handy (If you put it in a units init line, it prevents everyone from shooting at the units). You can cancel this effect with this setcaptive false. Share this post Link to post Share on other sites
noundo 0 Posted March 31, 2004 It would be helpful if you detailed how the spawn trigger is working. Â Also, could you do the tank thing with only waypoints? Here is an alternative method of accomplishing what you are trying to do with the tank crews: Create your tank crews, and in their inits put this AssignAsposition tank1 where position could be Driver, Commander, or Gunner and tank1 would be the name of the tank this crew member is supposed to man. Â Make sure the commander, driver and gunner for each tank are grouped together, then create waypoints of HOLD, GETIN, and MOVE for each group. Â Then create a trigger of type SWITCH and sync (F5) it with the HOLD waypoints. Now when the SWITCH trigger is activated, the tank crews will man their tanks, and then move off to the MOVE waypoints positioned where you have the Invisible H's. Share this post Link to post Share on other sites
Taurus 20 Posted March 31, 2004 also, if you spawn east crews into west tanks they will be spotted as enemies to the east. Share this post Link to post Share on other sites
OldGrandad 0 Posted March 31, 2004 this setcaptive true might come in handy (If you put it in a units init line, it prevents everyone from shooting at the units). You can cancel this effect with this setcaptive false. I have placed "this setcaptive true" into the crews and tanks init lines but all I get then is the troops getting massacred by the tanks then. My issues do not lie with getting my tanks to roll now but the in house fighting, what gives??? noundo, thanks for your assistance but it is the fighting each other that is puzzling me. My trigger operates when Resistance enters the area and execs a script. I will try your alternate solution but will it stop them fighting each other? Share this post Link to post Share on other sites
OldGrandad 0 Posted March 31, 2004 It would be helpful if you detailed how the spawn trigger is working. Â Also, could you do the tank thing with only waypoints?Here is an alternative method of accomplishing what you are trying to do with the tank crews: Create your tank crews, and in their inits put this AssignAsposition tank1 where position could be Driver, Commander, or Gunner and tank1 would be the name of the tank this crew member is supposed to man. Â Make sure the commander, driver and gunner for each tank are grouped together, then create waypoints of HOLD, GETIN, and MOVE for each group. Â Then create a trigger of type SWITCH and sync (F5) it with the HOLD waypoints. Now when the SWITCH trigger is activated, the tank crews will man their tanks, and then move off to the MOVE waypoints positioned where you have the Invisible H's. I did try your example and even though it worked a treat it did not stop them being targeted by the spawned troops. Share this post Link to post Share on other sites
Junker 0 Posted April 1, 2004 Try spawning the Units with: _unit SetCombatMode "BLUE" Then when you want them to fire just set it to "RED" Share this post Link to post Share on other sites
noundo 0 Posted April 1, 2004 Could you try putting yoursself (player) as one of the tank crew and see how the tank crew group see's the spawned soldiers (friend or foe)? Another thought would be to have an high ranking object that you temporarily group everyone to (tank crews and spawned troops) so that they are all forced to be friendly. You would only have to gorup them with this object for split second as each unit was created. Quote[/b] ]My trigger operates when Resistance enters the area and execs a script. Can you post the contents of your spawn script? I would be willing to bet 2 smileys that there is something in there messing with the side the spawned troops are assigned to. Share this post Link to post Share on other sites
OldGrandad 0 Posted April 1, 2004 Thank you all for responding with thoughts and ideas for workarounds. I have now resolved the issue after overlooking the most obvious and looking for the most complicated answer. Please do not laugh, I use "dummies" as spawn group references and when I checked them they were indeed "west" units. Even though they were triggered to delete themselves they obviously had an effect on the spawned "east" units. I changed them to "east dummies" and there is no in house fighting. Boy oh boy, sometimes you do not see what is in front of you Share this post Link to post Share on other sites
noundo 0 Posted April 2, 2004 Theres your 2 smileys I owe you since it wasn't the spawn script!!! Share this post Link to post Share on other sites