No volar sol

9 Agost 2010
2,608
5
38
Punt de Lagrange
#1
Una de les coses que no m'agrada del Arma es volar com a pilot I sense una tripulació. No es gaire realista.

Jo tinc un script (complexe I no gaire pulit) que vaig fer per arma2, I que canviant la clase de helicopters I tripulants, he adaptat per arma3. una vegada el rotor del helicopter en marxa em permet crear una tripulació amb un "create action" . Pero el script deixa de funcionar despres de un respawn del helicopter.

L'altre dia, en una partida, algú en va comentar la funcio, bis_fnc_spawncrew ho he mirat I sembla prometedor, pero no aconsegueixo fer-la anar.

El tema es el seguent:

Un escenari per la pràctica de pilotatge de helicopters. Com podeu imaginar, hi ha un aparell de cada i hi ha uns quants... La idea es saltar als comandaments de qualsevol d'ells I si em convé, demanar que es generi la tripulació, (Copilot, artillers, cargomaster, etc... )

Requeriments del script:
- Poder demanar tripulació de la aeronau quan vulgui
- ser flexible I poder ser aplicat a qualsevol aeronau (class "air")
- Que funcioni tantes vegades com sigui necessari, encara despres de respawns.
-Que al aterrar, pugui esborrar els tripulants
- en casos de estimbada, a vegades aconsegueixo tornar a base, pero quedan tripulants supervivents del grup del pilot tirats per el mapa, poder borrar-los quan vulgui.

Ideas? voleu que us posi el script aqui I comentem com millorar-ho?
 
9 Agost 2010
2,608
5
38
Punt de Lagrange
#3
Vale, aqui va l'escript

Init.sqf
{if (side _x == civilian && _x isKindOf "Helicopter") then {_x addEventHandler ["GetIn", "if ((_this select 2) == driver (_this select 0)) then {nul = [(_this select 0),(_this select 2)] execVM 'helocrew\crewin.sqf'}"];}} forEach vehicles;
Crewin.sqf
_vehicle = _this select 0;
_driver = _this select 1;
_class = typeOf _vehicle;


if (count crew _vehicle < 2) then {

action1 = _vehicle addaction [("<t color=""#ee6600"">" + ("Demanar Tripulació") +"</t>"), "helocrew\crewmaker.sqf",_class, 1, false,true,"","isEngineOn _target && driver _target == _this"]; //accio unicament quan el motor esta en marxa
hint "Arrancar motor per opcions de tripulació";


} else {

hint "Aquest aparell ja te tripulació. Per despedir-la aterra i para el motor";

//action2 = _vehicle addaction [("<t color=""#ee6600"">" + ("Despedir tripulació") +"</t>"), "helocrew\crewout.sqf",_class, 1, false,true,"","!isEngineOn _target && driver _target == _this"]; //accio unicament quan el motor esta parat

};
Crewmaker.sqf
_vehicle = _this select 0;
_caller = _this select 1;
_id = _this select 2;
_helotype = _this select 3;

player sidechat format["%1", _helotype];

_vehicle removeAction _id;
_spawnpoint = getMarkerPos "pilotspawn";
_grp = createGroup west;


if (_helotype == "B_Heli_Light_01_F") then {

_pilot1 = "B_Helipilot_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [0]];this setskill 1", 1, "Lieutenant"];

hint "Tripulació al aparell";

};

if (_helotype == "B_Heli_Light_01_armed_F") then {

_pilot2 = "B_Helipilot_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [0]];this setskill 1", 1, "Lieutenant"];

hint "Tripulació al aparell";

};

if (_helotype == "B_Heli_Light_01_stripped_F") then {

_pilot3 = "B_Helipilot_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [0]];this setskill 1", 1, "Lieutenant"];

hint "Tripulació al aparell";

};

if (_helotype == "B_Heli_Attack_01_F") then {

_pilot4 = "B_Helipilot_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [0]];this setskill 1", 1, "Lieutenant"];

hint "Tripulació al aparell";

};

if (_helotype == "B_Heli_Transport_01_F") then
{
_pilot5 = "B_Helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle,[0]]; this setskill 1", 1, "Lieutenant"];
_pilot6 = "B_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];
_pilot7 = "B_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [2]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};

