Home   Help Search Login Register  

Author Topic: Helo lands and loads troops, but.......  (Read 2340 times)

0 Members and 1 Guest are viewing this topic.

Offline Meatball0311

  • Members
  • *
Helo lands and loads troops, but.......
« on: 22 Aug 2007, 14:53:03 »
I am working on making some scripts, that will allow the player to call in helo extracts anywhere on the map, and then while player is in helo can give helo orders to a "drop off" point.  The script I wrote for the helo extract works fine, but the troops load into the helo and the helo will not move to the drop off point.  You can hear the pilot give the order to move to the coordinates, but helo just stays hovering a few meters off of the ground.  I am using a spawned onMapSingleClick as marker.

If anyone of you "Script Writing" Jedi's can lend me some advice, it would greatly be appreciated.  Thanks, here are my scripts.

This is the error I keep getting:
'helo1 move to |$|_mPos'
Error Missing ;


This is the script I am using for Helo Insert (giving me trouble):
Quote
_bird = "helo1"
_mPos = getMarkerPos "Position2"

helo1 move to _mPos

hint "STORK1: Buckle y'all seat belts, were off"
goto "distance"

# distance
_mPos = getMarkerPos "Position2"
? helo1 distance _mPos < 100:hint "STORK1: 1 minute";goto "land"
~1
goto "distance"

#land
_mPos = getMarkerPos "Position2"
helo1 land "GET OUT"
? player distance _mPos > 20:hint "STORK1: Good Hunting...";deleteMarker "Position2";goto "End"

#End
~1
exit




This is the script for Helo Extract (working fine):
Quote
_bird = "helo1"
_mPos = getMarkerPos "Position1"

helo1 doMove _mPos
~1
hint "STORK1: Roger, WILCO."
~0.5
goto "distance"

# distance
_mPos = getMarkerPos "Position1"
? helo1 distance _mPos < 100:hint "STORK1: 1 minute";goto "land"
~1
goto "distance"

#land
_squadleader = getMarkerPos "spt1A_Marker"
helo1 land "GET IN"
? helo1 distance _squadleader < 5:hint "STORK1: Standing by for new coordinates";deleteMarker "Position1";goto "End"
~1
goto "land"

#End

[] exec "insert.sqs"
exit
« Last Edit: 22 Aug 2007, 14:57:24 by Meatball »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Helo lands and loads troops, but.......
« Reply #1 on: 22 Aug 2007, 15:03:03 »
You are going to kick yourself for this one....   :no:

The command is moveTo (one word) not move to. :yes:
urp!

Offline Meatball0311

  • Members
  • *
Re: Helo lands and loads troops, but.......
« Reply #2 on: 22 Aug 2007, 15:53:54 »
Yeah, I hate when that happens.  However, I do not get any errors, but the helo stills just stays hovering the ground.  I have tried doMove, and giving it a addWayPoint.  What do you think could me the problem? :dunno:  For some reason the pilot is giving the order but it it just not responding.  Do you think we have some mutiny amongst the ranks of my troops? :scratch: J/J.  I will keep hackin at it, but if you can get to me first appreciate it.

Edit: I tryed to add a waypoint and I get this error:
'_wp = Stork1 |$|addWaypoint ["Position2", 0]'
Error 0 elements provided, 3 expected
Quote
_bird = "helo1"
_mPos = getMarkerPos "Position2"
_grp = [Stork1]

_wp = Stork1 addWaypoint ["Position2", 0]

helo1 doMove getMarkerPos "Position2"

hint "STORK1: Buckle y'all seat belts, were off";goto "distance"
« Last Edit: 22 Aug 2007, 17:10:56 by Meatball »

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Helo lands and loads troops, but.......
« Reply #3 on: 22 Aug 2007, 19:28:00 »
Try:

Code: [Select]
_bird = helo1
_mPos = getMarkerPos "Position2"
_grp = Stork1

_grp addWaypoint [_mPos, 0]

_bird doMove _mPos

hint "STORK1: Buckle y'all seat belts, were off";goto "distance"


Planck
I know a little about a lot, and a lot about a little.

Offline Meatball0311

  • Members
  • *
Re: Helo lands and loads troops, but.......
« Reply #4 on: 22 Aug 2007, 20:39:09 »
Planck, thanks for the advice.  It did not solve problem, but I am still not getting any errors. :dunno:  Do you think that it may be the onMapSingleClick marker name? 

