Sneax x 4 Posted November 3, 2019 Hi, i got the following drawIcon3D script that shows the players names above their heads: onEachFrame { _units = nearestObjects[(visiblePosition player),["Man"], 17]; _units = _units; { _color = switch (playerSide) do { case (EAST): {[1,0,0,1]}; case (WEST): {[0,0,1,1]}; case (independent): {[0,1,0,1]}; case default {[2.55,0.55,0,10]}; }; if (side _x isEqualto playerSide) then { if (!(lineIntersects [getPos player, getPos _x, player, _x]) && alive _x) then { drawIcon3D [ "", _color, [visiblePosition _x select 0,visiblePosition _x select 1, (visiblePosition _x select 2) +((_x ModelToWorld (_x selectionPosition "player")) select 2)+ 1.83], 45, -2, -1, name _x, 2, 0.035, "Puristamedium", "center" ]; }; }; }forEach _units; }; the problem: this shows also the names thought objects where i cant see the player normaly... how can i fix this? also it would be nice if my enime is in a car i would see his name above the car (not works now). Thx for your answer's 😄 Share this post Link to post Share on other sites
pierremgi 4913 Posted November 3, 2019 lineIntersect commands wait for ASL position. Try with lineIntersectsSurfaces (count = 0) _units = nearestObjects[(visiblePosition player),["Man"], 17]; is not the best code for your aim and performance. Try _units = player nearEntities [["CAManBase","air","landVehicle","ship"], 17]; instead 1 Share this post Link to post Share on other sites
POLPOX 779 Posted November 4, 2019 checkVisibility will do the trick also. 1 Share this post Link to post Share on other sites
Sneax x 4 Posted November 4, 2019 Thx for your answere ! but it didnt changed something on the problem with the wall, also i can see players names if they are in a vehicle but if i get out i cant see their names if they are still in the vehicle, you have any other idears? now the script looks like: onEachFrame { _units = player nearEntities [["CAManBase","air","landVehicle","ship"], 17]; _units = _units; { _color = switch (playerSide) do { case default {[2.55,0.55,0,10]}; }; if (side _x isEqualto playerSide) then { if (!( lineIntersects [getPos player, getPos _x, player, _x]) && alive _x) then { drawIcon3D [ "", _color, [visiblePosition _x select 0,visiblePosition _x select 1, (visiblePosition _x select 2) +((_x ModelToWorld (_x selectionPosition "player")) select 2)+ 1.83], 45, -2, -1, name _x, 2, 0.035, "Puristamedium", "center" ]; }; }; }forEach _units; }; @POLPOX i have no idea how i can add a checkVisibility pram to this thx for your help! (lineIntersectsSurfaces (count = 0) didnt worked... allways called a error) Share this post Link to post Share on other sites
pierremgi 4913 Posted November 4, 2019 2 hours ago, Sneax x said: Thx for your answere ! but it didnt changed something on the problem with the wall, also i can see players names if they are in a vehicle but if i get out i cant see their names if they are still in the vehicle, you have any other idears? (lineIntersectsSurfaces (count = 0) didnt worked... allways called a error) Sure lineIntersectsSurfaces (count = 0) never worked as is. That demands a little reading on Biki. Same for ASL positions, you don't understand. try: onEachFrame { _units = player nearEntities [["CAManBase","air","landVehicle","ship"], 17]; _units = _units - [player]; { _color = switch (playerSide) do { case (EAST): {[1,0,0,1]}; case (WEST): {[0,0,1,1]}; case (independent): {[0,1,0,1]}; case default {[2.55,0.55,0,10]}; }; if (side _x isEqualto playerSide) then { if (([player,"view", _x] checkVisibility [eyePos player,getPosASL vehicle _x])>0 && alive _x) then { drawIcon3D [ "", _color, [visiblePosition _x select 0,visiblePosition _x select 1, (visiblePosition _x select 2) +((_x ModelToWorld (_x selectionPosition "player")) select 2)+ 1.83], 45, -2, -1, name _x, 2, 0.035, "Puristamedium", "center" ]; }; }; }forEach _units; }; 1 Share this post Link to post Share on other sites
Sneax x 4 Posted November 5, 2019 Thank you very much @pierremgi! works fine Share this post Link to post Share on other sites
Sneax x 4 Posted November 8, 2019 hey... i played a lot with this and the problem is: this only checkVisibility from eyePos player.. how can i change it to third person player cam? i tryed with !( lineIntersects [ AGLToASL positionCameraToWorld[ 0, 0, 0 ], eyePos _units, cameraOn, _units ]) but it is not working! Share this post Link to post Share on other sites
pierremgi 4913 Posted November 8, 2019 [player,"view", _x] checkVisibility [AGLToASL positionCameraToWorld[ 0, 0, 0 ],getPosASL vehicle _x] works fine imho. Share this post Link to post Share on other sites
Sneax x 4 Posted November 8, 2019 No sry dont works Share this post Link to post Share on other sites
pierremgi 4913 Posted November 8, 2019 I don't know why you say that. I have no problem with that. Don't forget, the 3rd view camera is behind the unit played. So, when you turn the head, your camera moves but the script does exactly what it's intended to do. After that, I probably don't understand your final aim. Share this post Link to post Share on other sites
Sneax x 4 Posted November 8, 2019 I dont know why... know how it with 3rd view works... could you please send me your complett script? maybe i replaced something wrong? my looks: onEachFrame { _units = player nearEntities [["CAManBase","air","landVehicle","ship"], 17]; _units = _units - [player]; { _color = switch (playerSide) do { case (EAST): {[1,0,0,1]}; case (WEST): {[0,0,1,1]}; case (independent): {[0,1,0,1]}; case default {[2.55,0.55,0,10]}; }; if (side _x isEqualto playerSide) then { if (([player,"view", _x] checkVisibility [AGLToASL positionCameraToWorld[ 0, 0, 0 ],getPosASL vehicle _x])>0 && alive _x) then { drawIcon3D [ "", _color, [visiblePosition _x select 0,visiblePosition _x select 1, (visiblePosition _x select 2) +((_x ModelToWorld (_x selectionPosition "player")) select 2)+ 1.83], 45, -2, -1, name _x, 2, 0.035, "Puristamedium", "center" ]; }; }; }forEach _units; }; and it is not working! Picture Share this post Link to post Share on other sites
pierremgi 4913 Posted November 10, 2019 onEachFrame { _units = player nearEntities [["CAManBase","air","landVehicle","ship"], 17]; _units = _units - [player]; { _color = switch (playerSide) do { case (EAST): {[1,0,0,1]}; case (WEST): {[0,0,1,1]}; case (independent): {[0,1,0,1]}; case default {[2.55,0.55,0,10]}; }; if (side _x isEqualto playerSide) then { if (([player,"view", _x] checkVisibility [AGLToASL positionCameraToWorld[0,0,0],getPosASL vehicle _x])>0) then { drawIcon3D [ "", _color, [visiblePosition _x select 0,visiblePosition _x select 1, (visiblePosition _x select 2) +((_x ModelToWorld (_x selectionPosition "player")) select 2)+ 1.83], 45, -2, -1, name _x, 2, 0.035, "Puristamedium", "center" ]; }; }; }forEach _units; }; But, you can use the stackable version: ["myCodeForTags", "onEachFrame", { _units = player nearEntities [["CAManBase","air","landVehicle","ship"], 17]; _units = _units - [player]; { _color = switch (playerSide) do { case (EAST): {[1,0,0,1]}; case (WEST): {[0,0,1,1]}; case (independent): {[0,1,0,1]}; case default {[2.55,0.55,0,10]}; }; if (side _x isEqualto playerSide) then { if (([player,"view", _x] checkVisibility [AGLToASL positionCameraToWorld[0,0,0],getPosASL vehicle _x])>0) then { drawIcon3D [ "", _color, [visiblePosition _x select 0,visiblePosition _x select 1, (visiblePosition _x select 2) +((_x ModelToWorld (_x selectionPosition "player")) select 2)+ 1.83], 45, -2, -1, name _x, 2, 0.035, "Puristamedium", "center" ]; }; }; }forEach _units; }] call BIS_fnc_addStackedEventHandler; 2 Share this post Link to post Share on other sites
killzone_kid 1333 Posted November 10, 2019 _x selectionPosition "player" would be [0,0,0], the same as any non existent selection. So basically the whole (visiblePosition _x select 2) +((_x ModelToWorld (_x selectionPosition "player")) select 2)+ 1.83 is just (visiblePosition _x select 2) + 1.83 2 Share this post Link to post Share on other sites
Sneax x 4 Posted November 11, 2019 Thank you very much now its working! @pierremgi Share this post Link to post Share on other sites
pierremgi 4913 Posted November 11, 2019 I duno why, sometimes there are invisible unwanted characters in forum editor. Copying/pasting can fail and throw errors in Arma. Usually, in debug console or other editor, you can track them moving the cursor. This one seems to stay twice at a character, while scanning the code. You can remove them. But that could be nice if this problem would be solved here. 1 Share this post Link to post Share on other sites
Sneax x 4 Posted November 12, 2019 Yes thats true... i have noticed that too Share this post Link to post Share on other sites