Jump to content
Sign in to follow this  
Hindhunter

Need help with paratroops

Recommended Posts

Please don´t roll me in tar and feathers for this, I know this has been on the wall some times now but just help me out here ok?

This is the deal, I want a squad of Black Ops to parachute from a Helo at a certain waypoint but it doesn´t work!!

This is how I tried to do it.

I assigned variable names to each of them since I couldn´t use an array in conjunction with the command "action" and ["str_action_eject"], at the desired waypoint in the "On activation" field I wrote:

On Activation: unassignvehicle Ghost_1; Ghost_1 action ["STR_ACTION_EJECT"]

Nothing happens! The chopper just hovers there and no jumping! If I skip the "action" string and only use "unassign", the chopper goes down and drops the black ops. What am I doing wrong here?

Share this post


Link to post
Share on other sites

First you'll have to create an infantry group, either by using the group tool (F2) or by placing your units and using the group tool to group them. Once you have created your group, give the leader a name in the Name field.  You will also have to give the group a group name so it can be identified later on. To do this go into the group leader's properties and in the Initialization field type:

grp = group this

Where it says grp, you can place the name of your choice.

 

* Creating the helicopter to use for the transportation

To create the helicopter you will need to press F1 first, to select the Units tool. Then double-click somewhere on the map, which will open up the Units window. In the Side drop down menu, choose West, since we will be using a NATO UH60-MG helicopter. After this select Air from the Class drop down menu. Next we'll go to the Units drop down menu and select the UH60-MG. You also need give the helicopter a name.  Use helo1.

You have now created a UH60-MG named helo1.

 

* Commanding the infantry group to start out in the UH60-MG

The easiest way to command the infantry squad to board the UH60-MG is to type the command for it in their Initialization field:

this moveincargo helo1

helo1 is the name of the designated vehicle, the UH60-MG in this case.

Note: since the squad's leader already has a command in his Init, you will have to use a special sign (wink.gif and a space to add a second independent command. The command line now runs like this:

grp = group this; this moveincargo helo1

Next, create a script file (.sqs) which will order the units to eject. To do this, you must first create a Wordpad file with any name, ending with the file extension .sqs.  

Put the following in the text file:

_aunits = units L1

_i = 0

_Max = count _aunits

#Here

(_aunits select _i) action ["EJECT",helo1]

unassignvehicle (_aunits select _i)

_i=_i+1

~1

?_Max>_i:goto "Here"

exit

--

Now create the necessary waypoints for the UH60-MG, and execute the script file:

First you need to click on the UH60-MG and hit F4 to select the Waypoint tool. Next double click somewhere on the map where you want your first WP to be. I will use 3 waypoints;

1) telling the UH60-MG to move to a spot and fly a bit higher

2) one to move to a spot and execute the script file you made and a third WP that will tell the UH60-MG to move away from the area.

Once you have created your first WP, double click somewhere else on the map where you want your units to start their paratrooping. In this WP's properties, make the WP Type Move. Now in the second WP's properties, in the On Activation field, type this:

player exec "script_name.sqs"

This will make the player unit execute the script we created earlier.  You can use any unit name here, but using player here is the best option since he is the last one to die (the script will be of no use to you when you are dead). Where it says script_name.sqs, you can put the name of the script you made.

Note: The minimum height for a parachute operation is around 75-80 meter, but there is a great risk of injury when you perform a jump that low. So try sticking around 110-125 meters high. To command the helicopter to fly higher than its standard flight height, type this in its Initialization field, or a WP's On Activation field (we chose to put in the first WP).

helo1 flyinheight 120

Where it says helo1 you can put the name of your helicopter. And where it says 120, put the height (in meters) you want the helicopter to fly at.

That's it, you have now created your very first helicopter parachute jump!

This is exceprted from a tutorial written by:

Yermom (Ryan Long), Sith (Bart van Paassen) and D'n'A (Joris-Jan van 't Land)

Thanks guys!!  Good luck HindHunter.

Share this post


Link to post
Share on other sites

Since I know many people are nervous when it comes to scripts, and no offense cantata it was a good one, I'll offer an alternative solution that does not utilize a script. Just click my link below and download the tutorial I made that deals with this if you want to. It also compares the method of ejecting men all at once with an array versus one at a time with waypoints.

Share this post


Link to post
Share on other sites

can anyone post documentation for the script posted above so we can all see exactly what is happening there?

Share this post


Link to post
Share on other sites

Ok, thanks for all the suggestions, just for you to know, I´m not a total stranger to OFP editing and scripting since I´ve made a few missions myself but it´s just this Parachute thingy that won´t work.

I´ve tested some variants myself that doesn´t work but if I write them here perhaps you could point out the wrong coding for me?

Example1: soldiername action ["eject", Blackhawk]; unassignvehicle soldiername - doesn´t work!

Example2: soldiername action ["str_action_eject"]: unassignvehicle soldiername - doesn´t work!

I´m not just interested in making it work, I also want to know WHy it works =)

Share this post


Link to post
Share on other sites

Oh, without using a script, I forgot to mention that, without the need of a script of course. =)

Share this post


Link to post
Share on other sites

example 1 should work as long as the soldier is named soldiername and the helicopter is named blackhawk. If that is not working for you and you are absolutely sure that everything is spelled correctly and all the names are right, this is some strange phenomena.