EDIT: I just tryed moveTo, and put Stork1 into both moveTo and doMove.  Nada
« Last Edit: 22 Aug 2007, 21:09:19 by Meatball »

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Helo lands and loads troops, but.......
« Reply #5 on: 22 Aug 2007, 20:50:35 »
Using just that small bit of script in a mission in the editor.....it did everything it was supposed to do.

The group moved to the waypoint, the chopper took off from its starting position and moved also to the waypoint position.

Everything worked well, for that piece of your script anyway.


Planck
I know a little about a lot, and a lot about a little.

Offline smoke52

  • Members
  • *
Re: Helo lands and loads troops, but.......
« Reply #6 on: 23 Aug 2007, 02:24:19 »
im kinda doing the same thing with a HMMVW. what about this command:

_bird domove (getMarkerPos "position2")

just skip using the _mpos because i had troubles myself using a variable until i used the above command.

edit: didnt notice it was sqf you are using, maybe thats why it wasn't working for mine :P
« Last Edit: 23 Aug 2007, 09:38:55 by smoke52 »

Offline Nixer6

  • Members
  • *
Re: Helo lands and loads troops, but.......
« Reply #7 on: 23 Aug 2007, 04:27:33 »
I dunno why you are adding a waypoint????

Then.... you tell the the helo

Code: [Select]
_bird doMove _mPos
some snippets from a working .sqf I have, it's been run hundreds of times.

Code: [Select]
_heli = somebird;
_heliPilot = somepilot;

_heliPilot assignAsDriver _heli;
_heliPilot moveInDriver _heli;
_heliPilot setbehaviour "Careless";
_heliPilot setdammage 0;
_heli setdammage 0;

_turn1 = getMarkerpos "turn1";
_turn2 = getMarkerpos "turn2";
_warPad = getpos warPad;
_basePad = getpos basePad;

_riders = (units(group _heliPilot));
_riders = _riders -[ _helipilot];

{
_x moveInCargo _heli;
}
foreach _riders;

sleep 1;


_heli flyinheight 10;
_heli setspeedmode "full";
_heliPilot doMove _turn1;
waitUntil {unitReady _heliPilot};

_heli flyinheight 15;

<snip>

_heliPilot doMove _warPad;
waitUntil {((unitReady _heliPilot) && ((getPos _heli select 2) > 4))};
sleep 1;
_heli land "get out";
sleep 1;
waitUntil {((unitReady _heliPilot) && ((getPos _heli select 2) < 1))};

{
unassignvehicle _x;
}
foreach _riders;

_heliPilot groupchat "Heading back to Base! Get Out NOW!";
sleep 2;

{
_x action ["EJECT", _heli];
}
foreach _riders;

I am assigning positions to local variables and it works fine for me. Just another example, might help ya...dunno.

I always have better luck having a seperate _pilot and an empty _heli....FWIW

and FORCING myself to learn .sqf is SLOWLY paying off.
Why do I have to be a Rocket Scientist to make a good mission?

Offline Meatball0311

  • Members
  • *
Re: Helo lands and loads troops, but.......
« Reply #8 on: 23 Aug 2007, 17:13:27 »
Ok, update to my situation of making some helo extract and helo insert scripts.  Basically, what I am wanting is to allow the player to call a helo to any spot on the map, and then bringing him to a position that he tells it to go.  I am using some radio triggers to set up some commands on the radio and a spawn marker to plot the LZ.  I am using the spawn marker scripts that h- has on the forum located at:

http://www.ofpec.com/forum/index.php?topic=29830.0

Now, I am new to script writing so I would like to help out others who are in the same boat and I will post what I got so far.  These are basic scripts and through learning I feel I will be able to elaborate and clean them up more.  I would still like more advice from you script writing jedi's  :D

So far I have achieved getting the helo to come to a designated pos by moving to a spawned marker and landing for helo extract.  I have a trigger set up and set the setTriggerText "Call for helo extract":

Quote
;extractLZ.sqs

onMapSingleClick ""

_Marker = createmarker ["Position1", _this]
_Marker setMarkerType "Destroy"
_Marker setMarkerColor "ColorRed"

hint "STORK1: Roger, WILCO"

_bird = helo1
_mPos = getMarkerPos "Position1"

helo1 doMove _mPos
~1
goto "distance"

#distance
_mPos = getMarkerPos "Position1"
? helo1 distance _mPos < 100:hint "STORK1: Did anyone call for a taxi?";goto "land"
~1
goto "distance"

