OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Captain Crunch on 18 Apr 2007, 21:40:06

Title: Artillery Strike with the Laser Designator
Post by: Captain Crunch on 18 Apr 2007, 21:40:06
Hi everyone!

Is it possible to simulate an artillery strike with the help of the laser designator?
Title: Re: Artillery Strike with the Laser Designator
Post by: RaymondLu on 19 Apr 2007, 11:38:14
ofcoz it is.

the key is to get the the laser targeted  object(position)

try this :

_postarget =position ( (position player nearObjects["LaserTarget",1000]) select 0)

1000 is the radius.

then u can have those arties fire on that position.
Title: Re: Artillery Strike with the Laser Designator
Post by: bardosy on 21 Apr 2007, 09:35:25
That's great! I tied it and work!!! But how can I create a hellfire attack against the laser target?

I createdVehicle a hellfire rocket, but it fly away... Then I setVectorDir it, but setvectordir change only it's horizonatl direction, not the vertical. Then I tried the setVelocity, but same effect...

How can I create a hellfire (or other rocket) in the air (about 200m) and target it to the laser target?
Title: Re: Artillery Strike with the Laser Designator
Post by: Mandoble on 21 Apr 2007, 09:53:12
Using a missile script (http://www.ofpec.com/forum/index.php?topic=29031.0).
Title: Re: Artillery Strike with the Laser Designator
Post by: bardosy on 21 Apr 2007, 10:20:38
I tried exemine it, but it's a lot of script files...
Title: Re: Artillery Strike with the Laser Designator
Post by: Captain Crunch on 21 Apr 2007, 14:06:15
I must be really dumb! I can't even make the laser designator work. I am also not sure where to put this code from RaymondLu. Can someone help me a little? Thanx people!
Title: Re: Artillery Strike with the Laser Designator
Post by: Mandoble on 21 Apr 2007, 14:46:12
Yep, lots of scripts and a doc folder with a nice HowTo.txt file.

Anyway, grab here the Laser Designator Demo (http://www.ofpec.com/forum/index.php?topic=29031.15). You only need to keep an eye to init.sqs and laserfire_keys.sqf. Both of them are a quite short and understandable.
Title: Re: Artillery Strike with the Laser Designator
Post by: bardosy on 22 Apr 2007, 10:46:29
sorry mandoble, i possibl found something else.... maybe the demo... but there was no howto.txt just a lot of script file.
I'll check your site again...
Title: Re: Artillery Strike with the Laser Designator
Post by: bardosy on 23 Apr 2007, 08:51:20
Thanx Mandoble!!!!

I use the testbad mission to understand your script.
But it extremly depend on the terrian. I try to hit a T-72 in Paraiso with a missiole from south coast of South-Sahrani and it was impossible. The missile could guide through the mountain and THEN hit the groud from a kilometer far from Paraise. It was interesting... I thought the missile will crash with the mountain, but no. But the mountain made the confuse of missile, because when I relocate the launcher, the missile hit the tank correctly.

I tried to change the parameters (cruise alt = 120, etc...) but didn't help and missile couldn't hit the tank if it launched behind the mountain.
Title: Re: Artillery Strike with the Laser Designator
Post by: Mandoble on 23 Apr 2007, 09:37:03
The missile has many many parameters to play with, for example, initial elevation and initial mode. Mode 2 is active (this mode is used as soon as the target's predicted position is inside missile's inboard seeker range. In active mode the missile will not avoid terrain at all (if this parameter was set to true). Consider also that cruise altitude is above sea level, not above ground level. The flight patron you may be looking for is something like that:
- Missile is fired upwards, 45 degrees elevation angle.
- Missile is initially fired in inertial mode 0 (it will climb to cruise altitude and then it will try to keep cruise altitude while flying to seeker activation point).
- Missile will try to avoid terrain elevations while flying in not active mode (2). This is not really needed if your flight patron is high enough over the terrain.
- Missile activates its seeker relatively close to the target, 600~800m inboard seeker range.

Anyway, as said, the mission you were looking for is already done and ready to download here (http://www.ofpec.com/forum/index.php?topic=29031.15). Look for an attachment named laser_missile.intro.zip halfway in that page. That mission covers laser designation and missiles being fired behind elevations by hidden choppers. In this mission, the missiles need only an slight initial fire angle to avoid the mountains and island coast. So they fly all the time in active mode and do not even care to avoid terrain elevations.

In the same page there is another attachment named mando_missile_lab.Sara.zip (read the important NOTE in the post). You may use the tool preset there to set all the desired parameters for a missile and test them firing against several targets. Then you may copy/paste these parameters to use in your mission.
Title: Re: Artillery Strike with the Laser Designator
Post by: bardosy on 23 Apr 2007, 10:24:38
Quote
- Missile is fired upwards, 45 degrees elevation angle.
DONE
Quote
- Missile is initially fired in inertial mode 0 (it will climb to cruise altitude and then it will try to keep cruise altitude while flying to seeker activation point).
DONE
Quote
- Missile will try to avoid terrain elevations while flying in not active mode (2). This is not really needed if your flight patron is high enough over the terrain.
DONE
Quote
- Missile activates its seeker relatively close to the target, 600~800m inboard seeker range.
That could be the problem... I used your script from your testbed mission and the init range was 800m. When the missile hit the ground, I chnage this range to 1000... I will try change it down....
Title: Re: Artillery Strike with the Laser Designator
Post by: Mandoble on 23 Apr 2007, 10:31:20
Or just mark me from where do you want to fire to where and I'll give you a working parameter set for the missiles. BTW, do not use the testbed, it is already obsolete. Use mando_missile_lab mission, much better suited to test missile parameters.

EDIT: This topic is not really related to missiles, if you have any further doubt or problem, please, lets use the proper topic in Scripting Resources Betatesting board.
Title: Re: Artillery Strike with the Laser Designator
Post by: bardosy on 23 Apr 2007, 11:16:39
Thanks Man!

I'll use the lab mission next time, and I will write to the right topic (and not here).

And Mandoble... That's script is a GREAT WORK! Congratulation...
Title: Re: Artillery Strike with the Laser Designator
Post by: Novusordo on 24 Apr 2007, 03:08:10
ofcoz it is.

the key is to get the the laser targeted�  object(position)

try this :

_postarget =position ( (position player nearObjects["LaserTarget",1000]) select 0)

1000 is the radius.

then u can have those arties fire on that position.

what??? where does that coding go???
Title: Re: Artillery Strike with the Laser Designator
Post by: RaymondLu on 24 Apr 2007, 09:04:56
That's great! I tied it and work!!! But how can I create a hellfire attack against the laser target?

I createdVehicle a hellfire rocket, but it fly away...

setDir, velocity and setVelocity are all you need to make those rockets to fly straight.

init the dir of the rocket use setDir.....

well, if you want to add a rocket launcher on ur motor-bike .
rocket setDir getDir bike
remember , put this in a loop or else the rocket wont turn as u turn the bike.

have fun.






Title: Re: Artillery Strike with the Laser Designator
Post by: bardosy on 24 Apr 2007, 09:35:13
Maybe you didn't understand...(it's my fault)
setDir is set only the horizontal direction. But I want change the vertical direction.
Title: Re: Artillery Strike with the Laser Designator
Post by: RaymondLu on 24 Apr 2007, 09:49:32
Maybe you didn't understand...(it's my fault)

how about these :

vectorDir
Description:
Return object's direction vector in world coordinates as [x, z, y].

Syntax

vectorDir obj
Parameters:
obj: Object
Return Value:
Array


vectorUp
Description:
Return object's up vector in world coordinates as [x, z, y].

Syntax:
vectorUp obj
Parameters:
obj: Object
Return Value:
Array


i've never tried , hope it works
Title: Re: Artillery Strike with the Laser Designator
Post by: bardosy on 24 Apr 2007, 09:56:46
I tried... Not work.

But it's not too important now, because I used Mandoble missile script.

It's just the curiosity... ;)
Title: Re: Artillery Strike with the Laser Designator
Post by: Novusordo on 24 Apr 2007, 09:58:19
ofcoz it is.

the key is to get the the laser targeted�  object(position)

try this :

_postarget =position ( (position player nearObjects["LaserTarget",1000]) select 0)

1000 is the radius.

then u can have those arties fire on that position.

what??? where does that coding go???
Title: Re: Artillery Strike with the Laser Designator
Post by: Mandoble on 24 Apr 2007, 15:44:05
Novusordo, what do you mean with that message? Aside of filling up the screen with already said contents ...  If you have a particular question, ask it, if not, please, help us to keep this, and any other thread, as clean of redundant info as possible.
Title: Re: Artillery Strike with the Laser Designator
Post by: Captain Crunch on 24 Apr 2007, 15:59:18
@RaymondLu

Hi there, like Novusordo, I still don't understand Your very first post in this thread. Your idea seems nice and simple but for example, I don't know where to put this code:
Code: [Select]
_postarget =position ( (position player nearObjects["LaserTarget",1000]) select 0). Or I don't  know if it is all I need to make the laser designator function. I doubt so. Could You please explain in a little more details for us? Thanx!
Title: Re: Artillery Strike with the Laser Designator
Post by: Novusordo on 24 Apr 2007, 16:17:22
@RaymondLu

Hi there, like Novusordo, I still don't understand Your very first post in this thread. Your idea seems nice and simple but for example, I don't know where to put this code:
Code: [Select]
_postarget =position ( (position player nearObjects["LaserTarget",1000]) select 0). Or I don't  know if it is all I need to make the laser designator function. I doubt so. Could You please explain in a little more details for us? Thanx!

x2

.....
Title: Re: Artillery Strike with the Laser Designator
Post by: Mandoble on 24 Apr 2007, 16:27:43
The line step by step:
position player nearObjects["LaserTarget",1000]
that returns an array of objects of type "LaserTarget" closer than 1000m to the player's position ordered by distance. Of course, if no "LaserTarget" object is found, the returned array will be empty. But if one or more objects of that type were found, they will be placed in the returning array with the closest the first. So:

(position player nearObjects["LaserTarget",1000]) select 0
Selects the first item of the supposedly not empty returned array.

And as it is, in fact, an existing object, with:
position ( (position player nearObjects["LaserTarget",1000]) select 0)
you get the position of the lasertarget object closest to the player.

Now that code has a little problem, because if no lasertarget is present, the returned array of objects would be empty, so you cannot select index 0 from it, much less to get the position of a non-existant array element.

but all in all, with that line of code you get the position of a laser designator target, if any. Now, with that position you may do whatever you want to do. Note also that _postarget is a local variable, so it is suited to be placed inside a script.