Home   Help Search Login Register  

Author Topic: Eject (again)  (Read 1250 times)

0 Members and 1 Guest are viewing this topic.

Offline Carl Gustaffa

  • Members
  • *
  • I'm a llama!
Eject (again)
« on: 11 Dec 2005, 00:49:24 »
As a complete newbie to OFP scripting, I obviously have some problems, even reading and understanding the existing scripts.

What I'm trying to setup is the following:
Three choppers who flyes to a given waypoint where each ejects a separate group and moves on to their next waypoint and dissappears. The groups of men (named MyGrp01 etc) are moved into their respective chopper by the following snippet attached to the group leader:

Code: [Select]
mygrp02 = group this; "_x moveincargo chop02" foreach units mygrp02
Does this moveincargo command also _assign_ them to the chopper?

Anyways, the various scripts I have tried, including many (to me rather cryptic) ways of unassigning the units from the chopper, the chopper still lands and the units get back in. If I take leader position, all is fine though and I have control of my men, but the two other flanking teams always leave me stranded behind.

I would like to make this work regardless of my position.

The eject waypoint (type MOVE) has the following snippet in the "On Activation" field (correct one?):

Code: [Select]
aP globalchat "Green light. Everyone out!"; [mygrp02,chop02] exec "groupeject.sqs"; [mygrp02] allowgetIn false
Not using [mygrp02] caused the copilot to get out :D And the globalchat stuff, whatever it is, doesn't work anymore.

The actual script goes like this:
Code: [Select]
; Get the script arguments from the _this variable
_grp = _this select 0
_vehicle = _this select 1

_aunits = units _grp
_i = 0
_j = count _aunits

#Here
(_aunits select _i) action ["EJECT",_vehicle]

; my humble attempt on unassigning
unassignvehicle (_aunits select _i)
{unassignvehicle _x} foreach units mygrp02
(_aunits select _i) ordergetin false
; my humble attempt ends here

_i=_i+1
~1
?_j>_i:goto "Here"

exit

Can anyone help me make this work?

Then lastly, just a couple of generic questions, since I'm just learning this stuff:

1. Under the #Here function above, can you do the stuff I'm doing, such as trying out multiple methods of unassigning within the same function, or is commenting out good practice? Can it cause havoc by doing this?

2. In such cases, can you make the script generic to whatever is calling it, or should you have one script per group of men? Any preferable method of thinking?

3. Any special considerations I need to have in mind if I want to make it work under a multiplayer game? I like to test in singleplayer for obvious reasons.

Offline Pilot

  • Contributing Member
  • **
Re:Eject (again)
« Reply #1 on: 11 Dec 2005, 02:59:45 »
Quote
Does this moveincargo command also _assign_ them to the chopper?
As far as I know, yes.

As for the script, comment out the following lines:
{unassignvehicle _x} foreach units mygrp02
(_aunits select _i) ordergetin false

That seems like overkill to me. :P

Quote
1. Under the #Here function above, can you do the stuff I'm doing, such as trying out multiple methods of unassigning within the same function, or is commenting out good practice? Can it cause havoc by doing this?
...wait, I've already answered this.  Moving on...

Quote
2. In such cases, can you make the script generic to whatever is calling it, or should you have one script per group of men? Any preferable method of thinking?
It is better to keep the script generic.  That way if you have to change it in the future, it's a simple matter of changing a few variables.

Quote
3. Any special considerations I need to have in mind if I want to make it work under a multiplayer game? I like to test in singleplayer for obvious reasons.
Yes, there are, however, I don't know them. ::)  I'm an SP guy.

I really don't see anything actually wrong with the script...besides the overkill with unassignvehicle, of course.

Eliminate this from the On Activation line:
[mygrp02] allowgetIn false

allowgetin sort of locks all vehicles to the AI.  It really has nothing to do with unassigning a vehicle.

Quote
And the globalchat stuff, whatever it is, doesn't work anymore.
Did it ever work?

I could be missing something pretty basic, but I don't see it (might have something to do with how tired I am ::)).  Just remove those unnecessary lines I mentioned and we'll go from there.

-Pilot

EDIT:
Where are my manners?

Welcome to the Forums! :wave:
« Last Edit: 11 Dec 2005, 03:01:49 by Pilot »

Offline Carl Gustaffa

  • Members
  • *
  • I'm a llama!
Re:Eject (again)
« Reply #2 on: 11 Dec 2005, 05:30:28 »
Okay, thanks for the answers. I've now tried your suggestions, removing (I know, I was just trying stuff :)) those overkills, and generally simplyfying things a little, but I'm not getting anywhere. As leader, everything is grand, the choppers move off as planned. With AI leader, we're mounting the chopper again. Setting the waypoint to GET OUT (MOVE is my normal try), we were ordered back into the chopper, and the pilots ran scared into the woods, kinda cute :D