#land
_squadleader = getMarkerPos "spt1A_Marker"

helo1 land "GET IN"
~1
? helo1 distance _squadleader < 5:hint "STORK1: Welcome aboard Spartan.";deleteMarker "Position1";goto "board"
~1
goto "land"

#board
hint "STORK1: What will be your destination today, SGT."

t2 setTriggerText "Submit Insert Point"
~1
exit


Then I have another trigger setTriggerText "Submit insert point" that will call up the script to allow the player to move to another pos:

Quote
;insertLZ.sqs

onMapSingleClick ""

_Marker = createmarker ["Position1", _this]
_Marker setMarkerType "Destroy"
_Marker setMarkerColor "ColorRed"

_bird = helo1
_mPos = getMarkerPos "Position1"

helo1 doMove _mPos
~1
hint "STORK1: Roger, WILCO."
~0.5
goto "distance"

#distance
_mPos = getMarkerPos "Position1"
? helo1 distance _mPos < 100:hint "STORK1: 30 seconds";goto "land"
~1
goto "distance"

#land
_mPos = getMarkerPos "Position1"
_squadleader = spt1A

helo1 land "GET OUT";deleteMarker "Position1"
? helo1 distance _squadleader > 20:hint "STORK1: Good Huntin.....";goto "End"
~1
goto "land"

#End
_sPos = getMarkerPos "SupportH"

helo1 doMove _sPos
~1
exit



That is what I have for now, next I will be working on a few other things and trying to condense the scripts into one (if possible).  I will update this post when I have more.  Once again, thanks to all!! (If you have any advice please post in here)
« Last Edit: 23 Aug 2007, 18:51:38 by Meatball »

Offline Nixer6

  • Members
  • *
Re: Helo lands and loads troops, but.......
« Reply #9 on: 23 Aug 2007, 20:26:13 »
I really wanted to test this some more before I released it but..... I also have figured out how to streamline it some and hopefully make it more efficient...but limited time to work on it.......Hey it works as is. :cool2:

This is an .sqf conversion of some scripts by Skumball for OFP.

it requires following items placed in the editor:

= A UH60MG Blackhawk
- A pilot named "heliPilot"
- A pilot named "heliGunner"
- An H named "hBase"
- An invisible H named "hMove"
- A marker named "blackhawk" and set to 'empty'
- A trigger with the following properties:
   Activation: Radio Alpha, Repeatedly
   Text: Blackhawk move
   On Activation: OnMapSingleClick "this=[_pos] execVM ""heliMove.sqf"""; heliPilot sideChat "Where to?";
- A trigger with the following properties:
   Activation: Radio Bravo, Repeatedly
   Text: Blackhawk back to base
   On Activation: this=[] execVM "heliBase.sqf";

there are three scripts, sorry I don't have anyplace to upload it or I would. Maybe this way I'll get some input on improvements.  :clap:

init.sqf

Code: [Select]
titleText ["Select radio (0,0,1) and click the map to move the Blackhawk to the location\nSelect radio (0,0,2) to send the Blackhawk back to base","plain"];


if !(alive heliPilot) exitWith
{
onMapSingleClick "";
1 setRadioMsg "null";
2 setRadioMsg "null";
"blackhawk" setMarkerType "empty";

};

if (alive heliPilot) exitWith
{
1 setRadioMsg "Blackhawk Move";
2 setRadioMsg "null";
heliPilot setbehaviour "CARELESS";
helipilot setcombatmode "BLUE";
heliPilot assignAsDriver heli;
heliPilot moveInDriver heli;
heliGunner assignAsGunner heli;
heliGunner action ["GETINGUNNER", heli];
heliGunner setbehaviour "AWARE";
heliGunner setcombatmode "RED";

};

heliMove.sqf

Code: [Select]
if !(alive heliPilot) exitWith
{
onMapSingleClick "";
1 setRadioMsg "null";
2 setRadioMsg "null";
"blackhawk" setMarkerType "empty";
};

_pos = _this select 0;
sleep .005;

"blackhawk" setMarkertype "marker";
"blackhawk" setMarkerPos _pos;
2 setRadioMsg "Blackhawk RTB";

sleep 1;
heliPilot sideChat "Move order received and acknowledged";

heli setfuel 1;
hMove setPos [(_pos select 0),(_pos select 1),0];
heliPilot doMove _pos;

