Home   Help Search Login Register  

Author Topic: Group Chopper, Group Extraction  (Read 1578 times)

0 Members and 1 Guest are viewing this topic.

MANVIN

  • Guest
Group Chopper, Group Extraction
« on: 01 May 2003, 06:27:19 »
Here's a Script I'm working on, and can't quite get it to work.

I have a GROUP of choppers that can be dynamicly called in to extract the strike team that consists of 8 squads. I can get the group of choppers to arrive, and land just fine... but for some reason I can't get the groups to actually GET IN the Helicopters.

Anyone have any Ideas?

CrashnBurn

  • Guest
Re:Group Chopper, Group Extraction
« Reply #1 on: 01 May 2003, 13:58:36 »
Quote
Here's a Script I'm working on, and can't quite get it to work.

uh...where's the script. Kind of hard to help you if we can't see the script to see what's wrong.  ::)

MANVIN

  • Guest
Re:Group Chopper, Group Extraction
« Reply #2 on: 01 May 2003, 19:02:59 »
I didn't post my code because it plain doesn't work, and I think I'm going about the situation the wrong way. But if you REALLY want to see it..

units _infgroup ordergetin true
"_x assignascargo ("_x" foreach units _heligroup)" foreach units _infgroup

Obviously, _infgroup = a group of infantry, and _heligroup = the group of Heli's.

=====
*EDIT*
=====
Okay, maybe I AM going about this the wrong way. ^.^
Is there a way I could use a script to automaticly order units into the next helicopter in a group (assuming the group is made up entirely of helicopters) when the first helicopter is full? That would probably work easier than what I asked before. >.<
« Last Edit: 01 May 2003, 19:22:41 by MANVIN »

Offline Igor Drukov

  • Contributing Member
  • **
  • Conscientious Subjector
Re:Group Chopper, Group Extraction
« Reply #3 on: 01 May 2003, 20:14:01 »
Your script doesn't work because of the tedious syntax of the ordergetin command : [_sol0,_sol1,_sol2,etc.] ordergetin true.
What you need to do is a loop like this :

_i=0
#loop
_number=count units _mygroup
_sol=units _mygroup select _i
_sol assignascargo _mychopper
[_sol] ordergetin true
_i=_i+1
?_i>_number:exit
~1
goto "loop"

This will get your loonies to board that chopper with a one second interval.
Hope this helps.
« Last Edit: 01 May 2003, 20:15:47 by Igor Drukov »

MANVIN

  • Guest
Re:Group Chopper, Group Extraction
« Reply #4 on: 01 May 2003, 21:53:32 »
Thank you Igor, but that didn't quite accomplish what I needed it to do.

Maybe I should rephrase the question, since it's even confusing me. And maybe redefine a few things while I'm at it.

I want to make a script where it orders soldiers to board in the nearest UH60, M113, etc..

That should simplify things, I hope.

Once again, I appologize for being so vague.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Group Chopper, Group Extraction
« Reply #5 on: 01 May 2003, 23:06:21 »
If the choppers are grouped it might be easiest to use waypoints.     Can't remember the exact commands but you can move waypoints around, so you can move them into position as the choppers approach.   You can use switch triggers to make sure that both cargo groups and also choppers are on the right waypoint.
Plenty of reviewed ArmA missions for you to play

Offline Igor Drukov

  • Contributing Member
  • **
  • Conscientious Subjector
