Advertisement
secondcoming

Untitled

Nov 18th, 2015
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.70 KB | None | 0 0
  1. /** ROAMING TRADER by JohnO **/
  2.  
  3.  
  4. if (!isServer) exitWith {};
  5.  
  6. _world = (toLower worldName);
  7.  
  8. // Default to Chernarus
  9. _spawnCenter = [7652.9634, 7870.8076,0];
  10.     _max = 7500;
  11.  
  12. if (_world isEqualTo 'altis') then
  13. {
  14.     _spawnCenter = [15834.2,15787.8,0];
  15.     _max = 9000;
  16. };
  17.  
  18. _min = 1500; // minimum distance from the center position (Number) in meters
  19. _mindist = 20; // minimum distance from the nearest object (Number) in meters, ie. create waypoint this distance away from anything within x meters..
  20. _water = 0; // water mode 0: cannot be in water , 1: can either be in water or not , 2: must be in water
  21. _shoremode = 0; // 0: does not have to be at a shore , 1: must be at a shore
  22.  
  23. _possiblePosStart = [_spawnCenter,_min,_max,_mindist,_water,20,_shoremode] call BIS_fnc_findSafePos; //Use this if you want a completely random spawn location
  24.  
  25. /**Debug marker -- Im not great with scripts and not sure how to do configs so remove the comments if you want to have a marker to debug **/
  26.  
  27.  
  28.  
  29.  
  30.  
  31. //Remove the standard trader uniforms and add a random uniform
  32. //_uniform = ["U_IG_Guerilla3_1"] call BIS_fnc_selectRandom; //For some reason forceAddUniform won't work in MP, the guy is naked, works in the editor however =(
  33.  
  34. // Create the trader and ensure he doest react to gunfire or being shot at.
  35.  
  36. _group = createGroup resistance;
  37. _group setCombatMode "BLUE";
  38.  
  39. "Exile_Trader_Armory" createUnit [_possiblePosStart, _group, "trader = this; this disableAI 'AUTOTARGET'; this disableAI 'TARGET'; this disableAI 'SUPPRESSION'; "];
  40. trader allowDamage false;
  41. removeGoggles trader;
  42. trader forceAddUniform "U_IG_Guerilla3_1";
  43. trader addVest "V_TacVest_blk_POLICE";
  44. trader addBackpack "B_FieldPack_oli";
  45. trader addHeadgear "H_Cap_blk";
  46. trader addGoggles "TRYK_TAC_SET_OD";
  47.  
  48. // Spawn Traders Vehicle
  49. _vehicleObject = createVehicle ["rhs_uaz_open_vmf", _possiblePosStart, [], 0, "CAN_COLLIDE"];
  50. clearBackpackCargoGlobal _vehicleObject;
  51. clearItemCargoGlobal _vehicleObject;
  52. clearMagazineCargoGlobal _vehicleObject;
  53. clearWeaponCargoGlobal _vehicleObject;
  54. _vehicleObject setVariable ["ExileIsPersistent", false];
  55. _vehicleObject setFuel (random 1);
  56.  
  57. _vehicleObject addEventHandler ["HandleDamage", {
  58. _amountOfDamage = 0;
  59. _amountOfDamage
  60. }];
  61.  
  62. trader assignasdriver _vehicleObject;
  63. [trader] orderGetin true;
  64.  
  65. // Create 4 completely random waypoints for the trader to patrol
  66. /** Use these if you want specific positions EG _wayPointOne = getMarkerPos "Marker1"; you will need to place markers in the editor where you want **/
  67. /*
  68. _wayPointOne = getMarkerPos "youmarker1";
  69. _wayPointTwo = getMarkerPos "yourmarker2";
  70. _wayPointThree = getMarkerPos "yourmarker3";
  71. _wayPointFour = getMarkerPos "yourmarker4";
  72. */
  73.  
  74. _wayPointOne = [_spawnCenter,_min,_max,_mindist,_water,20,_shoremode] call BIS_fnc_findSafePos; //Remove or comment this line if you are using markers
  75.  
  76. _wp1 = _group addWaypoint [_wayPointOne, 0];
  77. _wp1 setWaypointType "MOVE";
  78. _wp1 setWaypointBehaviour "SAFE";
  79. _wp1 setWaypointspeed "LIMITED";
  80.  
  81. _wayPointTwo = [_spawnCenter,_min,_max,_mindist,_water,20,_shoremode] call BIS_fnc_findSafePos; //Remove or comment this line if you are using markers
  82.  
  83. _wp2 = _group addWaypoint [_wayPointTwo, 0];
  84. _wp2 setWaypointType "MOVE";
  85. _wp2 setWaypointBehaviour "SAFE";
  86. _wp2 setWaypointspeed "LIMITED";
  87.  
  88. _wayPointThree = [_spawnCenter,_min,_max,_mindist,_water,20,_shoremode] call BIS_fnc_findSafePos; //Remove or comment this line if you are using markers
  89.  
  90. _wp3 = _group addWaypoint [_wayPointThree, 0];
  91. _wp3 setWaypointType "MOVE";
  92. _wp3 setWaypointBehaviour "SAFE";
  93. _wp3 setWaypointspeed "LIMITED";
  94.  
  95. _wayPointFour = [_spawnCenter,_min,_max,_mindist,_water,20,_shoremode] call BIS_fnc_findSafePos; //Remove or comment this line if you are using markers
  96.  
  97. _wp4 = _group addWaypoint [_wayPointFour, 0];
  98. _wp4 setWaypointType "MOVE";
  99. _wp4 setWaypointBehaviour "SAFE";
  100. _wp4 setWaypointspeed "LIMITED";
  101.  
  102. // Last waypoint is set to cycle so the trader will cycle between all 4 way points constantly.
  103.  
  104. _wp5 = _group addWaypoint [_wayPointOne, 0];
  105. _wp5 setWaypointType "CYCLE";
  106. _wp5 setWaypointBehaviour "SAFE";
  107. _wp5 setWaypointspeed "LIMITED";
  108.  
  109. _traderPos = getPos trader;
  110. _mk = createMarker ["TraderLocation",_traderPos];
  111. "TraderLocation" setMarkerType "mil_warning";
  112. "TraderLocation" setMarkerText "Weapons Trader";
  113.  
  114. // Make trader will stand still when players near him.
  115. while {true} do
  116.     {
  117.         _pos = getPos trader;
  118.         _mk setMarkerPos _pos;
  119.         _nearPlayers = (count (_traderPos nearEntities [['Man'],5]));
  120.         if (_nearPlayers > 1)then
  121.         {
  122.             trader action ["salute", trader];
  123.             uiSleep 0.1;
  124.             trader disableAI "MOVE";
  125.         }
  126.         else
  127.         {
  128.             trader enableAI "MOVE";
  129.         };
  130.         uiSleep 5;
  131.         if(!Alive trader)exitWith {};
  132.     };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement