Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** ROAMING TRADER by JohnO **/
- if (!isServer) exitWith {};
- _world = (toLower worldName);
- // Default to Chernarus
- _spawnCenter = [7652.9634, 7870.8076,0];
- _max = 7500;
- if (_world isEqualTo 'altis') then
- {
- _spawnCenter = [15834.2,15787.8,0];
- _max = 9000;
- };
- _min = 1500; // minimum distance from the center position (Number) in meters
- _mindist = 20; // minimum distance from the nearest object (Number) in meters, ie. create waypoint this distance away from anything within x meters..
- _water = 0; // water mode 0: cannot be in water , 1: can either be in water or not , 2: must be in water
- _shoremode = 0; // 0: does not have to be at a shore , 1: must be at a shore
- _possiblePosStart = [_spawnCenter,_min,_max,_mindist,_water,20,_shoremode] call BIS_fnc_findSafePos; //Use this if you want a completely random spawn location
- /**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 **/
- //Remove the standard trader uniforms and add a random uniform
- //_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 =(
- // Create the trader and ensure he doest react to gunfire or being shot at.
- _group = createGroup resistance;
- _group setCombatMode "BLUE";
- "Exile_Trader_Armory" createUnit [_possiblePosStart, _group, "trader = this; this disableAI 'AUTOTARGET'; this disableAI 'TARGET'; this disableAI 'SUPPRESSION'; "];
- trader allowDamage false;
- removeGoggles trader;
- trader forceAddUniform "U_IG_Guerilla3_1";
- trader addVest "V_TacVest_blk_POLICE";
- trader addBackpack "B_FieldPack_oli";
- trader addHeadgear "H_Cap_blk";
- trader addGoggles "TRYK_TAC_SET_OD";
- // Spawn Traders Vehicle
- _vehicleObject = createVehicle ["rhs_uaz_open_vmf", _possiblePosStart, [], 0, "CAN_COLLIDE"];
- clearBackpackCargoGlobal _vehicleObject;
- clearItemCargoGlobal _vehicleObject;
- clearMagazineCargoGlobal _vehicleObject;
- clearWeaponCargoGlobal _vehicleObject;
- _vehicleObject setVariable ["ExileIsPersistent", false];
- _vehicleObject setFuel (random 1);
- _vehicleObject addEventHandler ["HandleDamage", {
- _amountOfDamage = 0;
- _amountOfDamage
- }];
- trader assignasdriver _vehicleObject;
- [trader] orderGetin true;
- // Create 4 completely random waypoints for the trader to patrol
- /** Use these if you want specific positions EG _wayPointOne = getMarkerPos "Marker1"; you will need to place markers in the editor where you want **/
- /*
- _wayPointOne = getMarkerPos "youmarker1";
- _wayPointTwo = getMarkerPos "yourmarker2";
- _wayPointThree = getMarkerPos "yourmarker3";
- _wayPointFour = getMarkerPos "yourmarker4";
- */
- _wayPointOne = [_spawnCenter,_min,_max,_mindist,_water,20,_shoremode] call BIS_fnc_findSafePos; //Remove or comment this line if you are using markers
- _wp1 = _group addWaypoint [_wayPointOne, 0];
- _wp1 setWaypointType "MOVE";
- _wp1 setWaypointBehaviour "SAFE";
- _wp1 setWaypointspeed "LIMITED";
- _wayPointTwo = [_spawnCenter,_min,_max,_mindist,_water,20,_shoremode] call BIS_fnc_findSafePos; //Remove or comment this line if you are using markers
- _wp2 = _group addWaypoint [_wayPointTwo, 0];
- _wp2 setWaypointType "MOVE";
- _wp2 setWaypointBehaviour "SAFE";
- _wp2 setWaypointspeed "LIMITED";
- _wayPointThree = [_spawnCenter,_min,_max,_mindist,_water,20,_shoremode] call BIS_fnc_findSafePos; //Remove or comment this line if you are using markers
- _wp3 = _group addWaypoint [_wayPointThree, 0];
- _wp3 setWaypointType "MOVE";
- _wp3 setWaypointBehaviour "SAFE";
- _wp3 setWaypointspeed "LIMITED";
- _wayPointFour = [_spawnCenter,_min,_max,_mindist,_water,20,_shoremode] call BIS_fnc_findSafePos; //Remove or comment this line if you are using markers
- _wp4 = _group addWaypoint [_wayPointFour, 0];
- _wp4 setWaypointType "MOVE";
- _wp4 setWaypointBehaviour "SAFE";
- _wp4 setWaypointspeed "LIMITED";
- // Last waypoint is set to cycle so the trader will cycle between all 4 way points constantly.
- _wp5 = _group addWaypoint [_wayPointOne, 0];
- _wp5 setWaypointType "CYCLE";
- _wp5 setWaypointBehaviour "SAFE";
- _wp5 setWaypointspeed "LIMITED";
- _traderPos = getPos trader;
- _mk = createMarker ["TraderLocation",_traderPos];
- "TraderLocation" setMarkerType "mil_warning";
- "TraderLocation" setMarkerText "Weapons Trader";
- // Make trader will stand still when players near him.
- while {true} do
- {
- _pos = getPos trader;
- _mk setMarkerPos _pos;
- _nearPlayers = (count (_traderPos nearEntities [['Man'],5]));
- if (_nearPlayers > 1)then
- {
- trader action ["salute", trader];
- uiSleep 0.1;
- trader disableAI "MOVE";
- }
- else
- {
- trader enableAI "MOVE";
- };
- uiSleep 5;
- if(!Alive trader)exitWith {};
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement