Muzza 0 Posted November 18, 2009 Hello, I would like to have an artillery gun look although it is firing at a high trajectory at something terribly important far, far away. I have tried to have a game logic ('this setpos [(getpos this select 0),(getpos this select 1),8]') in theory hovering a few feet in front of the gun, and I told the gunner 'this dotarget target1'. On a trigger gunner1 fire "weapon". However i cant seem to ge thte gunner to track an invisible target in the air, any physical target i use fall down with gravity. Does anyon know how to make an invisible, imaginary and targetable thing hovering in mid-air? Share this post Link to post Share on other sites
tj72 0 Posted November 18, 2009 Try the lookat and the fire command. The lookat command should make the gunner aim the barrel at the logic (you can use Lasertarget objects as well) and the fire command is a manual trigger squeeze no matter where the AI is pointing so it can go off pointing at the ground if the target isnt up in the air command. Let me know if it doesnt work or you need more info. Share this post Link to post Share on other sites
Muzza 0 Posted November 18, 2009 (edited) The gunner looks at for example a hovering chopper just fine using this command. But when told to look at the game logic he strangely just slowly looks around in circles, sometimes changing direction on a low trajectory. I dont know how to make a 'lasertarget' in midair, do you '"las1" = "string" createvehicle position ? There isnt an ammoclassname for the laser designator, jst a magazine. So you cant make a laser the same way you can make an explosion. So how would i make this target for the cannon to aim at? ALSO: gunner1 fire "D30" strangely enough isnt working either. Edited November 18, 2009 by Muzza Share this post Link to post Share on other sites
f2k sel 164 Posted November 19, 2009 You could can make any object invisible, find one that they will target and place it in the air using the setpos code above and also put deletecollection this in the targets init. Armoured target (lockable) is quite good To target and fire I use this doTarget targetname;this dofire targetname placed in the init of the "D30" The reason the gamelogic won't work is that you can't place it above ground level. The only problem is that they can fire and hit the invisible targets causing a mid air explosions. Share this post Link to post Share on other sites
tj72 0 Posted November 19, 2009 (edited) Edited: The Arty will fire on the armored target object from the targets list. But other units could fire on the static arty object or a row of guns would possibly target the wrong object. But deletecollection with armored target will make the gun fire. But it also appears to collide with the object instead of going through it. Its like deletecollection doesnt take out collision with the round. The reason the GL didnt work was maybe because you used a location class logic instead of the object class logic, just a guess. If you use the manual fire method it works (I tested it) but I notice that occasionally the gun aims almost straight up in the air instead of at the floating target. It looks wierd and id say 80-90 percent of the time it doesnt do it. Im not sure why it happens but I noticed it happens when you try to make infantry fire with the fire command as well. I placed a M119 static arty unit with name gun1 in editor and a logic object named target1 I set the position of the logic object with your init code in front of the gun barrel a modest distance away. With the editor place and the height code its pretty easy to adjust for a high low angle and direction. You allready have the idea of a floating target so you just need to adjust the values a bit to get it placed right for the general effect. Then I made a script fired by a trigger and the trigger init was this: Radio [gun1,target1,10,4,"M119"] exec "fire.sqs" then I made the fire.sqs file: _gun = _this select 0 _target = _this select 1 _salvo = _this select 2 _wait = _this select 3 _weapon = _this select 4 _gun lookat _target ~_wait hintsilent "targeting..." ~2 _ran = random 3 ~_ran _counter = 0 #FIRE _gun lookat _target ~.2 _gun fire _weapon _counter = _counter + 1 hint format ["fire %1!",_counter] ~_wait _gun lookat _target _ran = random _wait ~_ran _gun lookat _target ? _salvo == 1:goto "End" _salvo = _salvo - 1 goto "FIRE" #END hintsilent "rounds complete...." exit This .sqs file will use the variables from the trigger line to determine number of rounds and the time to wait between shots and what weapon is being fired and theres random time added in to create more natural human feel to it. Theres a simple hint counting off the shots as well. The string name needs to be changed if a different weapon is used with this script. So this will be 10 rounds with 4 seconds between shots of the M119. Just an example of how I like to set things up with a script and not critical info to your idea necessarily. All the CFG Names including the Lasertargets are online at www.ofpec.com in the COMREF section (link is kind of hidden at the bottom of page) Other sources for comref but this is my favorite. So thats a working example, let me know if this helps or not. Edited November 20, 2009 by TJ72 Share this post Link to post Share on other sites
H3NRY 10 Posted November 19, 2009 that actually works great when targeting an invisible H pad :) It works with the gamelogic and deletecollection way seems to work for infantry with a popup target and commandfire. I cant get the M119 to fire on any listed target object with commandfire or dofire yet. Certain enemy objects will have gravity and wont hold position mid air anyway. The reason the GL didnt work was maybe because you used a location class logic instead of the object class logic, just a guess. If you use the manual fire method it works (I tested it) but I notice that occasionally the gun aims almost straight up in the air instead of at the floating target. It looks wierd and id say 80-90 percent of the time it doesnt do it. Im not sure why it happens but I noticed it happens when you try to make infantry fire with the fire command as well. I placed a M119 static arty unit with name gun1 in editor and a logic object named target1 I set the position of the logic object with your init code in front of the gun barrel a modest distance away. With the editor place and the height code its pretty easy to adjust for a high low angle and direction. You allready have the idea of a floating target so you just need to adjust the values a bit to get it placed right for the general effect. Then I made a script fired by a trigger and the trigger init was this: Radio [gun1,target1,10,4,"M119"] exec "fire.sqs" then I made the fire.sqs file: _gun = _this select 0 _target = _this select 1 _salvo = _this select 2 _wait = _this select 3 _weapon = _this select 4 _gun lookat _target ~_wait hintsilent "targeting..." ~2 _ran = random 3 ~_ran _counter = 0 #FIRE _gun lookat _target ~.2 _gun fire _weapon _counter = _counter + 1 hint format ["fire %1!",_counter] ~_wait _gun lookat _target _ran = random _wait ~_ran _gun lookat _target ? _salvo == 1:goto "End" _salvo = _salvo - 1 goto "FIRE" #END hintsilent "rounds complete...." exit This .sqs file will use the variables from the trigger line to determine number of rounds and the time to wait between shots and what weapon is being fired and theres random time added in to create more natural human feel to it. Theres a simple hint counting off the shots as well. The string name needs to be changed if a different weapon is used with this script. So this will be 10 rounds with 4 seconds between shots of the M119. Just an example of how I like to set things up with a script and not critical info to your idea necessarily. All the CFG Names including the Lasertargets are online at www.ofpec.com in the COMREF section (link is kind of hidden at the bottom of page) Other sources for comref but this is my favorite. So thats a working example, let me know if this helps or not. Share this post Link to post Share on other sites
Muzza 0 Posted November 19, 2009 I made an m119 called 'gun1' an empty car called 'target1' saved the script under fire.sqs, and triggered [gun1,target1,10,4,"M119"] exec "fire.sqs" yet this doesnt seem to be working for me. Share this post Link to post Share on other sites
H3NRY 10 Posted November 19, 2009 hmm... i placed an invisible H called hi1 with an init to setpos it above the ground, placed the m119 called art_1 and in the init of the m119 put [art_1,hi1,10,4,"M119"] exec "fire.sqs" saved the other stuff as fire.sqf and when you load up you see the arty gunner turn and fire on the mid air H Share this post Link to post Share on other sites
Muzza 0 Posted November 19, 2009 ok H3NRY, I started over, one inc H called hi1 (setpossed up), one m119 called art_1 and [art_1,hi1,10,4,"M119"] exec "fire.sqs" on the init line. Only i saved the other stuff as fire.sqs, not fire.sqf, is that what i am doing wrong? The hint messages tell me that the rounds are being processed, but the gun sits idle. I dont know what to do. Share this post Link to post Share on other sites
H3NRY 10 Posted November 19, 2009 ah a misstype on my side :) it was sqs sorry but it doesnt work? somethign else must be going on, go and find the rpt file ( arma2.rpt i think) and delete it then load arma, start your map and play it for a second then go look at the rpt file, should tell you if you have some small error or not... ill post a " mission" ,if you can call it that :), of it working for me in a second Share this post Link to post Share on other sites
bartkusa 10 Posted November 19, 2009 I had to jury-rig this problem for my Artillery Officer script. My work flow was like this: // Prevent spinning _gunner disableAi "MOVE"; _gunner disableAi "AUTOTARGET"; _gun doWatch [some, point, in space]; _gun doFire [blah blah blah]; Share this post Link to post Share on other sites
Muzza 0 Posted November 21, 2009 (edited) I cant get this to work for me atall, i think it is because the one segment of the script fire.sqf: '_gun fire _weapon' = gun1 fire "D30" Does not work for me. Yet when i activate a simple trigger init: gun1 fire "D30" The gun actually fires! Its the same script which magically doesnt work on this instance, everything else in this script is behaving perfectly. Edited November 21, 2009 by Muzza Share this post Link to post Share on other sites
tj72 0 Posted November 21, 2009 I tested with the D30 and it worked for me so I dont know what the problem could be. Also I noticed the aiming up thing seems to happen less or not at all if I increase the wait time between rounds. Share this post Link to post Share on other sites
Muzza 0 Posted November 22, 2009 I reduced the number of variables in the script and replaced a part of the scriptand now it works finally! thanks everyone for your help, i have no idea why the original didnt work for me. [10,4] exec fire2.sqs fire2.sqs _salvo = _this select 0 _wait = _this select 1 ~_wait ~2 _ran = random 3 ~_ran _counter = 0 #FIRE ~.2 gun1 fire "D30" _counter = _counter + 1 ~_wait _ran = random _wait ~_ran ? _salvo == 1:goto "End" _salvo = _salvo - 1 goto "FIRE" #END exit Share this post Link to post Share on other sites