OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Shadow.D. ^BOB^ 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.
_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.
-
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
#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.
-
Yeah i might take a bash at sqf, thing is i'm more an idea man :)
But cheers for that.
-
To have the helo start at sea (or anywhere) and already flying use the createVehicle array command (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=c#455) (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)
_reinh = createVehicle ["Mi17_MG", (getpos rein1), [], 0, "FLY"];
Give it a shot.
-
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:
_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.
-
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 :)
-
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...
-
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.
-
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);
-
Hmm still throwing up an error for the
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 nil=[this] execVM "rein.sqf"
Cheers for all your help Rommel.