major woody 11 Posted February 22, 2007 I'm beginning to loose my mind! I've got an old artilleryscript originally made for the FDF mortars which I'm trying to get to work with the ArmA howitzers. The problem is that the howitzers keep turning to the very same direction every time no matter where I click at the map, and they don't fire one single shot   *sight* Here's the code: Quote[/b] ]setfire2=true hint format ["Click on the map to set your firedirection","plain down"] onMapSingleClick "kohde1 setpos _pos;setfire2=false" @!setfire2 [] exec "artillery\fire1.sqs" "kohde" setmarkerpos getpos kohde1 fire2=true publicvariable "setfire2" ;publicvariable "kohde1" onMapSingleClick "" titletext ["","plain down"] exit fire1.sqs Quote[/b] ]_pos = _this select 0 "kohde" setMarkerPos _pos "kohde" setMarkerType "marker" player sideChat "Target selected" kohde1 setpos _pos _matka = launcher1 distance kohde1 _kerroin = 8000 / _matka #aluetarkistus ? (_matka < 1000) : goto "lyhyt" ? (_matka > 8000) : goto "pitka" #siirto _heitinpos = getpos launcher1 _hepix = _heitinpos select 0 _hepiy = _heitinpos select 1 _hepiz = _heitinpos select 2 _merkkix = _pos select 0 _merkkiy = _pos select 1 _merkkiz = _pos select 2 _valix = _merkkix - _hepix _valiy = _merkkiy - _hepiy _siirtox= _valix * _kerroin _siirtoy= _valiy * _kerroin _kohdex = _hepix + _siirtox _kohdey = _hepiy + _siirtoy _koro = 0 ? (_matka >= 1000 AND _matka < 1100) : _koro = 147 ? (_matka >= 1100 AND _matka < 1200) : _koro = 184 ? (_matka >= 1200 AND _matka < 1300) : _koro = 221 ? (_matka >= 1300 AND _matka < 1400) : _koro = 258 ? (_matka >= 1400 AND _matka < 1500) : _koro = 295 ? (_matka >= 1500 AND _matka < 1600) : _koro = 332 ? (_matka >= 1600 AND _matka < 1700) : _koro = 369 ? (_matka >= 1700 AND _matka < 1800) : _koro = 406 ? (_matka >= 1800 AND _matka < 1900) : _koro = 443 ? (_matka >= 1900 AND _matka < 2000) : _koro = 480 ? (_matka >= 2000 AND _matka < 2100) : _koro = 517 ? (_matka >= 2100 AND _matka < 2200) : _koro = 554 ? (_matka >= 2200 AND _matka < 2300) : _koro = 591 ? (_matka >= 2300 AND _matka < 2400) : _koro = 628 ? (_matka >= 2400 AND _matka < 2500) : _koro = 665 ? (_matka >= 2500 AND _matka < 2600) : _koro = 702 ? (_matka >= 2600 AND _matka < 2700) : _koro = 739 ? (_matka >= 2700 AND _matka < 2800) : _koro = 776 ? (_matka >= 2800 AND _matka < 2900) : _koro = 813 ? (_matka >= 2900 AND _matka < 3000) : _koro = 850 ? (_matka >= 3000 AND _matka < 3100) : _koro = 887 ? (_matka >= 3100 AND _matka < 3200) : _koro = 924 ? (_matka >= 3200 AND _matka < 3300) : _koro = 961 ? (_matka >= 3300 AND _matka < 3400) : _koro = 998 ? (_matka >= 3400 AND _matka < 3500) : _koro = 1035 ? (_matka >= 3500 AND _matka < 3600) : _koro = 1072 ? (_matka >= 3600 AND _matka < 3700) : _koro = 1109 ? (_matka >= 3700 AND _matka < 3800) : _koro = 1146 ? (_matka >= 3800 AND _matka < 3900) : _koro = 1183 ? (_matka >= 3900 AND _matka < 4000) : _koro = 1220 ? (_matka >= 4000 AND _matka < 4100) : _koro = 1257 ? (_matka >= 4100 AND _matka < 4200) : _koro = 1294 ? (_matka >= 4200 AND _matka < 4300) : _koro = 1331 ? (_matka >= 4300 AND _matka < 4400) : _koro = 1368 ? (_matka >= 4400 AND _matka < 4500) : _koro = 1405 ? (_matka >= 4500 AND _matka < 4600) : _koro = 1442 ? (_matka >= 4600 AND _matka < 4700) : _koro = 1479 ? (_matka >= 4700 AND _matka < 4800) : _koro = 1516 ? (_matka >= 4800 AND _matka < 4900) : _koro = 1553 ? (_matka >= 4900 AND _matka < 5000) : _koro = 1590 ? (_matka >= 5000 AND _matka < 5100) : _koro = 1627 ? (_matka >= 5100 AND _matka < 5200) : _koro = 1664 ? (_matka >= 5200 AND _matka < 5300) : _koro = 1701 ? (_matka >= 5300 AND _matka < 5400) : _koro = 1738 ? (_matka >= 5400 AND _matka < 5500) : _koro = 1775 ? (_matka >= 5500 AND _matka < 5600) : _koro = 1812 ? (_matka >= 5600 AND _matka < 5700) : _koro = 1849 ? (_matka >= 5700 AND _matka < 5800) : _koro = 1886 ? (_matka >= 5800 AND _matka < 5900) : _koro = 1923 ? (_matka >= 5900 AND _matka < 6000) : _koro = 1960 ? (_matka >= 6000 AND _matka < 6100) : _koro = 1997 ? (_matka >= 6100 AND _matka < 6200) : _koro = 2043 ? (_matka >= 6200 AND _matka < 6300) : _koro = 2071 ? (_matka >= 6300 AND _matka < 6400) : _koro = 2108 ? (_matka >= 6400 AND _matka < 6500) : _koro = 2145 ? (_matka >= 6500 AND _matka < 6600) : _koro = 2182 ? (_matka >= 6650 AND _matka < 6700) : _koro = 2219 ? (_matka >= 6700 AND _matka < 6800) : _koro = 2256 ? (_matka >= 6800 AND _matka < 6900) : _koro = 2293 ? (_matka >= 6900 AND _matka < 7000) : _koro = 2330 ? (_matka >= 7000 AND _matka < 7100) : _koro = 2367 ? (_matka >= 7100 AND _matka < 7200) : _koro = 2404 ? (_matka >= 7200 AND _matka < 7300) : _koro = 2441 ? (_matka >= 7300 AND _matka < 7400) : _koro = 2478 ? (_matka >= 7400 AND _matka < 7500) : _koro = 2515 ? (_matka >= 7500 AND _matka < 7600) : _koro = 2552 ? (_matka >= 7600 AND _matka < 7700) : _koro = 2589 ? (_matka >= 7700 AND _matka < 7800) : _koro = 2626 ? (_matka >= 7800 AND _matka < 7900) : _koro = 2663 ? (_matka >= 7900 AND _matka < 8000) : _koro = 2700 ? (_matka == 8000) : _koro = 2737 _num = 1 _hoo = 0 #loop ? (_matka >= 1000 AND _matka < 3000) : _kosa = -9 + random 18 ? (_matka >= 3000 AND _matka < 6000) : _kosa = -30 + random 60 ? (_matka >= 6000 AND _matka <= 8000) : _kosa = -60 + random 120 _saku1 = random 360 _sale1 = random 60 launcher1 DoWatch [_kohdex + _sale1 * (sin _saku1), _kohdey + _sale1 * (cos _saku1), _koro + _kosa] ? (_matka >= 1000 AND _matka < 3000) : _kosa = -9 + random 18 ? (_matka >= 3000 AND _matka < 6000) : _kosa = -30 + random 60 ? (_matka >= 6000 AND _matka <= 8000) : _kosa = -60 + random 120 _saku2 = random 360 _sale2 = random 60 launcher2 DoWatch [_kohdex + _sale2 * (sin _saku2), _kohdey + _sale2 * (cos _saku2), _koro + _kosa] ? (_matka >= 1000 AND _matka < 3000) : _kosa = -9 + random 18 ? (_matka >= 3000 AND _matka < 6000) : _kosa = -30 + random 60 ? (_matka >= 6000 AND _matka <= 8000) : _kosa = -60 + random 120 _saku3 = random 360 _sale3 = random 60 launcher3 DoWatch [_kohdex + _sale3 * (sin _saku3), _kohdey + _sale3 * (cos _saku3), _koro + _kosa] ? (_matka >= 1000 AND _matka < 3000) : _kosa = -9 + random 18 ? (_matka >= 3000 AND _matka < 6000) : _kosa = -30 + random 60 ? (_matka >= 6000 AND _matka <= 8000) : _kosa = -60 + random 120 _saku4 = random 360 _sale4 = random 60 launcher4 DoWatch [_kohdex + _sale4 * (sin _saku4), _kohdey + _sale4 * (cos _saku4), _koro + _kosa] ? (_matka >= 1000 AND _matka < 3000) : _kosa = -9 + random 18 ? (_matka >= 3000 AND _matka < 6000) : _kosa = -30 + random 60 ? (_matka >= 6000 AND _matka <= 8000) : _kosa = -60 + random 120 _saku5 = random 360 _sale5 = random 60 launcher5 DoWatch [_kohdex + _sale5 * (sin _saku5), _kohdey + _sale5 * (cos _saku5), _koro + _kosa] ? (_matka >= 1000 AND _matka < 3000) : _kosa = -9 + random 18 ? (_matka >= 3000 AND _matka < 6000) : _kosa = -30 + random 60 ? (_matka >= 6000 AND _matka <= 8000) : _kosa = -60 + random 120 _saku6 = random 360 _sale6 = random 60 launcher6 DoWatch [_kohdex + _sale6 * (sin _saku6), _kohdey + _sale6 * (cos _saku6), _koro + _kosa] ~5 _aika = random 1 launcher1 fire "Sh_122_HE" ~_aika _aika = random 1 launcher2 fire "Sh_122_HE" ~_aika _aika = random 1 launcher3 fire "Sh_122_HE" ~_aika _aika = random 1 launcher4 fire "Sh_122_HE" ~_aika _aika = random 1 launcher5 fire "Sh_122_HE" ~_aika _aika = random 1 launcher6 fire "Sh_122_HE" _hoo = _hoo + 1 _aika = random 1 _aika = _aika + 5 ~_aika ? _hoo < _num : goto "loop" goto "loppu" #lyhyt player sidechat "Target too close!" goto "loppu" #pitka player sidechat "Target out of range!" goto "loppu" #loppu player sidechat "Ready to fire" "kohde" setMarkerType "empty" 1 setRadioMsg "Rocket Artillery" exit Share this post Link to post Share on other sites
charonos 0 Posted February 22, 2007 Have a look at Mr-Murray's excellent artillery: Artillery Thread It works fine, maybe you don't need to convert your old script then. Seeing your scripts, i have the suggestion that dowatch might not work on artillery targets that are literally out-of-sight. Try having them watch a spot high in the air above the target like : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _launcher DoWatch [_x,_y,5000] They don't fire because your fire command has the wrong arguments, it works with : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _launcher fire "D30" Hope that helped. Charon Share this post Link to post Share on other sites
major woody 11 Posted February 22, 2007 The howitzers shoots now allright! - but what exactly do I replace Quote[/b] ]launcher1 DoWatch [_kohdex + _sale1 * (sin _saku1), _kohdey + _sale1 * (cos _saku1), _koro + _kosa] with then? Share this post Link to post Share on other sites
charonos 0 Posted February 22, 2007 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> launcher1 DoWatch [_kohdex + _sale1 * (sin _saku1), _kohdey + _sale1 * (cos _saku1), 5000] But i just see that you calculate the dowatch height, so the term you have should work fine... Share this post Link to post Share on other sites
major woody 11 Posted February 22, 2007 Nope - same direction, they are also aiming higher now... Share this post Link to post Share on other sites