Home   Help Search Login Register  

Author Topic: I need a stolen Hind to pick up an American Laser.  (Read 2666 times)

0 Members and 1 Guest are viewing this topic.

Offline Bennet

  • Members
  • *
I need a stolen Hind to pick up an American Laser.
« on: 31 Dec 2007, 20:20:46 »
I need a stolen Hind to pick up an American Laser designator.   :scratch:

Does anyone know if this is possible?  I'm not sure if the Hind doesn't see the laser because its an enemy laser technically, or what.   ???

This should be a pretty sweet mission I'm developing, and with one other question I'll leave you good people to more complex questions, do you know how to get the AI to designate infantry with the laser?   ???

Because in my experience, the AI with only paint armored targets.

 
Bennet

"Mr. President, I'm not saying we won't get our hair mussed. I do say, no more than ten to twenty million killed, tops! Depending on the breaks."

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: I need a stolen Hind to pick up an American Laser.
« Reply #1 on: 01 Jan 2008, 14:42:36 »
you can do it manually by giving teh chopper a waypoint to land at the laser, then when in range, the laser is delete and one is put into the choppers cargo, if thats what you mean.
Campaigns are hard, I'll stick with scripting for now!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: I need a stolen Hind to pick up an American Laser.
« Reply #2 on: 01 Jan 2008, 14:51:22 »
I think he was trying to make a Hind (some external addon I guess) to lock on and fire against a target designated by a "western" laser target.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: I need a stolen Hind to pick up an American Laser.
« Reply #3 on: 01 Jan 2008, 23:26:04 »
You could detect where the Eastern laser target was and create a Western laser target object in the same location then move the western laser target to the Eastern laser's position until it is turned of (the target isNull).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Bennet

  • Members
  • *
Re: I need a stolen Hind to pick up an American Laser.
« Reply #4 on: 03 Jan 2008, 04:32:15 »
Ok, how would i do that Spooner?   :dunno:

I'm just a novice at best when it comes to this stuff, but I like to learn.

Sorry for the confusion by the way, what I meant to ask was how to get the hind to "see" the western laser designation as a western soldier paints a target?   ???

Basically my mission goes something like this, western soldiers are using eastern hinds for plot reasons (CIA operation lets say, so no western equipment.)  The guys on the ground are set up around an airbase they're about to attack, when the order is given, the hinds swoop in, provide CAS and then extract the operatives and the captured spy.

Does anyone know how to get the men to use the laser designator exclusively?   :dunno:  So that they would paint infantry targets as well?

And I know when you add a laser, you add it as: this addweapon "laserdesignator", but I can't find a the input for the battery ammo.  Any help there?   ???   :dunno:

Thanks a bunch for the insight and patience.   :D   :good:

---------------------------------------------------------------------------------------------------------------------------



Last two things, I'm not sure if I should have started a new post or not, if so please let me know..........

1.  Is it possible for the stolen hinds to show up on radar as green instead of red?

2.  I found the proper coding to create radio messages for each of the hinds if they exceed .90 in damage (I believe this is the percentage where the AI says "let's call it a day and set this bird down"), how would I make the newly grounded AI pilots activate another trigger when they get out of their chopper's (assuming they're still alive), I found a script where you can activate a smoke grenade under certain circumstances:  Smoke="SmokeShellGreen" createVehicle [(getPos spy select 0),(getPos spy select 1), 2]; and this works great.  I'm wanting the living downed pilots to pop smoke grenades and be rescued.

 :)

Thanks again.
« Last Edit: 03 Jan 2008, 18:16:11 by Bennet »
Bennet

"Mr. President, I'm not saying we won't get our hair mussed. I do say, no more than ten to twenty million killed, tops! Depending on the breaks."

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: I need a stolen Hind to pick up an American Laser.
« Reply #5 on: 03 Jan 2008, 08:52:19 »
Quote
I'm not sure if I should have started a new post or not, if so please let me know
Actually in case like this you should have edited the earlier post instead of making a new one. :)
At least couple of day should pass before 'replying to yourself'..

You can view all sorts of rules by following links in this thread.


Oh, and
:welcome: Welcome to OFPEC :welcome:
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: I need a stolen Hind to pick up an American Laser.
« Reply #6 on: 03 Jan 2008, 14:35:37 »
"LaserBatteries" is the magazine for the "LaserDesignator" (See the weapons list in the COMREF for a full list of weapons, magazines and ammo types).
Quote from: Bennet
1.  Is it possible for the stolen hinds to show up on radar as green instead of red?

