Home   Help Search Login Register  

Author Topic: Who is the dam co-pilot :P  (Read 1882 times)

0 Members and 1 Guest are viewing this topic.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Who is the dam co-pilot :P
« on: 17 Sep 2006, 01:00:33 »
Hi

I know you can find out the driver, the gunner and all the cargo units in a vehicle. But...

.. How would I find out a cessna's co-pilot? Is there a way you can find out the unit in the co-pilot 'cargo' position?

Thanks for your help.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Who is the dam co-pilot :P
« Reply #1 on: 17 Sep 2006, 01:09:31 »
Just an idea: create 4 logics and try to move one in the driver and 3 in the Cessna cargo positions to fill it up any empty position in the plane, then get the crew of the cessna and check for the type of (typeOf) second member of the array. If it is a logic, then no co-pilot is present.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Who is the dam co-pilot :P
« Reply #2 on: 17 Sep 2006, 01:13:06 »
Hi

Thanks for your reply.. This would tell me if a co-pilot is present. But I need to be able to use this unit in a script.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re: Who is the dam co-pilot :P
« Reply #3 on: 17 Sep 2006, 01:23:00 »
Experiment with the array of units in cargo that you get.   It may be that position in the array is associated with seats on the plane.

Vehicles fill up in order: the first unit to get in always gets the same seat and so on.    In other words if you know the order in which the loons borded, you know where they are sitting.
Plenty of reviewed ArmA missions for you to play

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Who is the dam co-pilot :P
« Reply #4 on: 17 Sep 2006, 01:25:45 »
Hmmm I give it a go. Co-pilot seat is first cargo seat to be taken.

I might not do it until tommorow though.

Thanks for your help :)

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Who is the dam co-pilot :P
« Reply #5 on: 17 Sep 2006, 03:10:34 »
The proposal using logics is to be sure all the crew positions are used before using "crew" to get the crew members. The second element of the array returned by crew "should" be the co-pilot. If it is one of the logics, then no copilot is present, else it is the co-pilot.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Who is the dam co-pilot :P
« Reply #6 on: 17 Sep 2006, 03:20:13 »
Hmmm how about adding logics.. logic1 logic2 etc.. then since logic1 could be 1st to get in i could remove and i would have 1 seat for co-pilot. The problem comes if someone already in as co-pilot before the logic.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Who is the dam co-pilot :P
« Reply #7 on: 17 Sep 2006, 08:30:18 »
This is just what adding the logic solves, if there is someone already where you add the logic, the logic will not be moved into the plane. So, at the end, you have the plane filled up with its original crew (if any) and logics (if the original crew didn't use all the plane positions). This is just to make sure that asking for the crew array will return all the positions with units (logics or persons), then you only need to check for the second position of the array (probably it will be the first cargo unit, the co-pilot).

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Who is the dam co-pilot :P
« Reply #8 on: 17 Sep 2006, 12:08:27 »
Oh... i see. So add a script to get the crew. and then add logics to all the empty positions. This will make an array (in order of where you get in the cargo) and so the 1st crew unit in the array = co-pilot?

I think I understand now :P

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Who is the dam co-pilot :P
« Reply #9 on: 17 Sep 2006, 12:14:28 »
LOL, nop. When the plane is "full", the first member of the crew array should be the pilot, the second one should be the first cargo unit (a logic or a person), this one should be the co-pilot.

So, before checking for the copilot:
1 - Make sure the plane is full, try to add 4 logics (pilot and 3 cargo positions). These logics will use any still-free slots in the plane.
2 - Get the crew array with "crew" command and check for the second member of the array, if it is a logic, there is no co-pilot, if not, then you got the copilot.

All the above is based on the theory that once a vehicle is full, crew command will return the array ordered by driver, gunner (not present in cessna) and the ordered used positions of the vehicle cargo.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Who is the dam co-pilot :P
« Reply #10 on: 17 Sep 2006, 12:33:28 »
Not tested, but you may try this:

Code: [Select]
;Copilotcheck.sqs
;Usage:
;[plane]exec"copilotcheck.sqs"

_plane = _this select 0
_lg1 = "logic" createVehicle [0,0,0]
_lg2 = "logic" createVehicle [0,0,0]
_lg3 = "logic" createVehicle [0,0,0]
_lg4 = "logic" createVehicle [0,0,0]

_lg1 moveInDriver _plane
_lg2 moveInCargo _plane
_lg3 moveInCargo _plane
_lg4 moveInCargo _plane
_copilot = crew _plane select 1
? typeOf _copilot == "logic":hint "Copilot not present"
deleteVehicle _lg1
deleteVehicle _lg2
deleteVehicle _lg3
deleteVehicle _lg4
exit

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Who is the dam co-pilot :P
« Reply #11 on: 17 Sep 2006, 13:17:04 »
Hi
I had a script roughly like that, but I still not sure how to get the 2nd element in the array. Yes I can see it, but how do I say like

_copilot = 2nd element in array

Obviously not like that (if only ofp was that easy :P)

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Who is the dam co-pilot :P
« Reply #12 on: 17 Sep 2006, 13:31:42 »
_copilot = crew _plane select 1

select 0 would return first element in crew array

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Who is the dam co-pilot :P
« Reply #13 on: 17 Sep 2006, 14:12:00 »
OK Thanks for your help :D

I put it together once I finished this work I got to do  :banghead: