MuadDib 0 Posted March 15, 2007 hey there, Just trying to convert an old sqs script into the new SQF format its the Airstrike one from murray (I think) anyway its giving me an error on line 36 saying missing ";", Ive triple checked it multiple times and for the life of me I cant figure it out (Im guessing its something glaringly obvious that I just cant see) here is the entire sqf file for reference. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> comment"=========DEFINE======================="; "Firedirection" setmarkerpos getpos ASTarget; _dropPosition = getpos ASTarget; sleep 0.5; _dropPosX = _dropPosition select 0; _dropPosY = _dropPosition select 1; _dropPosZ = _dropPosition select 2; sleep 0.1; _planespawnpos = [_dropPosX - 3000, _dropPosY, _dropPosZ + 1000]; _pilotspawnpos = [_dropPosX - 3000, _dropPosY, _dropPosZ + 1000]; comment"=========CREATE======================="; sleep 0.1; _plane = "AV8B" createvehicle _planespawnpos; _plane setpos [(getpos _plane select 0),(getpos _plane select 1),900]; _pilot = "SoldierWPilot" createUnit [getmarkerpos "Firedirection", dummy,"pilot1=this"]; _Plane setVelocity [50,0,0]; sleep 0.4; pilot1 MoveInDriver _plane; pilot1 setdamage 0; pilot1 action ["gear_up", vehicle pilot1]; _plane FlyInHeight 100; _plane SetSpeedMode "full"; while {(_plane distance ASTarget) > 1500}do { pilot1 doMove getpos ASTarget; pilot1 dotarget ASTarget; pilot1 dowatch ASTarget; } sleep 5.2; _plane FlyInHeight 90; _plane setpos [(getpos _plane select 0),(getpos _plane select 1),100]; sleep 1.05; _plane fire "BombLauncher"; sleep 0.1; _plane fire "BombLauncher"; sleep 0.6; _plane fire "BombLauncher"; sleep 0.1; _plane fire "BombLauncher"; sleep 0.6; _plane SetSpeedMode "normal"; sleep 3; _plane FlyInHeight 600; pilot1 doMove getpos Dummy; pilot1 dotarget Dummy; while{(_plane distance ASTarget) < 2500 }do { _plane Setdamage 0; pilot1 Setdamage 0; pilot1 MoveInDriver _plane; } ASTarget setpos getpos Dummy; "Firedirection" setmarkerpos getpos Dummy; deletevehicle _plane; deletevehicle pilot1; Share this post Link to post Share on other sites
norrin 9 Posted March 15, 2007 I've only had time to look at this quickly so I may have missed something quickly but try this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">comment"=========DEFINE======================="; "Firedirection" setmarkerpos getpos ASTarget; _dropPosition  = getpos ASTarget; sleep 0.5; _dropPosX = _dropPosition select 0; _dropPosY = _dropPosition select 1; _dropPosZ = _dropPosition select 2; sleep 0.1; _planespawnpos = [_dropPosX - 3000, _dropPosY, _dropPosZ + 1000]; _pilotspawnpos = [_dropPosX - 3000, _dropPosY, _dropPosZ + 1000]; comment"=========CREATE======================="; sleep 0.1; _plane = "AV8B" createvehicle _planespawnpos; _plane setpos [(getpos _plane select 0),(getpos _plane select 1),900]; _pilot = "SoldierWPilot" createUnit [getmarkerpos "Firedirection", dummy,"pilot1=this"]; _Plane setVelocity [50,0,0]; sleep 0.4; pilot1 MoveInDriver _plane; pilot1 setdamage 0; pilot1 action ["gear_up", vehicle pilot1]; _plane FlyInHeight 100; _plane SetSpeedMode "full"; while {(_plane distance ASTarget) > 1500}do { pilot1 doMove getpos ASTarget; pilot1 dotarget ASTarget; pilot1 dowatch ASTarget; }; sleep 5.2; _plane FlyInHeight 90; _plane setpos [(getpos _plane select 0),(getpos _plane select 1),100]; sleep 1.05; _plane fire "BombLauncher"; sleep 0.1; _plane fire "BombLauncher"; sleep 0.6; _plane fire "BombLauncher"; sleep 0.1; _plane fire "BombLauncher"; sleep 0.6; _plane SetSpeedMode "normal"; sleep 3; _plane FlyInHeight 600; pilot1 doMove getpos Dummy; pilot1 dotarget Dummy; while{(_plane distance ASTarget) < 2500 }do { _plane Setdamage 0; pilot1 Setdamage 0; pilot1 MoveInDriver _plane; }; ASTarget setpos getpos Dummy; "Firedirection" setmarkerpos getpos Dummy; deletevehicle _plane; deletevehicle pilot1; You need to put semicolons at the end of the funny shaped brackets. Share this post Link to post Share on other sites
MuadDib 0 Posted March 15, 2007 OMG... gotta get used to this darn syntax lol nailed it But the script doesnt seem to do anything anymore lol this is using 1.05 Share this post Link to post Share on other sites
norrin 9 Posted March 15, 2007 I'm not sure whether there is any more script that you haven't shown and I could be completely wrong as I haven't looked at this carefully but you may need to run/loop the script with some code like this <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_run = true; sleep 1; for [{}, {_run}, {_run}] do { Your script }; or something similar and add some other arguments to cover conditions for when you don't want the aircraft to attack or get the code to only execute once using a different run statement. Share this post Link to post Share on other sites
MuadDib 0 Posted March 15, 2007 the code I gave is the exact contents of the sqf file. That file is called via the execVM command in a trigger on radio alpha. please note FireDirection marker, ASTarget, dummy logic and invisible H called ASTarget_1 are all included in the map (pretty sure thats all thats needed to execute it) please note this script works fine pre 1.05 Share this post Link to post Share on other sites
UNN 0 Posted March 15, 2007 You need to add debug messages at various points in your script, to make sure each section is working the way you expect. Apart from that, using the while loop the way you are, is a bit overkill. It's making a move order something like every 0.001 seconds, add a pause using the sleep command. If you really want to use a while loop, change it to this and add a sidechat command so you can confirm it's getting at least that far: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">while {(_plane distance ASTarget) > 1500}do { pilot1 doMove getpos ASTarget; pilot1 dotarget ASTarget; pilot1 dowatch ASTarget; Player SideChat Format ["Aircraft is %1 meters away and Alive = %2",(_plane distance ASTarget),ALive _plane]; Sleep 5; } Quote[/b] ]I'm not sure whether there is any more script that you haven't shown and I could be completely wrong as I haven't looked at this carefully but you may need to run/loop the script with some code like this The while loop should now run indefinetly since the 1.05 patch. Share this post Link to post Share on other sites
MuadDib 0 Posted March 15, 2007 cheers for that mate, was looking for a good debug method. Reminds me of printf anyway the plane stays alive until about the 2400m mark, Im pretty sure it does a nice graceful unpowered fall from the 3000m mark. whats a good method to confirm the pilot is indeed inside the plane. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> Player SideChat Format ["Pilot is in %1 ",(vehicle pilot1)]; will that work? Share this post Link to post Share on other sites
UNN 0 Posted March 15, 2007 Quote[/b] ]cheers for that mate, was looking for a good debug method. Yeah, you have to resort to more primitive methods when it comes to debugging Arma If you want to check the state of the pilot and aircraft, try some of these: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Player SideChat Format ["The Pilot is %1, Pilot Alive=%2, Engine On=%3, Speed=%4, Height=%5",Driver _Plane,Alive (Driver _Plane),IsEngineOn _Plane,Speed _Plane,(GetPos _Plane) Select 2]; Share this post Link to post Share on other sites
Big Dawg KS 6 Posted March 15, 2007 Quote[/b] ]_pilot = "SoldierWPilot" createUnit [getmarkerpos "Firedirection", dummy,"pilot1=this"]; The createUnit command doesn't return anything like createVehicle does, I don't know if having the '_pilot =' there will cause any errors, but it shouldn't be there, I mean it'd be like doing this (just an example of using somevariable = for a command that doesn't return anything): <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_var1 = player setpos [0,0,0]; It's not like your script doesn't use the correct method for assigning the pilot to a variable though (and thus the '_pilot =' isn't even needed even if it did work). So in any case just remove that '_pilot =' in front of the createUnit command. Edit: Actually, in ArmA createUnit does return the unit but in order to do it that way it requires a different syntax than what you have. See createUnit array. If you used this then you won't even need the global variable pilot1 (which is good because you should always use local variables when you can), and just use the local one. So it's actually up to you, either remove the '_pilot =' or change your syntax for createUnit as is demonstrated on the Biki. Share this post Link to post Share on other sites
UNN 0 Posted March 15, 2007 Quote[/b] ]The createUnit command doesn't return anything like createVehicle does True, but he never refers to _pilot. At that point everything following, refers to pilot1. Which should be ok, unless it takes longer than 0.4 seconds to initialise the unit. Share this post Link to post Share on other sites
Big Dawg KS 6 Posted March 15, 2007 Quote[/b] ]The createUnit command doesn't return anything like createVehicle does True, but he never refers to _pilot. At that point everything following, refers to pilot1. Which should be ok, unless it takes longer than 0.4 seconds to initialise the unit. I know, I even said that, so it's not only wrong but it's totally unneccessary. I was just wondering if it would give him any errors or not, I can't remember from my own experiences wether using that on createUnit gives you an error. Share this post Link to post Share on other sites
MuadDib 0 Posted March 16, 2007 hmm still havent found the cause of the total failure in the script. Im beginning to think it could be something BIS changed in 1.05 as when I ran this exact script on a pre 1.05 install it worked. Either that means they "optimised" something which in turn broke my script or it was an inadvertant error. Share this post Link to post Share on other sites