Group leader init (not part of chopper which is ungrouped):
Code: [Select]
mygrp02 = group this; "_x moveincargo chop02" foreach units mygrp02
The waypoint, MOVE type:
Code: [Select]
[mygrp02,chop02] exec "groupeject.sqs"
And the script, simplified as suggested:
Code: [Select]
; Get the script arguments from the _this variable
_grp = _this select 0
_vehicle = _this select 1

_aunits = units _grp
_i = 0
_j = count _aunits

#Here
(_aunits select _i) action ["EJECT",_vehicle]
unassignvehicle (_aunits select _i)

_i=_i+1
~1
?_j>_i:goto "Here"

exit

Only if I shoot down our heli myself, will the AI group leader start performing his own waypoints. Otherwise, we mount the chopper and continues the heli waypoints.

Again, I'm completely new to this, so I have no idea as to why the EJECT line has Parameter-Operator syntax, and the unassign line has Operator (/Command)-Parameter syntax. Is this really correct?

The chopper is UH60 (Captain) and the guys Desert Rangers  (with a luitenant team leader, but I also tried lower thn chopper) if it should matter. Waypoints set flyInHeight for the choppers. There are no triggers or synchronizations setup, just messing around here.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Eject (again)
« Reply #3 on: 11 Dec 2005, 13:24:17 »
Welcome, Carl Gustaffa!   :wave:

Quote
Does this moveincargo command also _assign_ them to the chopper?
 
As far as I know, yes.


No, it does not.   (Pilot is almost always right, but not this time...)   It's not always necessary, but in general you should have an assign command as well as a movein command:-

mygrp02 = group this; "_x moveincargo chop02" foreach units mygrp02; "_x assignAsCargo chop02" foreach units mygrp02

Your unassigning doesn't work becauase they are not assigned in the first place.   However Pilot is right that ordergetin is overkill:  you don't need that.    Ordergetin is for when a loon remains assigned to a vehicle but you want him to get out/in.

You can put anything you like under a #label.   Commenting is considered good practice.

Read snYpir's OFPEC Guide on making MP missions (in the Editors Depot.)    I don't know much about it but the critical thing is that scripts are local.

It shouldn't make any difference what the units are, but some addons are faulty and don't work as they should.   There are a couple of aircraft which are notorious for not doing what they should.    When a script doesn't work, its good practice to try it with BIS units, just in case.

The order of parameter and operator in OFP script commands is totally random.   Don't worry about it - just check the syntax in the comref every time, it's the only way.  

Your script now looks ok to me, not that I'm a great scripter.   The assign command in the init line should do the trick.
Plenty of reviewed ArmA missions for you to play

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Eject (again)
« Reply #4 on: 11 Dec 2005, 13:50:33 »
On the question of assigning units to vehicles.  If the moveIn command is put in the init line of one of the units, for example by putting the following in the units Init field of any one of the units in the group:

{_x moveInCargo chop02} forEach units group this

Then to assign each unit go the the 'Special' field of the unit screen and select 'In Cargo'

Then all units of the group will start the mission nicely in chop02 as cargo

Offline Pilot

  • Contributing Member
  • **
Re:Eject (again)
« Reply #5 on: 12 Dec 2005, 01:08:52 »
Quote
Does this moveincargo command also _assign_ them to the chopper?

As far as I know, yes.
No, it does not.  (Pilot is almost always right, but not this time...)  It's not always necessary,
Huh, learned yet another thing new.  I have never had to use the assign command so I assumed it wasn't necessary.  I should know by now never to make assumptions...

@Carl Gustaffa
I just set up a test on desert island with BIS units to test the paradrop script.  I have set up everything as you have described it in your above post.  Everything works fine for me.  The units paradrop and the chopper flies on. ???

-Pilot

Offline Flauta

  • Members
  • *
  • There is no knownledge, that is no power
    • Chek mi FLog
Re:Eject (again)
« Reply #6 on: 12 Dec 2005, 17:17:26 »
In my experience, is better to make a Trigger crossing the Chopper's way than exec the script on a waypoint "on activation" 's field..  the waypoint is activated after the Chopper arrives... but its just my way ;)

If you want to make the chopper "DISSAPEAR", make a trigger and set it like these

Condition:       Chopper distance player > 1000 (or more)
On activation: deleteVehicle Chopper

.. one thing more.. if you use Radiochat or groupchat or even     titleText ["bla", "PLAIN DOWN"] instead of globalchat.. maybe will look better ;)

and
WELCOME TO THE FORUMS:wave:

Offline Carl Gustaffa

  • Members
  • *
  • I'm a llama!
Re:Eject (again)
« Reply #7 on: 14 Dec 2005, 22:41:46 »
Hi

And thanks for the loads of (needed) help. Much has been learned. I did manage to get it to work, at last (for a while now actually, just been kinda busy). I can only blame myself. It probably worked all time from the start. Next time I'll also check the _path_ of the file, not only the filename!  ::)

I think that's a first, anywhere, anygame, anytime :P