OnMapSingleClick "";
waitUntil {(getPos heli select 2) > 5};
heliPilot sideChat "Blackhawk is enroute to LZ";
if !(alive heliPilot) exitWith
{
onMapSingleClick "";
1 setRadioMsg "null";
2 setRadioMsg "null";
"blackhawk" setMarkerType "empty";
};
waitUntil {(unitReady heliPilot) && (getPos heli select 2) > 10};
heliPilot sideChat "Blackhawk Landing at LZ";

heli land "get in";
if !(alive heliPilot) exitWith
{
onMapSingleClick "";
1 setRadioMsg "null";
2 setRadioMsg "null";
"blackhawk" setMarkerType "empty";
};
waitUntil {(unitReady heliPilot) && (getPos heli select 2) < 1};
heliPilot sideChat "Blackhawk Ready for Orders";
"blackhawk" setMarkertype "empty";

if !(alive heliPilot) exitWith
{
onMapSingleClick "";
1 setRadioMsg "null";
2 setRadioMsg "null";
"blackhawk" setMarkerType "empty";
};

if (unitReady heliPilot) exitWith
{
  1 setRadioMsg "Blackhawk Move";
};

heliBase.sqf

Code: [Select]
if !(alive heliPilot) exitWith
{
onMapSingleClick "";
1 setRadioMsg "null";
2 setRadioMsg "null";
"blackhawk" setMarkerType "empty";
};


onMapSingleClick "";
2 setRadioMsg "null";
"blackhawk" setMarkerType "empty";
heliPilot sideChat "Blackhawk is Returning To Base";

heliPilot doMove (getPos hBase);

if !(alive heliPilot) exitWith
{
onMapSingleClick "";
1 setRadioMsg "null";
2 setRadioMsg "null";
"blackhawk" setMarkerType "empty";
};
waitUntil {(unitReady heliPilot) && (getPos heli select 2) > 10};

heliPilot sideChat "Blackhawk is Landing at Base";
sleep .5;
heli land "land";

waitUntil {(unitReady heliPilot) && (getPos heli select 2) < 1.5};
heliPilot sideChat "Blackhawk is refueling at Base";
1 setRadioMsg "null";

heliPilot setdammage 0;
heliGunner setdammage 0;
heli setdammage 0;
sleep .5;


heliPilot sideChat "Blackhawk ready at Base";

if !(alive heliPilot) exitWith
{
onMapSingleClick "";
1 setRadioMsg "null";
2 setRadioMsg "null";
"blackhawk" setMarkerType "empty";
};

if (alive heliPilot) exitWith
{
1 setRadioMsg "Blackhawk Move";

};

It works for me and for tow others that have tried it.

NOT TESTED IN MP!


Why do I have to be a Rocket Scientist to make a good mission?

Offline Meatball0311

  • Members
  • *
Re: Helo lands and loads troops, but.......
« Reply #10 on: 23 Aug 2007, 21:30:12 »
Thanks Nixer6 for the advice! I am still a baby in the script writing sense, so I havent even dabbled into the sqf. yet.

In my script above there seems I have ran into another road block.  I am NOT getting any error messages, but it seems that when I load a squad into the helo.  The helo once again is just hovering a few meters off of the deck and not proceeding to the designated insert point that I give it.  It is only giving me this problem when I have a squad of troops loaded into the helo, not when it is just me.  I am using a blackhawk with a crew member assignAsCargo (to take up the front navigator seat) so I can keep all of my troops in the cargo area of the helo.  Any suggestions? 


Offline Nixer6

  • Members
  • *
Re: Helo lands and loads troops, but.......
« Reply #11 on: 23 Aug 2007, 22:16:47 »
Ok..I see what you're trying to do...a realism nut. j/k man.  :)

I am using a blackhawk with a crew member assignAsCargo .

that MAY be the culprit cause helos are funny about more than 1 group in cargo.

Ya might try moveInCargo without assigning the crew member...dunno if it'll work or not. I still can't figure out how to man or reload the second minigun...moveInTurret...haven't spent much time on it.

If ya can live with a guy in the front seat, mine makes for a great taxi.  A small "feature"   :P is that you may have problems when being picked up in the Northern mountains...tall trees and mountains.  :no:

Like I said, mine is just a taxi, ya just load yourself and whoever you want in it..and go. If you check it out you might think of something....

Also check out the mando heli thread on this board. He's WAY smarter than I. I haven't really had time to check it out myself...yet.

Good luck.
Why do I have to be a Rocket Scientist to make a good mission?