if (_helotype == "B_Heli_Transport_01_camo_F") then
{
_pilot8 = "B_Helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle,[0]]; this setskill 1", 1, "Lieutenant"];
_pilot9 = "B_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];
_pilot10 = "B_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [2]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};

if (_helotype == "B_Heli_Transport_03_F") then
{

_pilot11 = "B_Helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle,[0]]; this setskill 1", 1, "Lieutenant"];
_pilot12 = "B_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];
_pilot13 = "B_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [2]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};

if (_helotype == "B_Heli_Transport_03_unarmed_F") then
{
_pilot15 = "B_Helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];

hint "Tripulació al aparell";

};


if (_helotype == "B_Heli_Transport_03_black_F") then
{
_pilot19 = "B_Helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot20 = "B_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];
_pilot21 = "B_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [2]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};

if (_helotype == "B_Heli_Transport_03_unarmed_green_F") then
{
_pilot23 = "B_Helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot24 = "B_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [0]];this setskill 1", 1, "sergeant"];
_pilot25 = "B_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};

if (_helotype == "C_Heli_Light_01_civil_F") then
{
_pilot27 = "C_man_pilot_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [0]];this setskill 1", 1, "Lieutenant"];

hint "Tripulació al aparell";

};

if (_helotype == "I_Heli_Transport_02_F") then {

_pilot28 = "I_helipilot_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [0]];this setskill 1", 1, "Lieutenant"];

hint "Tripulació al aparell";

};

if (_helotype == "I_Heli_light_03_F") then {

_pilot29 = "I_helipilot_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [0]];this setskill 1", 1, "Lieutenant"];

hint "Tripulació al aparell";

};

if (_helotype == "I_Heli_light_03_unarmed_F") then {

_pilot30 = "I_helipilot_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [0]];this setskill 1", 1, "Lieutenant"];

hint "Tripulació al aparell";

};


if (_helotype == "O_Heli_Light_02_F") then {

_pilot31 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [0]];this setskill 1", 1, "Lieutenant"];

hint "Tripulació al aparell";

};

if (_helotype == "O_Heli_Light_02_v2_F") then {

_pilot32 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [0]];this setskill 1", 1, "Lieutenant"];

hint "Tripulació al aparell";

};

if (_helotype == "O_Heli_Light_02_unarmed_F") then {

_pilot33 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [0]];this setskill 1", 1, "Lieutenant"];

hint "Tripulació al aparell";

};

if (_helotype == "O_Heli_Attack_02_F") then {

_pilot34 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [0]];this setskill 1", 1, "Lieutenant"];

hint "Tripulació al aparell";

};

if (_helotype == "O_Heli_Attack_02_black_F") then {

_pilot14 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [0]];this setskill 1", 1, "Lieutenant"];

hint "Tripulació al aparell";

};