Re:Group Chopper, Group Extraction
« Reply #6 on: 01 May 2003, 23:15:47 »
You needn't apologize, MANVIN, really. The problem is much more complicated than what I had understood, and, well, I like that !
I'd say something can be done with the "nearestobject" command, and "addeventhandler", but then variables would depend on the specific number of choppers of some kind you're using, so actually I think more info is needed, here (at least that's the way I see things, hopefully someone might come up with a simpler way).
But I also think that you want to do something complicated, whereas there can be easy work-arounds : if you pre-assign each unit to a chopper, taking the number of cargo into account, the problem looks solved to me, regardless of all the confusion that this might create...
Anyway, my brains are overheating right now... Good luck, then !




Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Group Chopper, Group Extraction
« Reply #7 on: 02 May 2003, 13:41:47 »
try dis scripts

in da start u need 2 make array of all vehicles dey can board call it evacvehs  ;D

Code: [Select]
_group = _this select 0
_leader = leader _group

_i = 0
_dis = 1000
#loop1
_veh = evacvehs select _i
? _leader distance _veh < _dis : _cv = _veh; _dis = (_leader distance _veh)
_i = _i+1
? _i >= (count evacvehs) : goto "loop1"

[_cv] exec "assigned"
"_x assignascarg _cv" foreach units _group
"[_x] ordergetin true" foreach units _group
exit

da sec script is

Code: [Select]
_veh = _this select 0
evacvehs = evacvehs-[_veh]
@ crew _veh > 2
~10
@ crew _veh < 3
evacvehs = evacvehs+[_veh]
exit

shud work

exec it

[groupname] exec "scrptname.sqs"

nd dont forget 2 make array of da units dey can call nd name it evacvehs

:cheers:

LCD OUT
« Last Edit: 02 May 2003, 14:18:58 by LCD »
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

MANVIN

  • Guest
Re:Group Chopper, Group Extraction
« Reply #8 on: 02 May 2003, 13:45:52 »
Thank you for your help! ^.^

I'm trying the NearestObject solution, since it might also solve other problems I'm having...

Here's the actual script line that I'm using. I'll let ya know if it works.

"_x assignascargo nearestobject [getpos _x,"UH60"]" foreach units <infgroup>

Also, I was wondering.. the according to CfgVehicles, I could put APC in there. Does the APC class just mean M113's and BMP's? Or does it include UH60's, etc?

(PS: That script didn't work. It returns: Unknown Operator UH60. I'm assuming that you can't have a " within a foreach command string. ^.^()

PPS: I also experimented with: a assignascargo nearestobject [getpos a,"UH60"], assigning a single unit as 'a', and it had no effect. Both this and the previous script had the [this] ordergetin true command on each unit that was supposed to get into the chopper.
« Last Edit: 02 May 2003, 13:50:15 by MANVIN »

MANVIN

  • Guest
Re:Group Chopper, Group Extraction
« Reply #9 on: 02 May 2003, 13:53:35 »
LCD: I'm assuming I title the second script "assigned.sqs", as per the _cv exec "assigned" command?

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Group Chopper, Group Extraction
« Reply #10 on: 02 May 2003, 13:54:24 »
u can try putin {} instead of " aruond UH60 in case u have 1.75+

or u can put double "" like dat

""UH60"" nd it wil work ;D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Group Chopper, Group Extraction
« Reply #11 on: 02 May 2003, 13:55:07 »
yeah nd u need 2 put da _cv in [] like dat

[_cv] exec "assigned.sqs" ;D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

MANVIN

  • Guest
Re:Group Chopper, Group Extraction
« Reply #12 on: 02 May 2003, 14:13:37 »
LCD: I tried your script, and it returned several error messages right away.

They were minor errors (we all make them), so I just edited the scripts to make them stop returning error messages.
Now the script runs without a hitch... except it's still not assigning the units to the cargo of the helis.. >.<
Here's the Revised Scripts:
board.sqs
Code: [Select]
_group = units _this select 0
_leader = leader _group

_i = 0
_dis = 1000
#loop1
_veh = evacvehs select _i
? _leader distance _veh < _dis : _cv = _veh; _dis = (_leader distance _veh)
_i = _i+1
? _i >= (count evacvehs) : goto "loop1"

[_cv] exec "assign.sqs"
"_x assignascargo _cv" foreach units _group
"[_x] ordergetin true" foreach units _group
exit

and

assign.sqs
Code: [Select]
_veh = _this select 0
evacvehs = evacvehs-[_veh]
@ count crew _veh > 2
~10
@ count crew _veh < 3
evacvehs = evacvehs+[_veh]

NOTE: I assigned the group of choppers to evacvehs via: evacvehs = units group this
NOTE2: I called the script using: a exec "board.sqs"
Where 'a' is a globalvariable of the infantry group I'm trying to get into a chopper.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Group Chopper, Group Extraction
« Reply #13 on: 02 May 2003, 14:18:30 »
make it

[a] exec "scriptname" ;)

nd wen i said group @ da start in

_group = _This select 0 - i meen it

u name group like dat (in init of 1 of da soldiers)

groupname = group this (u can make it a)

nd wen u exec da script

[groupname] exec "scriptname" den da ;leader command wil work :P ;)

LCD OUT

"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

MANVIN

  • Guest
Re:Group Chopper, Group Extraction
« Reply #14 on: 02 May 2003, 14:39:02 »
I made the corrections, as you said..

board.sqs
Code: [Select]
_group = _this select 0
_leader = leader _group

_i = 0
_dis = 1000
#loop1
_veh = evacvehs select _i
? _leader distance _veh < _dis : _cv = _veh; _dis = (_leader distance _veh)
_i = _i+1
? _i >= (count evacvehs) : goto "loop1"

[_cv] exec "assign.sqs"
"_x assignascargo _cv" foreach units _group
"[_x] ordergetin true" foreach units _group
exit

and called it with..

[a] exec "board.sqs"

It didn't return any error messages, but it still didn't work.
This turned out to be a larger problem than I expected.