No. Not unless you made a new addon (config) for the hind which was for a friendly side. This wouldn't be difficult to do, and would only be a few K in size, assuming they had the normal Hind installed, but would mean that players would need a special addon for just your mission, which is undesirable.
Quote from: Bennet
2. how would I make the newly grounded AI pilots activate another trigger when they get out of their chopper's

You could run this code when the hind gets too damaged (Assumes the hind has var-name of "hind"):
Code: [Select]
_pilot = driver hind;

// Wait until the pilot is out of the helo and on the ground or the pilot is dead.
waitUntil { (((vehicle _pilot) != _hind) and (((getPos _pilot) select 2) <= 0)) or (not (alive _pilot)) };

// You might want to put a delay in here before the pilot pops the smoke. Not sure what delay would look best.
sleep 4;

if (alive _pilot) then
{
    "SmokeShellGreen" createVehicle (getPos _pilot);
};
Quote from: Bennet
Does anyone know how to get the men to use the laser designator exclusively?   Don't Know  So that they would paint infantry targets as well?

Not sure whether you can do this simply. Either:
1. I think you'd need to create invisible vehicles (such as the invisible targets in an addon such as MAP misc) with a script at the position of the infantry to make the AI paint them as a target (well, they'd be painting the invisible target, but the effect would be as if they were painting the infantry).
2. Create a laser target object:
Code: [Select]
_laser = "laserTargetW" createVehicle (getPos targetSoldier)
// later, for example when the soldier with the laser designator or the target soldier are dead...
waitUntil { (not (alive laserSoldier)) or (not (alive targetSoldier)) };
deleteVehicle _laser;
at the position of the infantry (this would be visible to the hind, but no actual AI would have used the laser designator). You'd need to remember to manually delete the target after use, since otherwise it would stay in the position indefinitely.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Bennet

  • Members
  • *
Re: I need a stolen Hind to pick up an American Laser.
« Reply #7 on: 03 Jan 2008, 18:22:00 »
Many thanks!  I'll try this out.   :clap:

Spooner, I'm a little scared of scripting, I usually just try to stuff all of this stuff in the game triggers, please forgive the redundancy of my question(s), but, I would write a script that looks exactly like what you've posted below?:

_pilot = driver hind;

// Wait until the pilot is out of the helo and on the ground or the pilot is dead.
waitUntil { (((vehicle _pilot) != _hind) and (((getPos _pilot) select 2) <= 0)) or (not (alive _pilot)) };

// You might want to put a delay in here before the pilot pops the smoke. Not sure what delay would look best.
sleep 4;

if (alive _pilot) then
{
    "SmokeShellGreen" createVehicle (getPos _pilot);
};



Thanks Again!   :D   :)

 :good:

« Last Edit: 03 Jan 2008, 18:30:56 by Bennet »
Bennet

"Mr. President, I'm not saying we won't get our hair mussed. I do say, no more than ten to twenty million killed, tops! Depending on the breaks."

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: I need a stolen Hind to pick up an American Laser.
« Reply #8 on: 03 Jan 2008, 20:59:33 »
Well, that script would only work if the helicopter had been given the var-name "hind" in the editor. I was assuming that you would run the script (with execVM) when you had detected that the helicopter was damaged (you could run it from the start of the mission, but that would be a wee bit inefficient ;P ).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Bennet

  • Members
  • *
Re: I need a stolen Hind to pick up an American Laser.
« Reply #9 on: 03 Jan 2008, 21:31:26 »
Thanks Spooner, you've been a great help and patient putting up with my ignorance.   :clap:   :good:

I'm not familiar what execVM is, I'll look for it.   :yes:

So, just to claify:

I need a trigger and in the condition field it needs to say something along the lines of:  getdammage hind >= 0.9

And then follow with the script you've written with the name "hind".

If I recall, when you want to run a script, you just give it a name, pack in everything you've listed below into an sqm file, put it in the mission folder and..............

Under Activation put run _X.sqm, is that correct?   :scratch:
Bennet

"Mr. President, I'm not saying we won't get our hair mussed. I do say, no more than ten to twenty million killed, tops! Depending on the breaks."

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: I need a stolen Hind to pick up an American Laser.
« Reply #10 on: 03 Jan 2008, 21:49:17 »
You pack it into a ".sqf" or ".sqs" file (my example was in SQF, which is what you should learn and use). The only .sqm file is "mission.sqm" which is what is created by the editor. If you put the script into "deploySmoke.sqf", you'd run it with:
Code: [Select]
nil = [] execVM "deploySmoke.sqf";
(you only need the initial "nil = " if the code is running in editor in object init or trigger activation. This is not required when using execVM in a script itself).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Bennet

  • Members
  • *
