2015-01-11 19:32:51 +00:00
|
|
|
/*
|
2015-09-28 15:11:53 +00:00
|
|
|
* Author: KoffeinFlummi, commy2
|
|
|
|
* Sends a near civilian crowd away with a chance of failure.
|
2015-01-11 23:13:47 +00:00
|
|
|
*
|
2015-01-11 19:32:51 +00:00
|
|
|
* Arguments:
|
2015-05-09 02:47:15 +00:00
|
|
|
* 0: Unit <OBJECT>
|
2015-01-11 19:32:51 +00:00
|
|
|
*
|
2015-09-28 15:11:53 +00:00
|
|
|
* Return Value:
|
2015-05-09 02:47:15 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2015-09-28 15:11:53 +00:00
|
|
|
* [civillian] call ace_interaction_fnc_sendAway
|
2015-05-09 02:47:15 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-11 23:13:47 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 19:32:51 +00:00
|
|
|
|
2015-09-28 15:11:53 +00:00
|
|
|
#define SEND_DISTANCE 50
|
|
|
|
#define SEND_RADIUS 10
|
2015-01-11 19:32:51 +00:00
|
|
|
|
2015-09-28 15:11:53 +00:00
|
|
|
params ["_unit"];
|
2015-01-11 19:32:51 +00:00
|
|
|
|
2015-09-28 15:11:53 +00:00
|
|
|
_unit playActionNow "GestureGo";
|
2015-01-11 19:32:51 +00:00
|
|
|
|
2015-09-28 15:11:53 +00:00
|
|
|
private "_chance";
|
|
|
|
_chance = [0.5, 0.8] select (count weapons _unit > 0);
|
2015-01-11 19:32:51 +00:00
|
|
|
|
|
|
|
{
|
2015-09-28 15:11:53 +00:00
|
|
|
if (count weapons _x == 0 && {random 1 < _chance}) then {
|
|
|
|
private "_position";
|
|
|
|
_position = getPosASL _unit vectorAdd (eyeDirection _unit vectorMultiply SEND_DISTANCE);
|
|
|
|
_position set [2, 0];
|
|
|
|
|
|
|
|
["sendAway", [_x], [_x, _position]] call EFUNC(common,targetEvent);
|
2015-05-09 02:47:15 +00:00
|
|
|
};
|
2015-09-28 15:11:53 +00:00
|
|
|
false
|
|
|
|
} count (_unit nearEntities ["Civilian", SEND_RADIUS]);
|