Alert23 215 Posted April 28, 2018 Hey Guys, im creating an mission and i want an exclamation mark to pop up above the enemys Head for a few seconds and this is what i got so far from i-net: { if (side _x == resistance && _x knowsAbout player < 1.5) then {addMissionEventHandler ["Draw3D", { pos = getPosWorld _x; drawIcon3D ["Exclamation.paa", [0.9,0,0,1], [(_pos select 0),(_pos select 1), 2], 1, 1, 0, (name _x), 0, 0, ""]; }]; }; } foreach AllUnits; its not working maybe some of you could help. Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted April 28, 2018 38 minutes ago, Alert23 said: Hey Guys, im creating an mission and i want an exclamation mark to pop up above the enemys Head for a few seconds and this is what i got so far from i-net: { if (side _x == resistance && _x knowsAbout player < 1.5) then {addMissionEventHandler ["Draw3D", { pos = getPosWorld _x; drawIcon3D ["Exclamation.paa", [0.9,0,0,1], [(_pos select 0),(_pos select 1), 2], 1, 1, 0, (name _x), 0, 0, ""]; }]; }; } foreach AllUnits; its not working maybe some of you could help. Go through it again, might not be obvious at first glance. You're using _x inside the addMissionEventHandler, where it doesn't exist, since it's another scope. Also this would add an eventhandler for every unit, which is considered bad practice (bad for performance) when you can simply use one eventhandler and make this single eventhandler do all the work. You're also using "pos" and "_pos", which will throw another error. This should work, as long as "Exclamation.paa" exists: addMissionEventHandler ["Draw3D", { { if (side _x == resistance && _x knowsAbout player < 1.5) then { _pos = getPosWorld _x; drawIcon3D ["Exclamation.paa", [0.9,0,0,1], [(_pos select 0),(_pos select 1), 2], 1, 1, 0, (name _x), 0, 0, ""]; } } foreach AllUnits; }]; Cheers 2 2 Share this post Link to post Share on other sites
Alert23 215 Posted April 28, 2018 thanks this works but somehow i get an massage saying: Quote Cannot load texture Exclamation.paa but it exists in the mission folder. Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted April 28, 2018 3 minutes ago, Alert23 said: thanks this works but somehow i get an massage saying: but it exists in the mission folder. That's because drawIcon3d has no clue about the mission path. Follow KKs comment on how to get it working with mission root images. Cheers 1 1 Share this post Link to post Share on other sites
HazJ 1288 Posted April 28, 2018 You can also use this one: \A3\ui_f\data\map\markers\military\warning_CA.paa 1 Share this post Link to post Share on other sites
Alert23 215 Posted April 28, 2018 (edited) thanks both of you this works good. running this from init: addMissionEventHandler ["Draw3D", { { if (side _x == resistance && _x knowsAbout player > 1.5) then { _pos = getPosWorld _x; drawIcon3D ["\A3\ui_f\data\map\markers\military\warning_CA.paa", [0.9,0,0,1], [(_pos select 0),(_pos select 1), 2], 1, 1, 0, (name _x), 0, 0, ""]; } } foreach AllUnits; }]; but how would i delete the drawIcon3D after x seconds? nvm: using removeMissionEventHandler solved the problem Edited April 28, 2018 by Alert23 Solved Share this post Link to post Share on other sites
Alert23 215 Posted April 29, 2018 Sry guys if im asking too much but rly trying already hours without success. The script below works good: addMissionEventHandler ["Draw3D", { { if (side _x == resistance && _x knowsAbout player > 1.5) then {_pos = getPosWorld _x; drawIcon3D ["C:\Users\blabla\Documents\Arma 3\missions\metalgearsolid1.Altis\texture\mgsalert1.paa", [0.9,0,0,1], [(_pos select 0),(_pos select 1), 4.5], 1, 1, 0, (name _x), 0, 0, ""]; } }foreach allUnits; }]; But how would i change it so that the DrawIcon3D only pops up on the enemy Who saw/detected the player, i assume its because of the foreach command. Because right now the Icon appears on every enemy even if only one enemy spotted the player. And would it be possible to add an IF eyepos condition like if (side _x == resistance && _x eyepos player && _x distance player < 25) then making the DrawIcon3D Eventhandler only fire if the enemy is facing the players direction/seeing him, because i found out that knowsabout isent really reliable. Thank You in Advance. Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted April 29, 2018 1 hour ago, Alert23 said: Sry guys if im asking too much but rly trying already hours without success. The script below works good: addMissionEventHandler ["Draw3D", { { if (side _x == resistance && _x knowsAbout player > 1.5) then {_pos = getPosWorld _x; drawIcon3D ["C:\Users\blabla\Documents\Arma 3\missions\metalgearsolid1.Altis\texture\mgsalert1.paa", [0.9,0,0,1], [(_pos select 0),(_pos select 1), 4.5], 1, 1, 0, (name _x), 0, 0, ""]; } }foreach allUnits; }]; But how would i change it so that the DrawIcon3D only pops up on the enemy Who saw/detected the player, i assume its because of the foreach command. Because right now the Icon appears on every enemy even if only one enemy spotted the player. And would it be possible to add an IF eyepos condition like if (side _x == resistance && _x eyepos player && _x distance player < 25) then making the DrawIcon3D Eventhandler only fire if the enemy is facing the players direction/seeing him, because i found out that knowsabout isent really reliable. Thank You in Advance. How can your snippet work if you pass an empty string as font parameter? This way, it won't display "name _x". Take a read at the wiki and go through each parameter... Target knowledge is shared among all units inside a group. As of now once a single unit knows about a target, every other group member shares the same knowsabout value, almost instantly, even faster than one frames runtime. It's even impossible to tell which unit spotted the target, without doing additional line of sight checks and whatnot. No idea why BI went down that road. Having AI units inform others about targets would add a more authentic notch to it instead of this instant reaction time nonsense we have now. knowsAbout is reliable, it's just the wrong command for what you're trying to do. This will draw the icon if the unit has spotted the player within the last 5 seconds or the player is still within 25m of the last position he has been spotted by that unit: addMissionEventHandler ["Draw3D", { { _knowledge = _x targetKnowledge player; _knowledge params ["_groupKnows","_unitKnows","_lastSpotted","_lastThreatened","_targetSide","_posError","_spottedPos"]; systemchat str _lastSpotted; _timeSinceLastSpot = round time - _lastSpotted; if (side _x == resistance && (_timeSinceLastSpot < 5 OR (_spottedPos distance player < 25))) then { _pos = _x modelToWorldVisual [0,0,2.5]; drawIcon3D ["\A3\ui_f\data\map\markers\military\warning_CA.paa", [0.9,0,0,1], _pos, 1, 1, 0, name _x]; } } foreach AllUnits; }]; Cheers 1 Share this post Link to post Share on other sites
Alert23 215 Posted April 29, 2018 2 hours ago, Grumpy Old Man said: How can your snippet work if you pass an empty string as font parameter? This way, it won't display "name _x". Take a read at the wiki and go through each parameter... Target knowledge is shared among all units inside a group. As of now once a single unit knows about a target, every other group member shares the same knowsabout value, almost instantly, even faster than one frames runtime. It's even impossible to tell which unit spotted the target, without doing additional line of sight checks and whatnot. No idea why BI went down that road. Having AI units inform others about targets would add a more authentic notch to it instead of this instant reaction time nonsense we have now. knowsAbout is reliable, it's just the wrong command for what you're trying to do. This will draw the icon if the unit has spotted the player within the last 5 seconds or the player is still within 25m of the last position he has been spotted by that unit: addMissionEventHandler ["Draw3D", { { _knowledge = _x targetKnowledge player; _knowledge params ["_groupKnows","_unitKnows","_lastSpotted","_lastThreatened","_targetSide","_posError","_spottedPos"]; systemchat str _lastSpotted; _timeSinceLastSpot = round time - _lastSpotted; if (side _x == resistance && (_timeSinceLastSpot < 5 OR (_spottedPos distance player < 25))) then { _pos = _x modelToWorldVisual [0,0,2.5]; drawIcon3D ["\A3\ui_f\data\map\markers\military\warning_CA.paa", [0.9,0,0,1], _pos, 1, 1, 0, name _x]; } } foreach AllUnits; }]; Cheers thank you for your help, i found THIS on the forums would it be possible to add it to the condition? like: if (side _x == resistance && [_x, "VIEW"] checkVisibility [eyepos _x, eyepos player] > 0 && (_timeSinceLastSpot < 2 OR (_spottedPos distance player < 25))) then { Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted April 29, 2018 59 minutes ago, Alert23 said: thank you for your help, i found THIS on the forums would it be possible to add it to the condition? like: if (side _x == resistance && [_x, "VIEW"] checkVisibility [eyepos _x, eyepos player] > 0 && (_timeSinceLastSpot < 2 OR (_spottedPos distance player < 25))) then { Should work, why not? Best think about what you want it to do in terms of functionality, brainstorm a bit, then post the actual thread/question. In your first post you just wanted an exclamation mark to pop up. Then you wanted it to only show for N seconds. Now all of a sudden you need line of sight checks and whatnot. Since you wanted to only display the exclamation mark if the unit has spotted the player I'd skip visibility checks. Unless you want it for something different. Cheers Share this post Link to post Share on other sites
Alert23 215 Posted April 29, 2018 Sry for that, but anyway thanks for your help. really appreciate it. =) Share this post Link to post Share on other sites