PDA

View Full Version : check side of unit, then check knowsabout of enemyside groups?



Igneous01
Dec 24 2010, 06:37
so ive searched and found this :
http://forums.bistudio.com/showthread.php?t=102376&highlight=knowsAbout+side

EDIT ************ SOLVED

so after alot of tinkering i managed to finally solve this. If anyone is interested in getting something similar to work here is a function i created, that works alot like a trigger that detects if an enemy is spotted, regardless of what side that unit is on (supports east/west only) it automatically updates the scanning area for enemies when the unit moves.



if (isnil "FNC_DZ_Spooked") then {
FNC_DZ_Spooked = {
private ["_unit", "_unitgroup", "_unitside", "_enemygroups", "_enemy"];
_unit = _this select 0;
_unitgroup = group _unit;
_unitside = side _unit;

// Check Faction of unit, and consider all groups that are enemy of him
switch (_unitside) do {
case EAST: {
player sidechat "Enemy is WEST";
_enemy = west;
};
case WEST: {
player sidechat "Enemy is EAST";
_enemy = east;
};
};

// update area and check for units
while {alive _unit} do {
_enemygroups = nearestObjects [getpos _unit, ["Man","Tank", "Air", "Car"], 500];
{if (side _x == _enemy) then {
if (_unitgroup knowsabout _x > 0.5) then {
// "WHATEVER U WANT TO ACTIVATE HERE"
};
};
} forEach _enemygroups;
sleep 5;
};
};
};



to use it:

[unitnamehere] call FNC_DZ_Spooked

or you can spawn it as well if u want to have multiple units check for enemy surroundings.

Igneous01
Dec 24 2010, 21:20
problem solved, see script above if u want something similar