Share this post


Link to post
Share on other sites

Definition of the script file:

This script may look difficult, but it really isn't that hard to understand. You'll only have to edit 2 words if you copy/paste:

_aunits = units L1

In this line, where it has the L1 you put in the name of the infantry squad's leader. This line will create an array (some sort of table) with all the unit ID numbers of the squad's members in it (the mission automatically gives all units such a number. You can locate it in the mission.sqm file if you wish). This array will be used later on.

(_aunits select _i) action ["EJECT",helo1]

In this line, all you have to edit is the word helo1. Instead of that you can put the name of the helicopter name you used. This command line will first select a unit ID# from the array _aunits and then order this unit to eject the helicopter. The value of _i will increment by 1 every time the script has given its orders to a unit.

For those of you who would like to fully understand the rest of the lines too, check the below definitions:

_i = 0 -- This will set the local variable (local variables are only used in the script itself and not any other part of the mission) _i to 0, which is its initial value.

_Max = count _aunits -- This will count the amount of unit ID#s in the array _aunits. This is done because the script then knows how many units there are in the squad and thus how many times it will have to loop the eject command. It will give the amount the variable name _Max.

#Here -- This creates a 'marker' in the script which can be referred to using the goto command. For those of you familiar with web design, it's like a named anchor.

unassignvehicle (_aunits select _i) -- This unassigns the unit from the vehicle, meaning the helicopter can be used by other soldiers again. While a vehicle is assigned to a unit, no one else can use it.

_i=_i+1 -- This increases the value of _i by 1 everytime the script passes this point (performs a loop)

~1 -- Like we explained before, this command will delay the script for 1 second before carrying on.

?_Max>_i:goto "Here" -- This will make the script go back to the #Here marker as long as the script has not ordered all units to eject yet (thus as long as _Max is not bigger than the amount of units in the squad _i)

exit -- This will exit the script.

(Edited by Cantata at 12:58 pm on Dec. 19, 2001)

Share this post


Link to post
Share on other sites

d*amn! I´m afraid you´re right about that, after all, OFP isn´t exactly the most edit-friendly and stable game today. I´ll try some of the other hints, I won´t give up on this now!

Share this post


Link to post
Share on other sites

Thanks Cantata, it´s so much easier to understand now. smile.gif But there MUST be an easier way dont´you think?

Share this post


Link to post
Share on other sites

To be honest, no.  I have been fooling around with the editor for quite some time now, and after much headache and frustration, I find that scripts do what you want, when you want, how you want.  I can't get half the stuff to work using the editor, but it works every time using a script.

Ultimately, I think the editor was added after the scripting.  It was designed to be accessible and easy to use, but the implementation needs some polish.  Everything you do in the editor is actually turned into a script when you save your work.  Look into any .SQM file and you'll see what I mean.

Perhaps the thing to do is to make your mission as close to what you want as you can get it with the editor, and then go back and tweak the .SQM file to fix bugs or things that aren't working.  It could take some time to get comfortable with scripting, but it would be time well spent, IMHO.

As a last resort, you could find one of the script gurus out there, make friends, and get them to help you with your scripting needs.  :-)

The commands work great, but it would seeme the editor just doesn't get the translation from editor to script exactly right.  That or I need way more practice, heh heh.

Share this post


Link to post
Share on other sites

Well if an external script is what´s needed to make it work, then I´ll make a script, no big deal. I´ve done a few simple scripts so this shouldn´t be that hard, besides there are examples to check with.

Share this post


Link to post
Share on other sites

It was explained to me yesterday that if you want things to work the way you want in OFP you´d better write the code in an external script. Well, It´s true because last night I finally made my first really good parachuting script and a very short one at that and with little input in the editor. smile.gif

I created a CH47 Chinook (not empty) with the name: Helo1

Then I made a 4 man strong squad of BlackOps XMS soldiers named pt1 pt2 pt3 pt4 and so forth.

I made a few waypoints for the chopper to follow to and between the two with the most space between them I put a trigger grouped with the chopper. In the triggers activation field I wrote: this exec "eject.sqs" to start my script.

Script executes as follows: (remarks marked ";")

;Pelle´s Prachuting script 2001-12-20

;CH47 assumes drop altitude

Helo1 flyinheight 200

;10 sec delay lets Helo1 assume correct altitude prior to drop

~10

;Limited speed to avoid unnecessary dispersion of troops

Helo1 setspeed "limited"

;Leader leaves CH47 by parachute

pt1 action ["eject",Helo1]; unassignvehicle pt1

;1,5 sec between jumps to avoid collisions, looks better too smile.gif

~1.5

pt2 action ["eject",Helo1]; unassignvehicle pt2

~1.5

pt3 action ["eject",Helo1]; unassignvehicle pt3

~1.5

pt4 action ["eject",Helo1]; unassignvehicle pt4

;Ch47 continues 5 sec before creaming up the torque (can´t risk to cause turbulence for those paratroopers wink.gif)

~5

;Last 2 lines: CH47 pulls out of area at top speed and below radar

Helo1 setspeed "full"

Helo1 flyinheight 20

; The END

exit

This script I wrote to fit my own purposes and I managed pretty much with my own imagination but it wouldn´t have been possible without the guidance of all of you. Thanks a lot!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×