Skip to content

Commit

Permalink
fixes for civs
Browse files Browse the repository at this point in the history
  • Loading branch information
nomisum committed Mar 13, 2016
1 parent d5ee67e commit cab8601
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 107 deletions.
93 changes: 5 additions & 88 deletions Engima/Traffic/Custom_GruppeAdler/createVehicle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,94 +3,11 @@ addFleeingBehaviour = {

if ((_this select 0) getVariable "fleeing" == "true") exitWith {};

if (count (weapons (_this select 0)) == 0) then {
[_this select 0, _this select 1] spawn {

_thisUnit = _this select 0;
_thisShooter = _this select 1;

deleteWaypoint [group _thisUnit, all];
_thisUnit leaveVehicle (vehicle _thisUnit);

// hintSilent format ["%1",_thisShooter];

sleep ((random 0.5) + 0.25);

_relDir = [_thisUnit,_thisShooter] call BIS_fnc_relativeDirTo;
_bla = ((nearestBuilding _thisUnit) call BIS_fnc_buildingPositions);

_rand = random 2;
if (_rand <= 1) exitWith {

//hintSilent format ["%1",_bla select 0];
if (count _bla > 1) then {
_thisUnit setBehaviour "SAFE";
_pos = _bla select 1;
_thisUnit doMove _pos;
_thisUnit setSpeedMode "FULL";
_thisUnit forceSpeed 25;
_thisUnit playMove "AmovPercMevaSnonWnonDf";
_thisUnit setVariable ["fleeing", "true"];
waitUntil {
_thisUnit distance _pos < 2
};
_thisUnit setVariable ["fleeing", "false"];
_thisUnit playMoveNow 'AinvPknlMstpSnonWnonDnon_1';
_thisUnit stop true;
_thisUnit removeEventHandler ["firedNear", 0];
};

if (count _bla < 1) then {
_pos = [_thisUnit,[5,20],_relDir-180] call SHK_pos;
_thisUnit doMove _pos;
_thisUnit setSpeedMode "FULL";
_thisUnit forceSpeed 20;
_thisUnit playMove "AmovPercMevaSnonWnonDf";
_thisUnit setVariable ["fleeing", "true"];
waitUntil {
_thisUnit distance _pos < 2
};
_thisUnit setVariable ["fleeing", "false"];

};
};

if (_rand > 1) exitWith
{
_thisUnit setBehaviour "SAFE";
_thisUnit setSpeedMode "FULL";
_thisUnit setVariable ["fleeing", "true"];

_newPos = [((getPos _thisShooter) select 0)-(random 10)*sin(_relDir - 180),((getPos _thisShooter) select 1)-(random 10)*cos(_relDir - 180),0];
_thisUnit doMove _newPos;
_thisUnit playMove "AmovPercMevaSnonWnonDf";
sleep 0.6;
waitUntil {
_thisUnit distance _newPos < 2
};
_thisUnit playMoveNow 'AinvPknlMstpSnonWnonDnon_1';
_thisUnit stop true;
_thisUnit removeEventHandler ["firedNear", 0];
};




/*
_this playMoveNow "AinvPknlMstpSnonWnonDnon_healed_2";
sleep 5.882;
doStop _this;
_movePos = [_this,[500,1000],random 360] call SHK_pos;
_this doMove _movePos;
_this forceSpeed 6;
*/
};
} else {
(_this select 0) spawn {
_this setBehaviour "AWARE";
};
};
_thisUnit = _this select 0;
_thisShooter = _this select 1;

sleep (random 1);
{[_x,_thisShooter] execVM "Engima\Traffic\Custom_GruppeAdler\fleeYouFool.sqf";} forEach crew (vehicle _thisUnit);
}];
};

