mandoble 1 Posted April 24, 2006 Some of you may find this interesting. This way you may, for example, make any editor update static artillery shot real rounds. If you want a quick test, copy and paste the code, name it testcanon.sqs and follow these 3 steps. 1 - Open the editor and place 3 static artillery units (included in most editor updates) 2 - Name them artillery1, artillery2 and artillery3 3 - Execute [[artillery1, artillery2, artillery3],300,10,20,4,1.3,"Shell125", 3]exec"testcanon.sqs" <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ; testcanon.sqs ; By Mandoble ; ; Usage: ; [guns array, initial horizontal speed, initial vertical speed, number of rounds, barrel lenght, barrel height, round type, %speed deviation]exec"testcanon.sqs" ; ; guns array: array of objects, units or vehicles that will fire rounds ; initial horizontal speed: of the round in m/s ; initial vertical speed: of the round in m/s ; number of rounds: available per "artillery" unit ; barrel lenght: barrel lenght from the center of the unit in m. ; barrel height: barrel height from the base of the unit in m. ; round type: projectile type ; %speed deviation: % of possible horizontal and vertical speed deviation so you generate dispersion. ; use small %, for example 3 or less. ; ; Quick example: ; 1 - Open the editor and place 3 static artillery units (included in most editor updates) ; 2 - Name them artillery1, artillery2 and artillery3 ; 3 - Execute [[artillery1, artillery2, artillery3],300,10,20,4,1.3,"Shell125", 3]exec"testcanon.sqs" _canones = _this select 0 _ncanones = count _canones _inithspd = _this select 1 _initvspd = _this select 2 _rounds = _this select 3 _length = _this select 4 _height = _this select 5 _type = _this select 6 _dev = _this select 7 _salvas = 0 _maxsalvas = _rounds _spd = _inithspd _vh = _initvspd #salvas ;Turning guns #girar _icg = 0 ;The will turn in 10 steps, once every 0.05 secs _steps = 10 ;Random turning angle between -45 and 45 degrees _delta = ((random 90.0) - 45.0) / _steps #girarcanon "_x setDir ((getDir _x) + _delta)" forEach _canones _icg = _icg + 1 ~0.05 ?(_icg < _steps):goto "girarcanon" ;Guns aligned, start the shelling _i = 0 #canones _canon = _canones select _i _dir = (getDir _canon) + 180 _pos = getPos _canon ;Speed deviation _devr = random (_dev * 2.0) - _dev _devth = _inithspd * _devr / 100.0 _devtv = _initvspd * _devr / 100.0 _spd = _inithspd + _devth _vh = _initvspd + _devtv ;Final velocity vector _vel = [_spd*sin(_dir), _spd*cos(_dir), _vh] ;Shell is created _posp = [(_pos select 0) + _length * sin(_dir), (_pos select 1) + _length * cos(_dir), _height] PaySound "Fire" _pro = _type createVehicle _posp _pro setDir _dir _pro setVelocity _vel ;Smoke drop["cl_fire","","Billboard",100,3,[0,0,0],[0,_spd/4,_vh/4],0,20,20,0.05,[2,4,8,16],[[1,1,1,0.6],[0.07,0,0,0.5],[0,0,0,0.4],[0,0,0,0]],[0,1,0,0.33,0.66],0,0,"","",_pro] drop["cl_fire","","Billboard",100,3,[0,0,0],[0,_spd/5,_vh/5],0,20,20,0.05,[2,4,8,16],[[1,1,1,0.6],[0.07,0,0,0.5],[0,0,0,0.4],[0,0,0,0]],[0,1,0,0.33,0.66],0,0,"","",_pro] drop["cl_basic","","Billboard",100,3,[0,0,0],[0,_spd/6,_vh/6],0,20,20,0.05,[2,4,8,16],[[1,1,1,0.6],[0.07,0,0,0.5],[0,0,0,0.4],[0,0,0,0]],[0,1,0,0.33,0.66],0,0,"","",_pro] drop["cl_basic","","Billboard",100,3,[0,0,0],[0,_spd/7,_vh/7],0,20,20,0.05,[2,4,8,16],[[1,1,1,0.6],[0.07,0,0,0.5],[0,0,0,0.4],[0,0,0,0]],[0,1,0,0.33,0.66],0,0,"","",_pro] ~1 _i = _i + 1 ;More guns? ? (_i < _ncanones):goto "canones" ;More rounds left? _salvas = _salvas + 1 ? (_salvas < _maxsalvas): goto "salvas" exit Share this post Link to post Share on other sites
Mr_Tea 0 Posted April 25, 2006 When i whant to use arty, i use coc artillery. Best arty ever released for ofp. Rocket artillery, artilery cannons, artillery tanks, mortars and tomahawks fired by submarines, all this can be controlled via radio, or can be scripted. How to script coc arty? rtfm! btw: coc torpedos are also available. Share this post Link to post Share on other sites