phronk 898 Posted June 22, 2016 My situation is that I'm working with an ambient civilian spawning script and they patrol around randomly. What I want to do is make it so that if a civilian detects a unit (player/blufor unit), then that individual civilian will walk to the position of that player. This is for a multiplayer mission. My issue is that I don't know how to get an individual unit's known targets list or whatever you wanna call it. Maybe I'm dumb, but I tried using the "knowsAbout" command and it seems to execute on all spawned units rather than the individual unit. Maybe remove the unit from his group and assign the waypoint? I also don't want to use the "if the player is in x range of the civ, then tell the civ to move to the player" method, because I'd like the player to sneak around even at close ranges. If I'm not being clear enough in what I need help with, I can try to clarify. Share this post Link to post Share on other sites
kylania 568 Posted June 22, 2016 nearTargets might be helpful. Share this post Link to post Share on other sites
P0ngY 0 Posted June 22, 2016 probably not the place to ask but why cant i post on the forum? do i need to wait? (new account) Share this post Link to post Share on other sites
kylania 568 Posted June 22, 2016 probably not the place to ask but why cant i post on the forum? do i need to wait? (new account) Need to post some amount before you can start threads. While you're here might as well ask whatever question you have though. :) Share this post Link to post Share on other sites
tryteyker 28 Posted June 22, 2016 If you want civilians to move to the players position on their own they'll have to be in their own group, as knowsAbout 'elevates' the query to group level instead of individual units. You could write up a function which basically iterates through nearTargets (as kylania mentioned) and then checks the targets' knowsAbout value. The thing with nearTargets is that it's already based on knowsAbout, so the position is only an approximate. Personally I'd use that position instead of the current player position, makes it somewhat better. Just to give you an idea I've thrown together some code, about to head to work so it's not going to work: fn_checkForTargets = { _targetList = _this select 0; // nearTargets value _player = _this select 1; // Player unit _civ = _this select 2; // Civilian _targetPos = []; // Will return this later for "_i" from 0 to (count _targetList) - 1 do { private ["_currentTarget","_currentTargetPos"]; _currentTarget = _targetList select _i; _currentTargetPos = _currentTarget select 0; // Assumed position value if (_civ knowsAbout _currentTarget > 0.5) exitWith { // Somewhat arbitrary value, will have to test. nearTargets only includes recognized targets which means there's a min knowsAbout value too, just don't know it. _targetPos = _currentTargetPos; }; } _targetPos; }; You get the idea, hopefully. Share this post Link to post Share on other sites
kylania 568 Posted June 22, 2016 Speaking of knows about, I was messing with a trigger earlier which setcaptive false on me. There was a sentry group in my face, a sniper pair about 100m away and a full squad another 50m beyond them. All mostly looking away from me. When the trigger went off the squad and snipers instantly turned to kill me, but the two guys who set off the trigger didn't even glance my way. I had to reveal at 3 knowsAbout before they'd realize i was there and a threat now. Odd. Share this post Link to post Share on other sites
Greenfist 1863 Posted June 22, 2016 targetKnowledge might help. civilian1 targetKnowledge player select 2 > 0 // returns true if player has been seen Of course, when you have multiple civilians and players, you'd have to iterate through all civs and check against the players. 1 Share this post Link to post Share on other sites
jcae2798 132 Posted June 22, 2016 I found a script below that i use for suicide bomber. Might work or help get what you want? Also instead or knowing about a target, put a distance check instead like below? While {alive _bomber} do { _nearest = objNull; _nearestdist = _targetdistance; { _dist= vehicle _x distance _bomber; if (_dist < _nearestdist) then { _nearest= _x; _nearestdist = _dist; }; } forEach playableunits; if (!isNull _nearest) then { _bomber move getPos _nearest; sleep (random 10); _bomber addrating -99999; _bomber setCaptive false; if ((_bomber distance _nearest)< 5) then { _detonated = 1; _bomber setCaptive false; _bomber say ["AllahuAckar", 40]; //If sound is enabled sleep 1.5; _bomb = "R_60mm_HE" createVehicle getPos _bomber; //_bomb = "Bomb_03_F" createVehicle getPos _bomber; //deleteVehicle _expl; }; } else { _bomber moveTo getPos _bomber; sleep 1; }; sleep 2; }; Share this post Link to post Share on other sites
phronk 898 Posted June 22, 2016 The targetKnowledge method (with a distance check included) seemed to do the trick. Thanks guys! Share this post Link to post Share on other sites