if (_helotype == "O_Heli_Transport_04_F") then
{
_pilot18 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot22 = "O_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};

if (_helotype == "O_Heli_Transport_04_ammo_F") then
{
_pilot35 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot36 = "O_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};

if (_helotype == "O_Heli_Transport_04_bench_F") then
{
_pilot37 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot38 = "O_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};

if (_helotype == "O_Heli_Transport_04_box_F") then
{
_pilot39 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot40 = "O_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};


if (_helotype == "O_Heli_Transport_04_covered_F") then
{
_pilot41 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot42 = "O_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};

if (_helotype == "O_Heli_Transport_04_fuel_F") then
{
_pilot42 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot43 = "O_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};

if (_helotype == "O_Heli_Transport_04_medevac_F") then
{
_pilot44 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot45 = "O_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};


if (_helotype == "O_Heli_Transport_04_repair_F") then
{
_pilot46 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot47 = "O_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};


if (_helotype == "O_Heli_Transport_04_repair_F") then
{
_pilot44 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot45 = "O_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};

if (_helotype == "O_Heli_Transport_04_black_F") then
{
_pilot45 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot46 = "O_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};

if (_helotype == "O_Heli_Transport_04_ammo_black_F") then
{
_pilot47 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot48 = "O_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};

if (_helotype == "O_Heli_Transport_04_bench_black_F") then
{
_pilot49 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot50 = "O_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};


if (_helotype == "O_Heli_Transport_04_box_black_F") then
{
_pilot51 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot52 = "O_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};

if (_helotype == "O_Heli_Transport_04_covered_black_F") then
{
_pilot53 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot54 = "O_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};

if (_helotype == "O_Heli_Transport_04_fuel_black_F") then
{
_pilot55 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot56 = "O_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};

if (_helotype == "O_Heli_Transport_04_medevac_black_F") then
{
_pilot57 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot58 = "O_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};


if (_helotype == "O_Heli_Transport_04_repair_black_F") then
{
_pilot59 = "O_helipilot_F" createUnit [_spawnpoint, _grp, "this moveinturret [_vehicle, [0]]; this setskill 1", 1, "Lieutenant"];
_pilot60 = "O_helicrew_F" createUnit [_spawnpoint, _grp, "this assignasgunner _vehicle; this moveinturret [_vehicle, [1]];this setskill 1", 1, "sergeant"];

hint "Tripulació al aparell";

};

{[_x] join player } foreach crew _vehicle;

if (_helotype == "O_Plane_CAS_02_F") exitwith
{
hint "Aquest aparell es un monoplaça i no te opcions de tripulació.";
_vehicle removeAction _id;
};

if (_helotype == "I_Plane_Fighter_03_CAS_F") exitwith
{
hint "Aquest aparell es un monoplaça i no te opcions de tripulació.";
_vehicle removeAction _id;
};
if (_helotype == "I_Plane_Fighter_03_AA_F") exitwith
{
hint "Aquest aparell es un monoplaça i no te opcions de tripulació.";
_vehicle removeAction _id;
};
if (_helotype == "B_Plane_CAS_01_F") exitwith
{
hint "Aquest aparell es un monoplaça i no te opcions de tripulació.";
_vehicle removeAction _id;
};

_vehicle removeAction _id;
sleep 5;
hint "Per despedir la tripulació, aterra i para el motor per accedir a la opció en el menu de acció.";

action2 = _vehicle addaction [("<t color=""#ee6600"">" + ("Dismiss Crew") +"</t>"), "helocrew\crewout.sqf",_class, 1, false,true,"","!isEngineOn _target && driver _target == _this"];
Crewout.sqf
_vehicle = _this select 0;
_driver = _this select 1;
_action2 = _this select 2;

{moveOut _x; deleteVehicle _x;} foreach (crew _vehicle);

_vehicle removeAction _action2;
hint "Tripulació despatxada";
Problemes coneguts: deixa de funcionar per un model de aparell determinat despres de que aquell aparell faci respawn amb el modul de respawn de vehicles del Arma3. A vegades, despres de una estimbada, quedan tripulants tirats per el mapa. Voldria una opcio per eliminarlos (encara que sigui ficant un trigger en un lloc del aeroport)
 

Magnetar

Més pesat que Kuban
22 Abril 2014
1,011
0
0
Kassel, Alemanya
#4
D'acord. Ja he començat a fer alguna cosa tot i que no molt.

1) He posat el script al github dels cavallers. Si no ho saps, el github és una eina de control de canvis molt útil que permet veure tot l'historial d'un fitxer determinat. Ho pots veure a https://github.com/CavallersDelCel/Helicrew.
2) He començat a adaptar certes comandes i a tractar opcions de forma conjunta en el cas d'avions/helicopters amb un sol seient (crewMaker.sqf)
3) El problema que tens durant el respawn és degut a que l'opció de generar tripulació només s'assigna a l'inici de la partida (init.sqf) i no durant el respawn. Hi ha diverses opcions per arreglar això: a) utilitzant CBA i b) a través d'un eventhandler ...

Aniré provant.
 

Magnetar

Més pesat que Kuban
22 Abril 2014
1,011
0
0
Kassel, Alemanya
#6
Un eventhandler és una espècie de trigger, que s'activa en determinades cituacions; hi ha eventhandlers que s'activen al disparar, al fer respawn, al canviar de posició en un vehicle etc.
 

paperboy

Ja en porto tres-cents
20 Març 2013
425
6
18
44
Warcelona
#7
Ostres Kronus que bo!! Em sembla una idea molt bona! Jo no se fer anar gaire l'avió encara, però com a copilot pot ser molt divertit. M'apunto de tester si cal. :çsalut: