Jump to content

Rithan

Member
  • Content Count

    2
  • Joined

  • Last visited

  • Medals

Community Reputation

1 Neutral

About Rithan

  • Rank
    Newbie
  1. Thanks for pointing out that the eventHandler was constantly running and adding a new one each time. I fixed the issue by adding player removeEventHandler ["Fired", 0]; At the bottom of my current script
  2. Hello! I'm trying to make a script that will create a helicopter that will fly to the player, land and transport the player back to base when the player throws orange smoke. Most of the script is working fine, but if the player wants to extract a second time after getting back to base, two helicopters will spawn. If done one more time a third will spawn etc. Here is the code that I'm currently using: player addAction ["Request transport", {[] execVM "Scripts\extract.sqf"}, nil, 0.1, false]; // This is in another file to the rest of the script systemChat "Mark your position with orange smoke!"; player addItem "SmokeShellOrange"; player addEventHandler ["Fired", { if ((_this select 4) == "SmokeShellOrange") then { (_this select 6) spawn //spawn will create 1 extra helo every time smoke is thrown { waitUntil {sleep 1, (speed _this <= 0) || (!alive _this)}; _smoke = getPos _this; _pickup = createSimpleObject ["Headgear_H_WirelessEarpiece_F", _smoke]; hideObject _pickup; _marker = 1; waitUntil { sleep 1, _marker == 1}; _radius = getPos player; _helo = createVehicle ["B_Heli_Transport_01_F", _radius, [], 2500, "FLY"]; createVehicleCrew _helo; systemChat "A helicopter is en-route to extract you!"; _zone = getPos _pickup; _helo move _zone; waitUntil {sleep 1, ((_helo distance _zone) < 150)}; doStop _helo; _helo land "GET IN"; {_helo animateDoor [_x, 1]} forEach ["door_back_L","door_back_R","door_L","door_R"]; waitUntil {sleep 1, player in _helo}; {_helo animateDoor [_x, 0]} forEach ["door_back_L","door_back_R","door_L","door_R"]; _helo move (getMarkerPos "start"); sleep 11; [0, "BLACK", 3] spawn BIS_fnc_fadeEffect; sleep 3; player setPos (getMarkerPos "service"); player setDamage 0; deleteVehicle _helo; skipTime 2; [1, "BLACK", 2] spawn BIS_fnc_fadeEffect; sleep 2; curobj allowDamage true; curobj enableSimulation true; deleteVehicle curobj; deleteVehicle veh; [] execVM "startupgui_fnc.sqf"; // Allows the player to set new mission parameters and usually only runs on mission start }; }; }]; Not only does this spawn two helicopters, it also broadcasts the chat message one time for every helicopter that spawns. This leads me to believe that the script is somehow running twice (?). Can anyone tell me what I am doing wrong and how to fix it?
×