Re: I need a stolen Hind to pick up an American Laser.
« Reply #11 on: 04 Jan 2008, 00:08:46 »
Arrggg!!  I have no idea what I'm doing wrong.......  this thing won't work.   :confused:

I've done everything you have instructed me to do via copy and paste.

I'm using ArmA Editor to enter the data and I've saved the file as you instructed: as an SQF file.
Here's what I put into the triggers (I'm quoting one of the two, they're 3 Hinds in this mission, two are AI controlled.):

Condition:

getdammage mi2 >= 0.9

On Activation:

PIL06 sideChat "WE HAVE MAJOR ENGINE FAILURE, WE'RE GOING DOWN!";  nil = [] execVM "deploySmoke.sqf";


Here's what I put into the SQF file:

pil05 = driver m2;

// Wait until the pilot is out of the helo and on the ground or the pilot is dead.
waitUntil { (((vehicle pil05) != m2) and (((getPos pil05) select 2) <= 0)) or (not (alive pil05)) };

// You might want to put a delay in here before the pilot pops the smoke. Not sure what delay would look best.
sleep 4;

if (alive pil05) then
{
    "SmokeShellGreen" createVehicle (getPos pil05);
};

pil07 = driver m3;

// Wait until the pilot is out of the helo and on the ground or the pilot is dead.
waitUntil { (((vehicle pil07) != m3) and (((getPos pil07) select 2) <= 0)) or (not (alive pil07)) };

// You might want to put a delay in here before the pilot pops the smoke. Not sure what delay would look best.
sleep 4;

if (alive pil07) then
{
    "SmokeShellGreen" createVehicle (getPos pil07);
};



Can you see anything I've done wrong?  Is it possible the "sleep" time on the trigger activation?  Is there anything I entered incorrectly?

 
« Last Edit: 04 Jan 2008, 00:19:37 by Bennet »
Bennet

"Mr. President, I'm not saying we won't get our hair mussed. I do say, no more than ten to twenty million killed, tops! Depending on the breaks."

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: I need a stolen Hind to pick up an American Laser.
« Reply #12 on: 04 Jan 2008, 12:31:42 »
Well, first of all that seems a slightly unnecessarily hard way of doing it. Also, if m3 is shot down before m2, then m3 won't pop any smokes until m2 has also gone down, which is probably not the way you wanted it. What I suggest is having one trigger EACH for each Mi-24 (also make sure you've named them right, in the trigger's activation field you wrote mi2, and in the script you've been using m2 (no i)), and then just having the trigger feed the name of the chopper to the script. As such:

Trigger:
Activated by: damage mi2 > 0.9
On activation: mi2 sideChat "WE HAVE MAJOR ENGINE FAILURE, WE'RE GOING DOWN!";  nil = mi2 execVM "deploySmoke.sqf";

Script:

Code: [Select]
_pil = driver _this

// Wait until the pilot is out of the helo and on the ground or the pilot is dead.
waitUntil { (((vehicle _pil) != _this) and (((getPos _pil) select 2) <= 0)) or (not (alive _pil)) };

// You might want to put a delay in here before the pilot pops the smoke. Not sure what delay would look best.
sleep 4;

if (alive _pil) then
{
    "SmokeShellGreen" createVehicle (getPos _pil);
};

Then just create an identical second trigger for the other Mi-24, except you exchange all the mi2 with mi3 or whatever (i.e., the sidechat, the on activation, and the script running).

Should work :)

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Bennet

  • Members
  • *
Re: I need a stolen Hind to pick up an American Laser.
« Reply #13 on: 04 Jan 2008, 22:25:54 »
 :dunno:   ???   :confused:   :weeping:   :scratch:


I have no idea what's wrong now, I've copied and pasted and gone over this again and again.  Sorry for taking up time that could no doubt be spent on scripting that is more complicated......... when the sqf runs I get an in game error message telling me I'm missing the file, something about line 9

I posted the exact in game message at the bottom of this note.

When I replace getdammage mi2 >= 0.9 with your suggested damage mi2 > 0.9 the script won't run at all, I don't even get the radio message.


There are 2 AI hinds; mi3 and mi3; each has a gunner and pilot.  The pilot's names are pil06 and pil07.


Here's what the two triggers have in them :
trigger 1:

Condition: getdammage mi2 >= 0.9

