Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. #include <macro.h>
  2. /*
  3. File: fn_getDPMission.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Selects a random DP point for a delivery mission.
  8. Needs to be revised.
  9. */
  10. private["_dp","_target"];
  11. _target = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_param;
  12. if(str(_target) in LIFE_SETTINGS(getArray,"delivery_points")) then {
  13. private "_point";
  14. _point = LIFE_SETTINGS(getArray,"delivery_points");
  15. _point deleteAt (_point find (str(_target)));
  16. _dp = _point call BIS_fnc_selectRandom;
  17. } else {
  18. _dp = LIFE_SETTINGS(getArray,"delivery_points") call BIS_fnc_selectRandom;
  19. };
  20.  
  21. life_dp_start = _target;
  22.  
  23. life_delivery_in_progress = true;
  24. life_dp_point = call compile format["%1",_dp];
  25.  
  26. _dp = [_dp,"_"," "] call KRON_Replace;
  27. life_cur_task = player createSimpleTask [format["Delivery_%1",life_dp_point]];
  28. life_cur_task setSimpleTaskDescription [format[localize "STR_NOTF_DPStart",toUpper _dp],"Delivery Job",""];
  29. life_cur_task setTaskState "Assigned";
  30. player setCurrentTask life_cur_task;
  31.  
  32. ["DeliveryAssigned",[format[localize "STR_NOTF_DPTask",toUpper _dp]]] call bis_fnc_showNotification;
  33.  
  34. [] spawn {
  35. waitUntil {!life_delivery_in_progress OR !alive player};
  36. if(!alive player) then {
  37. life_cur_task setTaskState "Failed";
  38. player removeSimpleTask life_cur_task;
  39. ["DeliveryFailed",[localize "STR_NOTF_DPFailed"]] call BIS_fnc_showNotification;
  40. life_delivery_in_progress = false;
  41. life_dp_point = nil;
  42. };
  43. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement