Home   Help Search Login Register  

Author Topic: Chopper Off Map...  (Read 1879 times)

0 Members and 1 Guest are viewing this topic.

Offline Shadow.D. ^BOB^

  • Members
  • *
Chopper Off Map...
« on: 04 Apr 2008, 14:44:04 »
Hey i'm doing a mission on Porto at the moment, as its a small island there is only a small garrison.  The thing is i want to be able to call in choppers when the alarm is raised.

At the moment i have the following.

Code: [Select]
_reinh = "Mi17_MG" createvehicle getpos rein1
"SoldierEPilot" createunit [getpos rein2, air1, "hp1 = this", 1, "CAPTAIN"]
"SoldierEPilot" createunit [getpos rein2, air1, "hp2 = this", 1, "LIEUTENANT"]
~1
hp1 moveindriver _reinh
hp2 moveingunner _reinh
~1
hp1 domove getpos rein3
~1
hp1 domove getpos rein4
~1
exit

This creates the chopper fine if on land, it takes off and goes about its business.  Thing is i want it to start out at sea, so my question is how do i start it flying?

Also could i have the chopper cycling between the 2 domove positions? like its patolling.

Cheers for any help.
« Last Edit: 04 Apr 2008, 14:46:37 by Shadow.D. ^BOB^ »

Offline Rommel92

  • Members
  • *
Re: Chopper Off Map...
« Reply #1 on: 04 Apr 2008, 15:17:36 »
Code: [Select]
hp1 domove getpos rein3
~1
hp1 domove getpos rein4
~1
exit
Also could i have the chopper cycling between the 2 domove positions? like its patolling.

Seeing as its a .SQS, you could easily just change that to
Code: [Select]
#loop
hp1 doMove getpos rein3;
@(hp1 distance rein4 < 150)
~1
hp1 domove getpos rein4
goto "loop"

And regaarding the out at sea question, perhaps create a script (advise you learn SQF, its... like the in thing atm. haha  :P) that sets the helicopter up high or give it a high upward velocity at the time of creation so it has enough time to start up.

Offline Shadow.D. ^BOB^

  • Members
  • *
Re: Chopper Off Map...
« Reply #2 on: 04 Apr 2008, 15:23:20 »
Yeah i might take a bash at sqf, thing is i'm more an idea man :)

But cheers for that.

Offline Loyalguard

  • Former Staff
  • ****
Re: Chopper Off Map...
« Reply #3 on: 04 Apr 2008, 18:52:17 »
To have the helo start at sea (or anywhere) and already flying use the createVehicle array command (different from createVehicle).  This allows you to set more parameters when you create the vehicle including "special" such as "NONE", "FLY" and "FORM".  So, try this instead of your current createVehicle line (this is SQF):

(Untested)

Code: [Select]
_reinh = createVehicle ["Mi17_MG", (getpos rein1), [], 0, "FLY"];

Give it a shot.

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Chopper Off Map...
« Reply #4 on: 04 Apr 2008, 19:28:40 »
Indeed, Loyalguards way does work (i use it on my actual script too) but if you create more than one chopper at a time at the same place, change the command to this:
Code: [Select]
_reinh = createVehicle ["Mi17_MG", (getpos rein1), [], 100, "FLY"];
If you leave it on "0", all choppers are created at the same place (exactly) and you may imagine that this isn't good. Setting it to "100" gives some randomness at creation point so they wont be exactly at the same spot but around 100 meters of it.

If you create planes, this effect is less of matter since they immediately leave the starting point.

Offline Shadow.D. ^BOB^

  • Members
  • *
Re: Chopper Off Map...
« Reply #5 on: 04 Apr 2008, 19:50:55 »
Cheers guys lotsa help, got things to work on there own  ???

As the chopper spawn thing is sqf.  How would i do the rest of the script i.e unit creation  waypoints, in sqf?

Sorry about the newbishness to scripting :)

Offline Rommel92

  • Members
  • *
Re: Chopper Off Map...
« Reply #6 on: 05 Apr 2008, 00:58:05 »
Code: [Select]
private ["_reinH"];

_reinh = createVehicle ["Mi17_MG", (getpos rein1), [], 100, "FLY"];

hp1 moveindriver _reinh;
hp2 moveingunner _reinh;

While {alive hp1} do
{
hp1 doMove getpos rein3;
waitUntil {hp1 distance rein3 < 150}
sleep 2.0;
hp1 domove getpos rein4;
};

That should work...
« Last Edit: 05 Apr 2008, 23:11:28 by rommel92 »

Offline Shadow.D. ^BOB^

  • Members
  • *
Re: Chopper Off Map...
« Reply #7 on: 05 Apr 2008, 21:02:37 »
Kind of works rommel, creates heli fine, unit move into it fine, then i get a generic error about the "sleep" in the script then the chopper goes straight to rein4 and waits.

Offline Rommel92

  • Members
  • *
Re: Chopper Off Map...
« Reply #8 on: 05 Apr 2008, 23:12:33 »
Not sure why, have had that happen before, try it with the private statement at the top, might help, otherwise I have no idea... make sure you execute it as execVM "script.sqf" (script.sqf = ur scriptname.sqf);
« Last Edit: 06 Apr 2008, 15:31:43 by h- »

Offline Shadow.D. ^BOB^

  • Members
  • *
Re: Chopper Off Map...
« Reply #9 on: 06 Apr 2008, 00:55:49 »
Hmm still throwing up an error for the
Code: [Select]
While {alive hp1} do
{
hp1 doMove getpos rein3;
waitUntil {hp1 distance rein3 < 150}
sleep 2.0;
hp1 domove getpos rein4;
};

part of the script.   Sorry about this m8, didnt expect it to be such a pain.

Just to make sure, what should i be using to start the script in the trigger?

at the moment its
Code: [Select]
nil=[this] execVM "rein.sqf"
Cheers for all your help Rommel.