Activation:  pil06 sideChat "WE HAVE MAJOR ENGINE FAILURE, WE'RE GOING DOWN!";  nil = mi2 execVM "mi242.sqf"; 
trigger 2:

Condition: getdammage mi3 >= 0.9

Activation:  pil07 sideChat "WE HAVE MAJOR ENGINE FAILURE, WE'RE GOING DOWN!";  nil = mi3 execVM "mi241.sqf";

sqf file for trigger 1: file name mi242.sqf

pil06 = driver mi2

// Wait until the pilot is out of the helo and on the ground or the pilot is dead.
waitUntil { (((mi2 pil06) != mi2) and (((getPos pil06) select 2) <= 0)) or (not (alive pil06)) };

// You might want to put a delay in here before the pilot pops the smoke. Not sure what delay would look best.
sleep 4;

if (alive pil06) then
{
    "SmokeShellGreen" createVehicle (getPos pil06);
};


sqf file for trigger 2: file name mi241.sqf

pil07 = driver mi3

// Wait until the pilot is out of the helo and on the ground or the pilot is dead.
waitUntil { (((mi3 pil07) != mi3) and (((getPos pil07) select 2) <= 0)) or (not (alive pil07)) };

// You might want to put a delay in here before the pilot pops the smoke. Not sure what delay would look best.
sleep 4;

if (alive pil07) then
{
    "SmokeShellGreen" createVehicle (getPos pil07);
};


Is there anything that sticks out at you?


« Last Edit: 04 Jan 2008, 23:09:02 by Bennet »
Bennet

"Mr. President, I'm not saying we won't get our hair mussed. I do say, no more than ten to twenty million killed, tops! Depending on the breaks."

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: I need a stolen Hind to pick up an American Laser.
« Reply #14 on: 04 Jan 2008, 23:24:55 »
You're misunderstanding some key concepts here. The reason for your error message however lies in this line:

Code: [Select]
waitUntil { [b](((mi3 pil07) != mi3)[/b] and (((getPos pil07) select 2) <= 0)) or (not (alive pil07)) };
More precisely the part that's in bold. That syntax means absolutely nothing to ArmA, which is why it's spazzing out.

If you want it to work, just copy-paste MY code block and follow MY instructions in the post above, and it should by all appearances work. :) However, I'll quickly walk past the errors you're making here:

1)
Code: [Select]
pil06 = driver mi2
This basically REDEFINES the variable pil06 to be the driver of a vehicle named mi2. In this case, since the pilot's name is ALREADY pil06, that line is entirely unnecessary. It won't blow anything up, but it's also really not needed.

2)
Code: [Select]
(((mi3 pil07) != mi3)
What you're trying to do here is probably in normal speak something like "If the pilot of mi3 is no longer in mi3 then...". The correct syntax can be found in both Spooner's and my example:
Code: [Select]
((vehicle pil06) != mi2 This is due to the way the vehicle command works in ArmA: as the description states, if the unit isn't inside a vehicle it will return itself (so: vehicle pil06 == pil06 would work the same way).

3) You are very very unnecessarily using TWO iterations of the same script (mi242.sqf and mi241.sqf). Scripts can be run independently of each other: you can run the same script a thousand times without them necessarily interfering with each other. This is done via using _local variables (shown through the underscore _ in front of the variable name). In my example I used a local variable to allow the running of the same script twice with two different vehicles. Variables are fed to the script by putting them in front of it when running it (if you have more than one thing, you need to put them in an array like this: nil=[dude1, dude2] execVM "Stuff.sqf", otherwise you can just run it directly on dude1 for instance). After that, they can be accessed in the script by using _this.

If you're not getting any of this, I suggest looking at some of these tutorials: [http://www.ofpec.com/ed_depot/index.php?action=details&id=390&page=0&game=ArmA&type=tu&cat=sc]Cheetah's intro to .sqf scripting[/url], Johan Gustafsson's introduction to scripting (for OFP, but still completely applicable in ArmA). Also, please learn to consult the COMREF as your holy bible, it WILL tell you what works and what does not work.

If you're not too interested in learning how to make things work, just look over my post again, and closely follow my instructions. Copy-paste the script. You will only need one script for both birds, and you don't need to name the pilots either. :)

I do suggest you read up a bit on scripting beforehand, acquaint yourself with the COMREF, and read a tutorial or two. The ArmA-specific tutorials are in short demand, but feel free to browse the ones for OFP: they're almost all still entirely applicable. :)

Good luck!

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"