Expand Down Expand Up @@ -121,7 +38,7 @@ createCivilianVehicle = {
_car1 = _this select 1;

_crewCargo = _grp1 createUnit ["C_man_1", _pos, [], 0, "CARGO"];
[_crewCargo] call addFleeingBehaviour;


[_crewCargo] call randomCivilian; // civilian loadout

Expand Down
51 changes: 51 additions & 0 deletions Engima/Traffic/Custom_GruppeAdler/fleeYouFool.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
_thisUnit = _this select 0;
_thisShooter = _this select 1;

deleteWaypoint [group _thisUnit, all];
_thisUnit unassignVehicle (vehicle _thisUnit);
_thisUnit leaveVehicle (vehicle _thisUnit);
_thisUnit disableAI "FSM";

_relDir = [_thisUnit,_thisShooter] call BIS_fnc_relativeDirTo;
_building = nearestObjects [_thisUnit, ["House", "Building"], 100] select 0;
if (!isNull _building) then {
_buildingPosition = [_building] call BIS_fnc_buildingPositions;
};


//hintSilent format ["%1",_bla select 0];
if (count _buildingPosition > 0) then {
_thisUnit setBehaviour "SAFE";
_pos = [_buildingPosition] call BIS_fnc_selectRandom;
_thisUnit doMove _pos;
_thisUnit setSpeedMode "FULL";
_thisUnit forceSpeed 25;
_thisUnit playMove "AmovPercMevaSnonWnonDf";
_thisUnit setVariable ["fleeing", "true"];
waitUntil {
_thisUnit distance _pos < 2
};

_thisUnit playMoveNow 'AinvPknlMstpSnonWnonDnon_1';
_thisUnit stop true;
_thisUnit disableAI "autoTarget";
_thisUnit disableAI "MOVE";
_thisUnit removeAllEventHandlers "FiredNear";

} else {
_pos = [_thisUnit,[5,20],_relDir-180] call SHK_pos;
_thisUnit doMove _pos;
_thisUnit setSpeedMode "FULL";
_thisUnit forceSpeed 20;
_thisUnit playMove "AmovPercMevaSnonWnonDf";
_thisUnit setVariable ["fleeing", "true"];
waitUntil {
_thisUnit distance _pos < 2
};

_thisUnit playMoveNow 'AinvPknlMstpSnonWnonDnon_1';
_thisUnit stop true;
_thisUnit disableAI "autoTarget";
_thisUnit disableAI "MOVE";
_thisUnit removeAllEventHandlers "FiredNear";
};
2 changes: 0 additions & 2 deletions Engima/Traffic/Custom_GruppeAdler/randomCivilian.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ _unit = _this select 0;

_rds_rhs_civilian = [
"rds_schoolteacher",
"rds_Functionary1",
"rds_Functionary2",
"rds_doctor",
"rds_uniform_assistant",
"rds_uniform_Worker1",
Expand Down
9 changes: 5 additions & 4 deletions Engima/Traffic/Server/Functions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -414,17 +414,18 @@ ENGIMA_TRAFFIC_StartTraffic = {
//_vehicleGroup = createGroup _side;
//_vehicle = createVehicle [_vehicleType, _pos, [], 0, "NONE"];
// Run spawn script and attach handle to vehicle
_vehicleArray = [[_pos,_vehicleType,_side] call createCivilianVehicle];
_vehicleArray = [_pos,_vehicleType,_side] call createCivilianVehicle;
// diag_log format ["vehicleArray I is %1",_vehicleArray];
waitUntil {count _vehicleArray > 0};
// diag_log format ["vehicleArray II is %1",_vehicleArray];
_vehicle = (_vehicleArray select 0) select 0;
diag_log format ["traffic: vehicle is %1",_vehicle];
diag_log format ["traffic: vehicle is %1",_vehicleArray];
_vehicle = _vehicleArray select 0;

//_result = [_pos, _direction, _vehicleType, _vehicleGroup] call BIS_fnc_spawnVehicle;

// = [_vehicleType] ... "createVehicle.sqf";

_vehicleGroup = (_vehicleArray select 0) select 1;
_vehicleGroup = _vehicleArray select 1;
_vehiclesCrew = units _vehicleGroup;


Expand Down
6 changes: 3 additions & 3 deletions mission.sqm
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class EditorData
class Camera
{
pos[]={1774.9253,30.5,5916.4663};
dir[]={0.22101833,-0.33330178,0.91655642};
up[]={0.078134224,0.94281745,0.32402021};
aside[]={0.97214341,3.328023e-008,-0.2344207};
dir[]={-0.1276442,-0.38921207,0.91226953};
up[]={-0.053933691,0.9211449,0.38546264};
aside[]={0.99036044,-6.3097104e-008,0.13857237};
};
};
binarizationWanted=0;
Expand Down
4 changes: 2 additions & 2 deletions server/spawnBluforHQ.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ spawnBluforHQ = {

/* listener to remove spawn pad and actionhelper, when its time */
BUY_OPTION_BLUFOR = {
if (_this select 0) exitWith {};
if (BUY_OPTION_BLUFOR) exitWith {};
detach usActionHelper;
deleteVehicle usActionHelper;
hideObjectGlobal US_SPAWN_PAD;
Expand Down Expand Up @@ -231,7 +231,7 @@ spawnOpforHQ = {

/* listener to remove spawn pad and actionhelper, when its time */
BUY_OPTION_OPFOR = {
if (_this select 0) exitWith {};
if (BUY_OPTION_OPFOR) exitWith {};
detach rusActionHelper;
deleteVehicle rusActionHelper;
hideObjectGlobal RUS_SPAWN_PAD;
Expand Down
12 changes: 4 additions & 8 deletions server/teleportListener.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,10 @@ _BLUFOR_TELEPORT_TARGET_listener = {
_pos = _this select 1;
publicVariable "BLUFOR_TELEPORT_TARGET";

sleep 2; // just to make sure no one is missed, send again (dirty fix for spawn prob?)
publicVariable "BLUFOR_TELEPORT_TARGET";

sleep 4;
publicVariable "BLUFOR_TELEPORT_TARGET";

sleep 8;
publicVariable "BLUFOR_TELEPORT_TARGET";
[] spawn {
sleep 2; // just to make sure no one is missed, send again (dirty fix for spawn prob?)
publicVariable "BLUFOR_TELEPORT_TARGET";
};
};


Expand Down

0 comments on commit cab8601

Please sign in to comment.