P-Milkman - 15 Septembre 2022, 13:22
Hello le clan Ado, après un paquet de mois de pause, j'ai repris l'édition de mission.
Je fais à nouveau face à un joli mur
Après avoir essayer le scénario "Extraction" de Western Sahara, j'ai voulu me renseigner sur un script de transport en hélico un peu plus poussé que le module de base du jeu.
En fouillant, j'ai trouvé quelque chose qui me rappelait Arma 2 (avec signalement à la fumigène ou IR)
J'ai donc commencé à mettre en forme le code que je souhaite en me basant sur celui trouvé. Je souhaite qu'il soit fonctionnel en SP et MP.
J'ai essayé de joindre le codeur intial Thedubl via Steam mais pas de réponses pour le moment.
Deux soucis s'offrent à moi:
- j'aimerais rendre l'addAction uniquement disponible quand aucun hélicoptère n'est créé. Actuellement, à chaque activation, un hélico spawn...
- pour le visuel, je souhaiterais inclure une image à coté du Addaction du menu déroulant ()
J'ai essayé pleins de méthodes, mais rien ne semble fonctionner. En dehors de ça, le script est tout à fait fonctionnel, traduit en VF et incluant les sons en Anglais.
J'utilise 2 fichiers pour faire tourner ça:
initPlayerlocal.sqf
//insertion [[player,[("" + ("Transport Aérien") + " "),{_this execVM "scripts\insertion.sqf"},[player],0,false,true, "",'player ==_target and (_target distance getMarkerPos ''safezone'') >= 250']],"addAction",true,true,false] call BIS_fnc_MP; // Add it back when you die/respawn. player addEventHandler [ "respawn", { insertion = [[player,[("" + ("Transport Aérien") + " "),{_this execVM "scripts\insertion.sqf"},[player],0,false,true, "",'player ==_target and (_target distance getMarkerPos ''safezone'') >= 250']],"addAction",true,true,false] call BIS_fnc_MP; } ];
/************************************************************************************************************* Original code: thedubl Modification with sound & French translation: P. Milkman setup: 1. add this to initplayerlocal [[player,[("" + ("Transport") + " "),{_this execVM "scripts\insertion.sqf"},[player],0,false,true, "",'player ==_target']],"addAction",true,true,false] call BIS_fnc_MP; 2. Place this code in folder called "scripts" and name it "insertion.sqf" 3. Place the folder "heli" in a folder named Sound in your mission's folder 3. place a default marker anywhere on the map called "transportdelete" ************************************************************************************************************/ _host = _this select 0; _caller = _this select 1; _id = _this select 2; _params = _this select 3; _type = _params select 0;//true for all group, false for player only. execVm "Sound\heli\heli1.sqf"; //heli1 sleep 4; //heli1 /******************************************************************** spawn chopper **Going to make this spawn multiple helos later. ********************************************************************/ _heliPos = [(getPos player select 0)+1000,(getPos player select 1)+random 1000,(getPos player select 2)+300]; InsertionHeli = createGroup WEST; { _vehType = _x select 0; _vehName = _x select 1; _veh = [_heliPos, 0, _vehType, InsertionHeli] call BIS_fnc_spawnVehicle; if (_vehName != "") then { (_veh select 0) setVehicleVarName _vehName; missionNamespace setVariable [_vehName, (_veh select 0)]; }; } forEach [ ["B_Heli_Transport_01_F", "helo"] //** heli classname ]; sleep 1; //pickup _playerPos = getPos player; _arrivePos = [( _playerPos select 0)+50,(_playerPos select 1)+100,( _playerPos select 2)]; _pickupPos = [( _playerPos select 0)+round(random 10),( _playerPos select 1)+round(random 10),( _playerPos select 2)]; //monitor _monitor = [] spawn { waituntil { sleep 1; (!alive helo) && (!alive player)}; {deleteVehicle _x} forEach crew helo + [helo];}; //Go to location wait for signal _insertWp = InsertionHeli addWaypoint [_arrivePos, 0]; _insertWp setWaypointType "Move"; _insertWp setWaypointSpeed "LIMITED"; _insertWp setWaypointFormation "COLUMN"; //_insertWp setWaypointLoiterRadius 50; _insertWp setWaypointCompletionRadius 50; //_insertWp setWaypointStatements ["true", "if (daytime >= 0 && daytime <= 6 ) then {""Deploy IR gernade!"" remoteExec [""hint""];}else{"" Pop smoke!"" remoteExec [""hint""];};"]; //depending on time of dayt requires either ir or smoke if (daytime >= 0 && daytime <= 6 ) then { //_caller groupchat "Wait to deploy IR gernade until we clear the area and in range!"; execVm "Sound\heli\heli2.sqf"; //heli2 }else{ //_caller groupchat "Wait to pop smoke until we clear the area and in range!"; execVm "Sound\heli\heli3.sqf"; //heli3 }; //Wait until the chopper is close. waituntil { sleep 1; (_caller distance helo) <= 250 ; }; //B_IR_Grenade if (daytime >= 0 && daytime <= 6 ) then { execVm "Sound\heli\heli4.sqf"; //heli4 waituntil { sleep 1; count(_caller nearObjects ["IRStrobeBase",50])!=0 }; }else{ execVm "Sound\heli\heli5.sqf"; //heli5 waituntil { sleep 1; count( _caller nearObjects ["SmokeShell",50])!=0;}; }; sleep 5; //PICKUP!!! //_caller groupchat "We have eyes on... Landing!"; execVm "Sound\heli\heli6.sqf"; //heli6 sleep 2; //set the way point for pickup _insertionWp = InsertionHeli addWaypoint [_pickupPos, 0]; _insertionWp setWaypointType "TR UNLOAD"; _insertionWp setWaypointSpeed "LIMITED"; _insertionWp setWaypointFormation "COLUMN"; _insertionWp setWaypointCompletionRadius 10; sleep 3; //_caller groupchat "Once we land, load up quickly..."; execVm "Sound\heli\heli7.sqf"; //heli7 //Once in allow order options waituntil { sleep 1; (player != vehicle player && player in helo && alive helo || (!alive helo)) } ; //**********************************open map and get pos*************************** if (not alive _host) exitwith { hint "Insertion non valide"; _host removeaction _id; }; //_caller groupchat "Select insertion point."; hint "Commande: Choisir un point d'insertion."; openMap true; mapclick = false; onMapSingleClick "clickpos = _pos; mapclick = true; onMapSingleClick """";true;"; waituntil {mapclick or !(visiblemap)}; if (!visibleMap) exitwith { //_caller groupchat "Request Cancelled..."; hint "Commande: Demande annulée..."; }; pos = clickpos; sleep 1; openMap false; //***************************************************************************** //_caller groupchat "Waiting for orders... use the order pilot action!"; execVm "Sound\heli\heli8.sqf"; //heli8 if (!alive helo) exitWith {}; /**************Funcitons for commanding pilot******************************/ dub_showActions = true; dub_fnc_Land = { _insertionWp2 = InsertionHeli addWaypoint [pos, 0]; _insertionWp2 setWaypointType "TR UNLOAD"; _insertionWp2 setWaypointSpeed "FULL"; _insertionWp2 setWaypointFormation "COLUMN"; _insertionWp2 setWaypointCompletionRadius 10; InsertionHeli setBehaviour "CARELESS"; _insertionWp2 setWaypointStatements ["true", {_this execVm "Sound\heli\heli9.sqf";}]; //heli9"]; helo flyInHeightASL [25,50,50]; //Add rtb addaction [] spawn dub_fnc_rtb; dub_showActions = false; }; dub_fnc_rtb = { sleep 3; execVm "Sound\heli\heli10.sqf"; //heli10 sleep 2; _rtb = player addAction ["Retour à la base! " ,{ _insertionWp3 = InsertionHeli addWaypoint [getMarkerPos "transportdelete", 0]; _insertionWp3 setWaypointType "MOVE"; _insertionWp3 setWaypointSpeed "FULL"; _insertionWp3 setWaypointFormation "COLUMN"; _insertionWp3 setWaypointCompletionRadius 50; InsertionHeli setBehaviour "CARELESS"; _insertionWp3 setWaypointStatements ["true","{deleteVehicle _x} forEach crew helo + [helo]; " ]; _player = _this select 1; _id = _this select 2; _player removeaction _id; execVm "Sound\heli\heli11.sqf";//heli11 },[],0,false,true,"",'vehicle player ==_target']; }; /****************************************MENU***************************************/ INSERTIONMENU = [ ["Options",true], ["Attérir", [3], "", -5, [["expression", "_thread = 1 spawn dub_fnc_Land ;"]], "1", "1"] ]; _menu = _caller addAction [("" + ("Ordre de départ") + " "), {showCommandingMenu "#USER:INSERTIONMENU";}, [], -99, false, true, "", "dub_showActions"]; if (!alive helo) exitWith { _caller removeaction _menu;};
The-KiLLeR - 15 Septembre 2022, 16:16
Salut,
Utilise une variable pour savoir si une insertion est en cours.
initServer.sqf
missionNamespace setVariable["insertion",false,true];
missionNamespace setVariable["insertion",true,true];
missionNamespace setVariable["insertion",false,true];
private _action = player addAction [format["Transport Aérien "],{_this execVM "scripts\insertion.sqf"},[player],0,false,true, "","!(missionNamespace getVariable 'insertion') && player ==_target and (_target distance getMarkerPos 'safezone') >= 250"];
private _action = player addAction [format["Transport Aérien "],{_this execVM "scripts\insertion.sqf"},[player],0,false,true, "","!(missionNamespace getVariable 'insertion') && player ==_target and (_target distance getMarkerPos 'safezone') >= 250"]; player setUserActionText [ _action, format["Transport Aérien "], format[""] ];
P-Milkman - 15 Septembre 2022, 17:35
The-Killer, mon héro !
Merci pour l'énorme coup de main, je n'avais pas pensé du tout à utiliser une variable, ça simplifie la vie ! merci beaucoup !
Du coup j'ai deux erreurs qui apparaissent, ligne 19 et 179 (voir code ci-dessous, les remarques sont en commentaire)
Par contre, du coup j'ai une autre question, qui concerne la fin du script, je souhaiterais que lorsque que l'on entre dans l'hélico la map s'ouvre, le pilote nous indique de choisir une destination, jusque là, ça fonctionne,
mais j'aimerais que lorsque l'on clique, l'hélico se mette directement en route. Je suppose que ça doit passer par le onMapClick
insertion.sqf à jour
/************************************************************************************************************* Original code: thedubl Modification with sound & French translation: P. Milkman setup: 1. add this to initplayerlocal [[player,[("" + ("Transport") + " "),{_this execVM "scripts\insertion.sqf"},[player],0,false,true, "",'player ==_target']],"addAction",true,true,false] call BIS_fnc_MP; 2. Place this code in folder called "scripts" and name it "insertion.sqf" 3. Place the folder "heli" in a folder named Sound in your mission's folder 3. place a default marker anywhere on the map called "transportdelete" ************************************************************************************************************/ missionNamespace setVariable["insertion",true,true]; // variable mise au début du script impliquant un message d'erreur (ligne 19) _host = _this select 0; _caller = _this select 1; _id = _this select 2; _params = _this select 3; _type = _params select 0;//true for all group, false for player only. execVm "Sound\heli\heli1.sqf"; //heli1 sleep 4; /******************************************************************** spawn chopper **Going to make this spawn multiple helos later. ********************************************************************/ _heliPos = [(getPos player select 0)+1000,(getPos player select 1)+random 1000,(getPos player select 2)+300]; InsertionHeli = createGroup WEST; { _vehType = _x select 0; _vehName = _x select 1; _veh = [_heliPos, 0, _vehType, InsertionHeli] call BIS_fnc_spawnVehicle; if (_vehName != "") then { (_veh select 0) setVehicleVarName _vehName; missionNamespace setVariable [_vehName, (_veh select 0)]; }; } forEach [ ["B_Heli_Transport_01_F", "helo"] //** heli classname ]; sleep 1; //pickup _playerPos = getPos player; _arrivePos = [( _playerPos select 0)+50,(_playerPos select 1)+50,( _playerPos select 2)]; _pickupPos = [( _playerPos select 0)+round(random 10),( _playerPos select 1)+round(random 10),( _playerPos select 2)]; //monitor _monitor = [] spawn { waituntil { sleep 1; (!alive helo) && (!alive player)}; {deleteVehicle _x} forEach crew helo + [helo];}; //Go to location wait for signal _insertWp = InsertionHeli addWaypoint [_arrivePos, 0]; _insertWp setWaypointType "Move"; _insertWp setWaypointSpeed "LIMITED"; _insertWp setWaypointFormation "COLUMN"; //_insertWp setWaypointLoiterRadius 50; _insertWp setWaypointCompletionRadius 50; //_insertWp setWaypointStatements ["true", "if (daytime >= 0 && daytime <= 6 ) then {""Deploy IR gernade!"" remoteExec [""hint""];}else{"" Pop smoke!"" remoteExec [""hint""];};"]; //depending on time of dayt requires either ir or smoke if (daytime >= 0 && daytime <= 6 ) then { //_caller groupchat "Wait to deploy IR gernade until we clear the area and in range!"; execVm "Sound\heli\heli2.sqf"; //heli2 }else{ //_caller groupchat "Wait to pop smoke until we clear the area and in range!"; execVm "Sound\heli\heli3.sqf"; //heli3 }; //Wait until the chopper is close. waituntil { sleep 1; (_caller distance helo) <= 250 ; }; //B_IR_Grenade if (daytime >= 0 && daytime <= 6 ) then { execVm "Sound\heli\heli4.sqf"; //heli4 waituntil { sleep 1; count(_caller nearObjects ["IRStrobeBase",50])!=0 }; }else{ execVm "Sound\heli\heli5.sqf"; //heli5 waituntil { sleep 1; count( _caller nearObjects ["SmokeShell",50])!=0;}; }; sleep 5; //PICKUP!!! //_caller groupchat "We have eyes on... Landing!"; execVm "Sound\heli\heli6.sqf"; //heli6 sleep 2; //set the way point for pickup [_pickupPos, 0, "Land_HelipadEmpty_F", west] call BIS_fnc_spawnVehicle; _insertionWp = InsertionHeli addWaypoint [_pickupPos, 0]; _insertionWp setWaypointType "TR UNLOAD"; _insertionWp setWaypointSpeed "LIMITED"; _insertionWp setWaypointFormation "COLUMN"; _insertionWp setWaypointCompletionRadius 10; sleep 3; //_caller groupchat "Once we land, load up quickly..."; execVm "Sound\heli\heli7.sqf"; //heli7 //Once in allow order options waituntil { sleep 1; (player != vehicle player && player in helo && alive helo || (!alive helo)) } ; //**********************************open map and get pos*************************** if (not alive _host) exitwith { hint "Insertion non valide"; missionNamespace setVariable["insertion",false,true]; // variable mise en cas d'échec _host removeaction _id; }; //_caller groupchat "Select insertion point."; hint "Commande: Choisir un point d'insertion."; openMap true; execVm "Sound\heli\heli8.sqf"; //heli8 mapclick = false; onMapSingleClick "clickpos = _pos; mapclick = true; onMapSingleClick """";true;"; waituntil {mapclick or !(visiblemap)}; if (!visibleMap) exitwith { //_caller groupchat "Request Cancelled..."; hint "Commande: Demande annulée..."; missionNamespace setVariable["insertion",false,true];// variable mise en cas d'échec }; pos = clickpos; sleep 1; openMap false; //***************************************************************************** //_caller groupchat "Waiting for orders... use the order pilot action!"; if (!alive helo) exitWith {}; /**************Funcitons for commanding pilot******************************/ dub_showActions = true; dub_fnc_Land = { [_pos, 0, "Land_HelipadEmpty_F", west] call BIS_fnc_spawnVehicle; _insertionWp2 = InsertionHeli addWaypoint [pos, 0]; _insertionWp2 setWaypointType "TR UNLOAD"; _insertionWp2 setWaypointSpeed "FULL"; _insertionWp2 setWaypointFormation "COLUMN"; _insertionWp2 setWaypointCompletionRadius 10; InsertionHeli setBehaviour "CARELESS"; _insertionWp2 setWaypointStatements ["true", """"]; _insertionWp2 setWaypointScript [execVm "Sound\heli\heli9.sqf";]; //heli9; //Ligne 179: je dois me louper dans la syntaxe, je souhaite lancé le sqf lorsque l'hélico nous dépose... helo flyInHeightASL [25,50,50]; //Add rtb addaction [] spawn dub_fnc_rtb; dub_showActions = true; }; dub_fnc_rtb = { sleep 3; execVm "Sound\heli\heli10.sqf"; //heli10 sleep 2; _rtb = player addAction ["Retour à la base! " ,{ _insertionWp3 = InsertionHeli addWaypoint [getMarkerPos "transportdelete", 0]; _insertionWp3 setWaypointType "MOVE"; _insertionWp3 setWaypointSpeed "FULL"; _insertionWp3 setWaypointFormation "COLUMN"; _insertionWp3 setWaypointCompletionRadius 50; InsertionHeli setBehaviour "CARELESS"; _insertionWp3 setWaypointStatements ["true","{deleteVehicle _x} forEach crew helo + [helo]; " ]; missionNamespace setVariable["insertion",false,true]; _player = _this select 1; _id = _this select 2; _player removeaction _id; execVm "Sound\heli\heli11.sqf";//heli11 },[],0,false,true,"",'vehicle player ==_target']; }; /****************************************MENU***************************************/ //partie que je souhaite faire disparaitre INSERTIONMENU = [ ["Options",true], ["Attérir", [3], "", -5, [["expression", "_thread = 1 spawn dub_fnc_Land ;"]], "1", "1"] ]; _menu = _caller addAction [("" + ("Ordre de départ") + " "), {showCommandingMenu "#USER:INSERTIONMENU";}, [], -99, false, true, "", "dub_showActions"]; if (!alive helo) exitWith { _caller removeaction _menu;};
The-KiLLeR - 15 Septembre 2022, 18:15
Je n'ai aucune erreur sur la ligne 19.
Pour la ligne 179, supprime "setWaypointScript" et modifie le "setWaypointStatements" :
_insertionWp2 setWaypointStatements ["true", "execVm 'Sound\heli\heli9.sqf';"];
P-Milkman - 15 Septembre 2022, 18:39
Merci beaucoup, je n'avais pas vu venir la nécessité de doublé les " et ' pour séparer les infos!
En fait, à l'heure actuelle, lorsque je suis dans l'hélico, la map s'ouvre automatiquement. Je clique là où je souhaite atterrir. Un sleep de 1, puis je reviens à la vue de mon personnage
et je dois sélectionner "Ordre de départ" puis "atterrir" pour que l'hélico se mette en route. Je souhaiterais que lorsque je clique, il se mette directement en route.
Pour cette étape, j'ai également un soucis de syntaxe avec ma création d'héliport invisible (pour faciliter l'atterrissage).
En plus d'indiquer la position directement à l'hélico, j'aimerais qu'un héliport invisible se créé là ou j'ai cliqué, mais pour le moment je patauge ^^
Édit: j'vais essayer avec du waituntil et reformuler la fin du script aujourd'hui, j'espère que ça va fonctionner
The-KiLLeR - 16 Septembre 2022, 11:27
Pourrais-tu me fournir une mission démo pour que je puisse tester et trouver une solution ?
Car j'ai essayé dans l'éditeur mais l'hélico ne se pose jamais.. et je n'ai pas d'autres actions.
N'hésite pas à passer sur notre discord.
P-Milkman - 16 Septembre 2022, 14:15
Hello, le fichier est légèrement changé depuis hier, je fais des tests depuis ce matin
https://1fichier.com/?b8ywf1q0t082a9ljkk91
J'essaie de faire en sorte que lorsque l'on clique sur le lieu pour la map, l'hélico décolle tout de suite, en lançant dub_fnc_Land, à ce moment là, je souhaiterais que là on l'on a cliqué, un heliport invisible apparaisse.
Puis dès qu'il nous a déposé et que l'hélico est vie il lance dub_fnc_rtb, et seulement une fois l'hélico delete, alors les joueurs peuvent à nouveau avoir l'Action
The-KiLLeR - 17 Septembre 2022, 8:49
Remplace ton script insertion par celui ci-dessous.
Les fonctions doivent être déclarées avant de les exécutées.
Les variables globales ne sont pas accessibles dedans, ils faut les passer en paramètres.
/************************************************************************************************************* Original code: thedubl Modification avec le son, les dialogues et la traduction française: P. Milkman Conseils et aides de The-Killer du Clan Ado: https://www.clan-ado.fr/forum/index.php ************************************************************************************************************/ dub_fnc_Land = { params["_InsertionHeli","_helo","_pos"]; [_pos, 0, "Land_HelipadEmpty_F", west] call BIS_fnc_spawnVehicle; _insertionWp2 = _InsertionHeli addWaypoint [_pos, 0]; _insertionWp2 setWaypointType "TR UNLOAD"; _insertionWp2 setWaypointSpeed "FULL"; _insertionWp2 setWaypointFormation "COLUMN"; _insertionWp2 setWaypointCompletionRadius 10; _InsertionHeli setBehaviour "CARELESS"; _insertionWp2 setWaypointStatements ["true", "execVm 'Sound\heli\heli9.sqf';"]; //heli9; _helo flyInHeightASL [25,50,50]; //Vérifications d'étapes //TEST waitUntil {vehicle player == player}; { unassignVehicle _x ; moveOut _x } foreach units group player; //Ajout de l'option "Retour à la base" [_InsertionHeli] spawn dub_fnc_rtb; dub_showActions = false; //test }; dub_fnc_rtb = { params["_InsertionHeli"]; sleep 3; execVm "Sound\heli\heli10.sqf"; //heli10 sleep 2; _insertionWp3 = _InsertionHeli addWaypoint [getMarkerPos "transportdelete", 0]; _insertionWp3 setWaypointType "MOVE"; _insertionWp3 setWaypointSpeed "FULL"; _insertionWp3 setWaypointFormation "COLUMN"; _insertionWp3 setWaypointCompletionRadius 50; _InsertionHeli setBehaviour "CARELESS"; _insertionWp3 setWaypointStatements ["true","{deleteVehicle _x} forEach crew helo + [helo]; missionNamespace setVariable['insertion',false,true]; " ]; execVm "Sound\heli\heli11.sqf";//heli11 }; missionNamespace setVariable["insertion",true,true]; _host = _this select 0; _caller = _this select 1; _id = _this select 2; _params = _this select 3; _type = _params select 0;//true pour tout le groupe, false pour le joueur seulement. execVm "Sound\heli\heli1.sqf"; //heli1 sleep 4; _heliPos = [(getPos player select 0)+1000,(getPos player select 1)+random 1000,(getPos player select 2)+300]; InsertionHeli = createGroup WEST; { _vehType = _x select 0; _vehName = _x select 1; _veh = [_heliPos, 0, _vehType, InsertionHeli] call BIS_fnc_spawnVehicle; if (_vehName != "") then { (_veh select 0) setVehicleVarName _vehName; missionNamespace setVariable [_vehName, (_veh select 0)]; }; } forEach [ ["B_Heli_Transport_01_F", "helo"] //** heli classname ]; sleep 1; //zone de récupération _playerPos = getPos player; _arrivePos = [( _playerPos select 0)+50,(_playerPos select 1)+50,( _playerPos select 2)]; _pickupPos = [( _playerPos select 0)+round(random 10),( _playerPos select 1)+round(random 10),( _playerPos select 2)]; //vérifications _monitor = [] spawn { waituntil { sleep 1; (!alive helo) && (!alive player)}; {deleteVehicle _x} forEach crew helo + [helo];}; //Déplacement vers la zone en attente de signal _insertWp = InsertionHeli addWaypoint [_arrivePos, 0]; _insertWp setWaypointType "Move"; _insertWp setWaypointSpeed "LIMITED"; _insertWp setWaypointFormation "COLUMN"; _insertWp setWaypointCompletionRadius 50; //selon l'heure il faudra soit une fumigène, soit une grenade IR if (daytime >= 0 && daytime <= 6 ) then { //nécessite IR"; execVm "Sound\heli\heli2.sqf"; //heli2 }else{ //nécessite fumigène; execVm "Sound\heli\heli3.sqf"; //heli3 }; //attendre que l'hélico soit proche waituntil { sleep 1; (_caller distance helo) <= 250 ; }; //B_IR_Grenade if (daytime >= 0 && daytime <= 6 ) then { execVm "Sound\heli\heli4.sqf"; //heli4 waituntil { sleep 1; count(_caller nearObjects ["IRStrobeBase",50])!=0 }; }else{ execVm "Sound\heli\heli5.sqf"; //heli5 waituntil { sleep 1; count( _caller nearObjects ["SmokeShell",50])!=0;}; }; sleep 5; //Réucpération execVm "Sound\heli\heli6.sqf"; //heli6 sleep 2; //Définition du point de récupération [_pickupPos, 0, "Land_HelipadEmpty_F", west] call BIS_fnc_spawnVehicle; _insertionWp = InsertionHeli addWaypoint [_pickupPos, 0]; _insertionWp setWaypointType "TR UNLOAD"; _insertionWp setWaypointSpeed "LIMITED"; _insertionWp setWaypointFormation "COLUMN"; _insertionWp setWaypointCompletionRadius 10; sleep 3; execVm "Sound\heli\heli7.sqf"; //heli7 //Vérifications d'étapes waituntil { sleep 1; (player != vehicle player && player in helo && alive helo || (!alive helo)) } ; //Ouverture de la map et désignation de lieu if (not alive _host) exitwith { hint "Insertion non valide"; missionNamespace setVariable["insertion",false,true]; _host removeaction _id; }; //Hint de consigne hint "Commande: Choisir un point d'insertion."; openMap true; execVm "Sound\heli\heli8.sqf"; //heli8 mapclick = false; onMapSingleClick "clickpos = _pos; mapclick = true; onMapSingleClick """";true;"; waituntil {mapclick or !(visiblemap)}; if (!visibleMap) exitwith { //Hint de consigne hint "Commande: Demande annulée..."; missionNamespace setVariable["insertion",false,true]; }; sleep 1; openMap false; [InsertionHeli,helo,clickpos] call dub_fnc_Land; //if (!alive helo) exitWith {call dub_fnc_Land;}; //Fonctions du pilotage dub_showActions = false; /****************************************MENU***************************************/ INSERTIONMENU = [ ["Options",true], ["Attérir", [3], "", -5, [["expression", "_thread = 1 spawn dub_fnc_Land ;"]], "1", "1"] ]; _menu = _caller addAction [("" + ("Ordre de départ") + " "), {showCommandingMenu "#USER:INSERTIONMENU";}, [], -99, false, true, "", "dub_showActions"]; if (!alive helo) exitWith { _caller removeaction _menu;};
P-Milkman - 19 Septembre 2022, 14:01
Merci beaucoup !! Tu m'a vraiment permis d'arriver à ce que je souhaitais !
Ci-dessous le code modifié avec ajout d'un marqueur lors de la dépose et des lignes devenues inutiles en moins. SI besoin, n'hésitez pas à l'emprunter/modifier!!
/************************************************************************************************************* Original code: thedubl Modification avec le son, les dialogues et la traduction franaise: P. Milkman Conseils et aides de The-Killer du Clan Ado: https://www.clan-ado.fr/forum/index.php ************************************************************************************************************/ //définition des fonctions dub_fnc_Land = { params["_InsertionHeli","_helo","_pos"]; [_pos, 0, "Land_HelipadEmpty_F", west] call BIS_fnc_spawnVehicle; _markerstr = createMarker ["insertion", _pos]; _markerstr setMarkerType "mil_join"; _markerstr setMarkerColor "colorBLUFOR"; _markerstr setmarkerText "Zone d'insértion"; _insertionWp2 = _InsertionHeli addWaypoint [_pos, 0]; _insertionWp2 setWaypointType "TR UNLOAD"; _insertionWp2 setWaypointSpeed "FULL"; _insertionWp2 setWaypointFormation "COLUMN"; _insertionWp2 setWaypointCompletionRadius 10; _InsertionHeli setBehaviour "CARELESS"; _insertionWp2 setWaypointStatements ["true", "execVm 'Sound\heli\heli9.sqf';"]; //heli9; _helo flyInHeightASL [25,50,50]; //Vérifications d'étapes waitUntil {vehicle player == player}; { unassignVehicle _x ; moveOut _x } foreach units group player; //Ajout du "Retour la base" [_InsertionHeli] spawn dub_fnc_rtb; dub_showActions = false; }; dub_fnc_rtb = { params["_InsertionHeli"]; sleep 3; sleep 2; _insertionWp3 = _InsertionHeli addWaypoint [getMarkerPos "transportdelete", 0]; _insertionWp3 setWaypointType "MOVE"; _insertionWp3 setWaypointSpeed "FULL"; _insertionWp3 setWaypointFormation "COLUMN"; _insertionWp3 setWaypointCompletionRadius 50; _InsertionHeli setBehaviour "CARELESS"; _insertionWp3 setWaypointStatements ["true","{deleteVehicle _x} forEach crew helo + [helo]; missionNamespace setVariable['insertion',false,true];" ]; sleep 10; deleteMarker "insertion"; execVm "Sound\heli\heli11.sqf";//heli11 }; //déroulement du script missionNamespace setVariable["insertion",true,true]; _host = _this select 0; _caller = _this select 1; _id = _this select 2; _params = _this select 3; _type = _params select 0;//true pour tout le groupe, false pour le joueur seulement. execVm "Sound\heli\heli1.sqf"; //heli1 sleep 4; _heliPos = [(getPos player select 0)+2000,(getPos player select 1)+random 2000,(getPos player select 2)+300]; InsertionHeli = createGroup WEST; { _vehType = _x select 0; _vehName = _x select 1; _veh = [_heliPos, 0, _vehType, InsertionHeli] call BIS_fnc_spawnVehicle; if (_vehName != "") then { (_veh select 0) setVehicleVarName _vehName; missionNamespace setVariable [_vehName, (_veh select 0)]; }; } forEach [ ["B_Heli_Transport_01_F", "helo"] //** heli classname ]; sleep 1; //zone de récupération _playerPos = getPos player; _arrivePos = [( _playerPos select 0)+50,(_playerPos select 1)+50,( _playerPos select 2)]; _pickupPos = [( _playerPos select 0)+round(random 10),( _playerPos select 1)+round(random 10),( _playerPos select 2)]; //vérifications _monitor = [] spawn { waituntil { sleep 1; (!alive helo) && (!alive player)}; {deleteVehicle _x} forEach crew helo + [helo];}; //Déplacement vers la zone en attente de signal _insertWp = InsertionHeli addWaypoint [_arrivePos, 0]; _insertWp setWaypointType "Move"; _insertWp setWaypointSpeed "FULL"; _insertWp setWaypointFormation "COLUMN"; _insertWp setWaypointCompletionRadius 50; //selon l'heure il faudra soit une fumigène, soit une grenade IR if (daytime >= 0 && daytime <= 6 ) then { //ncessite IR"; execVm "Sound\heli\heli2.sqf"; //heli2 }else{ //nécessite fumigène; execVm "Sound\heli\heli3.sqf"; //heli3 }; //attendre que l'hélico soit proche waituntil { sleep 1; (_caller distance helo) <= 250 ; }; //B_IR_Grenade if (daytime >= 0 && daytime <= 6 ) then { execVm "Sound\heli\heli4.sqf"; //heli4 waituntil { sleep 1; count(_caller nearObjects ["IRStrobeBase",50])!=0 }; }else{ execVm "Sound\heli\heli5.sqf"; //heli5 waituntil { sleep 1; count( _caller nearObjects ["SmokeShell",50])!=0;}; }; sleep 5; //Récupération execVm "Sound\heli\heli6.sqf"; //heli6 sleep 2; //Définition du point de récupération [_pickupPos, 0, "Land_HelipadEmpty_F", west] call BIS_fnc_spawnVehicle; _insertionWp = InsertionHeli addWaypoint [_pickupPos, 0]; _insertionWp setWaypointType "TR UNLOAD"; _insertionWp setWaypointSpeed "FULL"; _insertionWp setWaypointFormation "COLUMN"; _insertionWp setWaypointCompletionRadius 10; sleep 3; execVm "Sound\heli\heli7.sqf"; //heli7 //Vérifications d'étapes waituntil { sleep 1; (player != vehicle player && player in helo && alive helo || (!alive helo)) } ; //Ouverture de la map et désignation de lieu if (not alive _host) exitwith { hint "Insertion non valide"; missionNamespace setVariable["insertion",false,true]; _host removeaction _id; }; //Hint de consigne hint "Commande: Choisir un point d'insertion."; sleep 2; hintSilent ""; openMap true; execVm "Sound\heli\heli8.sqf"; //heli8 mapclick = false; onMapSingleClick "clickpos = _pos; mapclick = true; onMapSingleClick """";true;"; waituntil {mapclick or !(visiblemap)}; if (!visibleMap) exitwith { //Hint de consigne hint "Commande: Demande annule..."; missionNamespace setVariable["insertion",false,true]; }; sleep 1; openMap false; [InsertionHeli,helo,clickpos] call dub_fnc_Land; //if (!alive helo) exitWith {call dub_fnc_Land;}; //Fonctions du pilotage dub_showActions = false;