Home   Help Search Login Register  

Author Topic: Half SOLVED:Group Board Empty Vehicle 1x1  (Read 1616 times)

0 Members and 1 Guest are viewing this topic.

Offline Carroll

  • Members
  • *
  • Mission Designer (MP-"well tryin to capiche"
Half SOLVED:Group Board Empty Vehicle 1x1
« on: 30 Sep 2007, 10:18:44 »
Hello OFPEC, i am trying to run a little script where my group boards a vehicle one x one but it is not working. Was wondering if you guys could have a look at it & see what is (or isn't) working here. I chose the MOVEINCARGO Action as it allows the unit to play the boarding animation instead of instantly warping into the cargo.
 
Many Thanks.

; Board Vehicle
; start as: [A1, Plane1] exec "Board1.sqs" using radio trigger , i as the player am not part of the group and are merely standing nearby watching and calling the script using radio.

_A1 = group (_this select 0)
_Plane1 = _this select 1

_aunits = units _A1

_i = 0
_j = count _aunits

#Loop
(_aunits select _i) action ["MOVEINCARGO",_Plane1]
_i=_i+1
~1
?_j>_i:goto "Loop"


I played around with some other scripts which order a single unit to board this way (with success), but am struggling to get a group to do same with a small delay between each member boarding.
« Last Edit: 01 Oct 2007, 04:53:10 by Carroll »

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Group Board Vehicle
« Reply #1 on: 30 Sep 2007, 10:36:49 »
Hey there!

I don't know about using an action for this, seems a bit dodgy to me. :) How about the old tried and tested assignAsCargo coupled with the ever-fun orderGetIn instead?

Of course, there are faster ways of doing the same thing that you're doing in your script, but I've always been a supporter of suggesting and improving on the method the scripter has chosen, rather than offering "better" alternatives unasked.  ;) Anyway, the only thing you'd need to change in your script then would be to have

Code: [Select]
(_aunits select _i) assignAsCargo _Plane1
and then put something like

Code: [Select]
(_aunits) orderGetin TRUE
After the loop.  :good:

Good luck!

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Carroll

  • Members
  • *
  • Mission Designer (MP-"well tryin to capiche"
Re: Group Board Vehicle
« Reply #2 on: 30 Sep 2007, 10:53:05 »
Thanks for help, i tried your suggestion, but seems Squad Leader is only one getting in. I'll keep trying a few other things and see what happens.   :scratch:

Edit: Sort of solved, but without boarding animations  :(  I assigned a seperate Pilot to each of the empty Vehicles with own waypoints, now i can go paradrop 4 groups on the dropzone & invade North Sahrani, yay. Cheers.

{_x moveInCargo Plane1} ForEach Units A1
~1
{_x moveInCargo Plane2} ForEach Units B1
~1
{_x moveInCargo Plane3} ForEach Units C1
~1
{_x moveInCargo Plane4} ForEach Units D1
~2
_Plane1 = _this select 0
_Plane2 = _this select 1
_Plane3 = _this select 2
_Plane4 = _this select 3

_Plane1 setFuel 1
~1
_Plane2 setFuel 1
~1
_Plane3 setFuel 1
~1
_Plane4 setFuel 1;exit
« Last Edit: 01 Oct 2007, 04:49:44 by Carroll »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Half SOLVED:Group Board Empty Vehicle 1x1
« Reply #3 on: 01 Oct 2007, 15:36:20 »
For me it is not clear what are you trying to do:

a - To have the units of a group boarding a vehicle unit by unit. So the second soldier waits till first one has boarded the vehicle before proceeding himself and so on with the rest of the group.

b - To have several groups boarding a vehicle and you want the groups to board it group by group, so not all the groups try to board it at the same time.

c - To have several groups boarding different vehicles, so first group1 should board vehicle1 and then group2 for vehicle2 and so on.

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Half SOLVED:Group Board Empty Vehicle 1x1
« Reply #4 on: 02 Oct 2007, 01:26:12 »
I didn't found an action named "MOVEINCARGO" but "MOVETOCARGO". There might be the problem in the first script.


Myke out

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Half SOLVED:Group Board Empty Vehicle 1x1
« Reply #5 on: 02 Oct 2007, 04:49:52 »
moveInCargo is a command, moveToCargo is the action.    :cool2:


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

Offline Carroll

  • Members
  • *
  • Mission Designer (MP-"well tryin to capiche"
Re: Half SOLVED:Group Board Empty Vehicle 1x1
« Reply #6 on: 02 Oct 2007, 09:37:19 »
Mandoble - a) & c) correct. I am wanting 4 groups, each group to board one of 4 planes (Group1 into Plane1, Group2 into Plane2, Etc). But, i want each group member to board using the boarding animation one x one (to give the whole senario a more realistic display - instead of just instantly moving to cargo without animation). Similar to a paradrop but in reverse if you get my meaning.

myke13021 & Planck - i must have overlooked the moveToCargo or got it confused with moveInCargo - i'll go back & see if i tried the former while testing it.

basically what i'm tring to do is: build a mission where 4 large groups board 4 empty planes on a runway (using boarding animations). Once they have boarded, Plane engines start, planes take off down runway in close formation, then fly to dropzone & unload their men using paradrop script.

Now the planes im using are empty because they are from an addon i found which is for "East". I realise that i can probably make the planes friendly to "west" but i havn't done this before & opted to just use the planes empty & assign a "west" pilot to fly each plane (each pilot being separate from each group).

Now the logic behind me doing this was because i have built similar missions using helicopters which are not empty, but found that the groups once parachuting, immediately attempted to reboard the helo's once they landed. This is nodoubt due to me not "unassigning" the squads from their assigned helo's correctly after they parachute, but i guess all the above is my way of a "Work Around".

I have built most of my missions in the past using Trigs & WP activations & Init's, with some success. But as my experience is growing & i delve alittle more each day into scripting, & learning "The Language". I am finding that scripting is definitly the way to go if i want first class results consistently.

Anyway back to the point (Sorry for the life story  :blink:)

Where i am up to with this mission is just getting the groups to board their planes using the animations. I started off just using a "getInNearest" waypoint, but found that 9 out of 10 times, one of the group members got stuck on the tarmat jerking about as though he was performing some kind of weird shaky dance, lol. Funny to witness but quite frustrating when the successfully boarded planes are taking off & the loon is still stuck trying to board the plane while his fellow group members are waiting in cargo for him to snap out of it.

Of the planes that take off, all goes to plan & the paradrop is a success. phew. Actually i'm quite proud of where im at with the mission when i use the "moveInCargo" as everything works fine, just wish i could see the boarding animations (without any members getting stuck) to add that added edge of immersion.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Half SOLVED:Group Board Empty Vehicle 1x1
« Reply #7 on: 02 Oct 2007, 12:52:13 »
Untested,  but you might try this:

Code: [Select]
// board.sqf, execute with execVM.

_groups = _this select 0;
_vehicles = _this select 1;
for [{_i = 0},{_i < count _groups},{_i=_i + 1}] do
{
   [_groups select _i, _vehicles select _i] spawn
   {
      _grp = _this select 0;
      _veh = _this select 1;
      _nunits = count units _grp;
      for [{_j = 0},{_j < _nunits},{_j = _j + 1}] do
      {
         _unit = units _grp select _j;
         _unit assignAsCargo _veh;
         [_unit] orderGetIn true;
         Sleep 1;
         waitUntil {(_unit in _veh) || (!alive _unit) || (!canMove _veh) || ((_veh emptyPositions "cargo") == 0)};
      };
   };
}:


To execute:
Code: [Select]
[[grp1,grp2,grp3],[plane1,plane2,plane3]]execVM"board.sqf";