greenpeacekiller 14 Posted April 22, 2018 Does anybody know if its possible to have markers appear / dissapear when zooming in like Bohiema did with one of it's mission. I'm trying to make this work in multiplayer I've found a few topics explaining certain possibilties but I've been unable to implement it properly so far. Heres the links: http://www.armaholic.com/forums.php?m=posts&q=28864 If anyone has a explanation for me it would be very much appriciated Share this post Link to post Share on other sites
stanhope 411 Posted April 22, 2018 18 minutes ago, greenpeacekiller said: Does anybody know if its possible to have markers appear / dissapear when zooming in like Bohiema did with one of it's mission. They might have used this: https://community.bistudio.com/wiki/ctrlMapScale And based upon that return value hidden or shown the markers. I haven't tried anything like this ever myself tho so that's about all the help i can give you. Share this post Link to post Share on other sites
HazJ 1289 Posted April 22, 2018 This works with drawIcon, not sure about normal markers (createMarker). Though if it doesn't then you can use mouse/scroll EHs when map is open then adjust size (setMarkerSize) or whatever as you wish. https://community.bistudio.com/wiki/User_Interface_Event_Handlers#onMouseZChanged Share this post Link to post Share on other sites
greenpeacekiller 14 Posted April 23, 2018 How would I go about putting this together? Sorry for the lack of effort but I do not understand ArmA's scripting language enough to format anything readable together for the engine. Share this post Link to post Share on other sites
HazJ 1289 Posted April 23, 2018 I am currently at work but I will try and get time to put something together later. No promises. Are you using drawIcon or createMarker? Share this post Link to post Share on other sites
greenpeacekiller 14 Posted April 23, 2018 Would it be possible to use have pre-placed markers and then use SetMarkerAlpha to hide/un-hide them when players zoom in / out? This way I could just stack them all in a array and make the process more simple for me Share this post Link to post Share on other sites
HazJ 1289 Posted April 23, 2018 Yes, sure. I will try and put something together this late evening when I get home. Again, no promises. Share this post Link to post Share on other sites
Larrow 2820 Posted April 23, 2018 //initPlayerLocal.sqf waitUntil { !isNull ( uiNamespace getVariable [ "RscDiary", displayNull ] ) }; uiNamespace getVariable "RscDiary" displayCtrl 51 ctrlAddEventHandler [ "MouseZChanged", { params[ "_ctrl" ]; _markerShowMinMax = [ 0.01, 0.5 ]; _zoom = ctrlMapScale _ctrl; _show = _zoom > ( _markerShowMinMax select 0 ) && _zoom < ( _markerShowMinMax select 1 ); { _x setMarkerAlphaLocal ( parseNumber _show ); }forEach allMapMarkers; }]; Where min/max can range from 0.001 to 1. 2 Share this post Link to post Share on other sites
greenpeacekiller 14 Posted April 23, 2018 19 minutes ago, Larrow said: //initPlayerLocal.sqf waitUntil { !isNull ( uiNamespace getVariable [ "RscDiary", displayNull ] ) }; uiNamespace getVariable "RscDiary" displayCtrl 51 ctrlAddEventHandler [ "MouseZChanged", { params[ "_ctrl" ]; _markerShowMinMax = [ 0.01, 0.5 ]; _zoom = ctrlMapScale _ctrl; _show = _zoom > ( _markerShowMinMax select 0 ) && _zoom < ( _markerShowMinMax select 1 ); { _x setMarkerAlphaLocal ( parseNumber _show ); }forEach allMapMarkers; }]; Where min/max can range from 0.001 to 1. Very nice Larrow. I am replacing allMapMarkers with an array _x setMarkerAlphaLocal ( parseNumber _show ); }forEach ["marker1","marker2"]; How do I make it so that while this array is hidden by _show = _zoom > ( _markerShowMinMax select 0 ) && _zoom < ( _markerShowMinMax select 1 ); A new array has the opposite effect and is now revealed? Share this post Link to post Share on other sites
Larrow 2820 Posted April 23, 2018 _x setMarkerAlpha ( parseNumber !_show ); Your likely need to adjust the wait as well. The display during the briefing is also known as RscDairy yet is a different display to the in game map screen, so... waitUntil { time > 0 && { !isNull ( uiNamespace getVariable [ "RscDiary", displayNull ] ) } }; 1 Share this post Link to post Share on other sites
HazJ 1289 Posted April 23, 2018 Damn you @Larrow! I just did this haha. Should of looked at thread first. Yours is better anyway. // alpha example markersArr = [ "marker_0", "marker_1", "marker_2", "marker_3" ]; (findDisplay 12) displayAddEventHandler ["MouseZChanged", { params ["_display", "_scroll"]; _scale = ctrlMapScale ((findDisplay 12) displayCtrl 51); hintSilent format [":: %1", _scale]; { if (_scale > 0.8) then { _x setMarkerAlpha 0.10; } else { _x setMarkerAlpha (1.001 - _scale); }; } forEach markersArr; }]; // size example markersArr = [ "marker_0", "marker_1", "marker_2", "marker_3" ]; (findDisplay 12) displayAddEventHandler ["MouseZChanged", { params ["_display", "_scroll"]; _scale = ctrlMapScale ((findDisplay 12) displayCtrl 51); hintSilent format [":: %1", _scale]; { _x setMarkerSize [(1.001 - _scale), (1.001 - _scale)]; if (_scale >= 0.8) then { _x setMarkerSize [0.3, 0.3]; }; } forEach markersArr; }]; Share this post Link to post Share on other sites
greenpeacekiller 14 Posted April 23, 2018 5 minutes ago, HazJ said: Damn you @Larrow! I just did this haha. Should of looked at thread first. Yours is better anyway. // alpha example markersArr = [ "marker_0", "marker_1", "marker_2", "marker_3" ]; (findDisplay 12) displayAddEventHandler ["MouseZChanged", { params ["_display", "_scroll"]; _scale = ctrlMapScale ((findDisplay 12) displayCtrl 51); hintSilent format [":: %1", _scale]; { if (_scale > 0.8) then { _x setMarkerAlpha 0.10; } else { _x setMarkerAlpha (1.001 - _scale); }; } forEach markersArr; }]; // size example markersArr = [ "marker_0", "marker_1", "marker_2", "marker_3" ]; (findDisplay 12) displayAddEventHandler ["MouseZChanged", { params ["_display", "_scroll"]; _scale = ctrlMapScale ((findDisplay 12) displayCtrl 51); hintSilent format [":: %1", _scale]; { _x setMarkerSize [(1.001 - _scale), (1.001 - _scale)]; if (_scale >= 0.8) then { _x setMarkerSize [0.3, 0.3]; }; } forEach markersArr; }]; I do like the way this one slowly fades the markers Also sorry for my extreme lack of knowledge but how do I properly add _x setMarkerAlpha ( parseNumber !show ); Into the script? I tried { _x setMarkerAlphaLocal ( parseNumber _show ); } forEach ["marker1","marker2"]; { _x setMarkerAlphaLocal ( parseNumber !show ); } forEach ["marker3","marker4"]; But arma is laughing at me :( Share this post Link to post Share on other sites
HazJ 1289 Posted April 23, 2018 For the one I did? It should fade already? Share this post Link to post Share on other sites
Larrow 2820 Posted April 23, 2018 2 minutes ago, greenpeacekiller said: But arma is laughing at me :( Sorry missed the underscore on show. Edited previous post with correction. 1 Share this post Link to post Share on other sites
greenpeacekiller 14 Posted April 23, 2018 3 minutes ago, HazJ said: For the one I did? It should fade already? Yes, I know thats what I said: The fade looks very nice :3 Kinda wish I could implement it into Larrow's version 2 minutes ago, Larrow said: Sorry missed the underscore on show. Edited previous post with correction. Ah cool, I am slightly less terrible than I thought. Many thanks for this! 1 Share this post Link to post Share on other sites
greenpeacekiller 14 Posted April 23, 2018 Any way we could add like a fade between the transitions rather than them being instant. like HazJ did ? I think it would be a nice final touch to make it look smooth Share this post Link to post Share on other sites
Larrow 2820 Posted April 23, 2018 //initPlayerLocal.sqf waitUntil { !isNull ( uiNamespace getVariable [ "RscDiary", displayNull ] ) }; uiNamespace getVariable "RscDiary" displayCtrl 51 ctrlAddEventHandler [ "MouseZChanged", { params[ "_ctrl" ]; _zoom = ctrlMapScale _ctrl; { _markerShowMinMax = [ 0.1, 0.2 ]; _markerFadeMinMax = [ 0.05, 0.5 ]; _lower = linearConversion[ _markerShowMinMax select 0, _markerFadeMinMax select 0, _zoom, 1, 0, true ]; _upper = linearConversion[ _markerShowMinMax select 1, _markerFadeMinMax select 1, _zoom, 1, 0, true ]; _fade = _lower min _upper; _x setMarkerAlpha _fade; }forEach [ "marker_1", "marker_2", "marker_3", "marker_4", "marker_5" ]; { _markerShowMinMax = [ 0.5, 0.7 ]; _markerFadeMinMax = [ 0.25, 1 ]; _lower = linearConversion[ _markerShowMinMax select 0, _markerFadeMinMax select 0, _zoom, 1, 0, true ]; _upper = linearConversion[ _markerShowMinMax select 1, _markerFadeMinMax select 1, _zoom, 1, 0, true ]; _fade = _lower min _upper; _x setMarkerAlpha _fade; }forEach [ "marker_6", "marker_7", "marker_8", "marker_9", "marker_10" ]; }]; So markers 1-5 will start to fade in at 0.05, be at full alpha from 0.1 - 0.2, then fade out to 0.5 based on map scale. Thrown together quickly so I'm sure something better could be made, you will need to play with the numbers. 1 Share this post Link to post Share on other sites
greenpeacekiller 14 Posted April 23, 2018 20 minutes ago, Larrow said: //initPlayerLocal.sqf waitUntil { !isNull ( uiNamespace getVariable [ "RscDiary", displayNull ] ) }; uiNamespace getVariable "RscDiary" displayCtrl 51 ctrlAddEventHandler [ "MouseZChanged", { params[ "_ctrl" ]; _zoom = ctrlMapScale _ctrl; { _markerShowMinMax = [ 0.1, 0.2 ]; _markerFadeMinMax = [ 0.05, 0.5 ]; _lower = linearConversion[ _markerShowMinMax select 0, _markerFadeMinMax select 0, _zoom, 1, 0, true ]; _upper = linearConversion[ _markerShowMinMax select 1, _markerFadeMinMax select 1, _zoom, 1, 0, true ]; _fade = _lower min _upper; _x setMarkerAlpha _fade; }forEach [ "marker_1", "marker_2", "marker_3", "marker_4", "marker_5" ]; { _markerShowMinMax = [ 0.5, 0.7 ]; _markerFadeMinMax = [ 0.25, 1 ]; _lower = linearConversion[ _markerShowMinMax select 0, _markerFadeMinMax select 0, _zoom, 1, 0, true ]; _upper = linearConversion[ _markerShowMinMax select 1, _markerFadeMinMax select 1, _zoom, 1, 0, true ]; _fade = _lower min _upper; _x setMarkerAlpha _fade; }forEach [ "marker_6", "marker_7", "marker_8", "marker_9", "marker_10" ]; }]; So markers 1-5 will start to fade in at 0.05, be at full alpha from 0.1 - 0.2, then fade out to 0.5 based on map scale. Thrown together quickly so I'm sure something better could be made, you will need to play with the numbers. Very beautiful. Thanks once more Share this post Link to post Share on other sites
greenpeacekiller 14 Posted April 23, 2018 I've encountered an issue when testing this on a dedicated server. It seems that inside the lobby where you have the map screen, this works without problem. (on some clients) However, once you load in-game, the script no longer works. (On the majority of clients) Any idea what to do? Share this post Link to post Share on other sites
Larrow 2820 Posted April 23, 2018 12 minutes ago, greenpeacekiller said: It seems that inside the lobby where you have the map screen, this works without problem. (on some clients) However, once you load in-game, the script no longer works. (On the majority of clients) 3 hours ago, Larrow said: Your likely need to adjust the wait as well. The display during the briefing is also known as RscDairy yet is a different display to the in game map screen, so... waitUntil { time > 0 && { !isNull ( uiNamespace getVariable [ "RscDiary", displayNull ] ) } }; If you want it to display on both map screens then you will need to run it twice. Once when a client joins and is looking at the briefing screen and again once the mission has started. As previously mentioned they are two different displays yet are both known as RscDiary and depending on when your get the reference from uinamespace will depend on the display returned. Move the marker script to its own file then use getClientState to know when to run it for each correct display. 1 Share this post Link to post Share on other sites
HazJ 1289 Posted April 23, 2018 Try adding this before: waitUntil {!isNull player && player == player}; waitUntil {!isNull (findDisplay 46)}; EDIT: Never mind. See post above. Though sometimes it is good to wait until a display is initialised, depending on the situation. Share this post Link to post Share on other sites
greenpeacekiller 14 Posted April 23, 2018 12 hours ago, Larrow said: If you want it to display on both map screens then you will need to run it twice. Once when a client joins and is looking at the briefing screen and again once the mission has started. As previously mentioned they are two different displays yet are both known as RscDiary and depending on when your get the reference from uinamespace will depend on the display returned. Move the marker script to its own file then use getClientState to know when to run it for each correct display. Can I move the marker script in its own file and then excute it via initplayerlocal for when new players join the servers? I tested it on the dedicated server and it worked for me so far. Im not sure if it still works for a new player when he enters the server EDIT: Just ran a test with 2 clients When the script is excuted and a new client enters the server, the script will not work on the new client. So I need to excute it each time someone enters the server? or locally for the client that joins EDIT 2: I tried using getClientState but really I have no idea what to do with this command or how to get it to work. I used the example bohiema provided to try and get a hint displayed but no luck there Share this post Link to post Share on other sites
HazJ 1289 Posted April 23, 2018 Hmm. What is RscDiary? That the map for briefing screen? If so, that will hang since JIP doesn't get the briefing screen since mission starts. If I have understood correctly. Share this post Link to post Share on other sites
Larrow 2820 Posted April 24, 2018 //initPlayerLocal.sqf params[ "_player", "_didJIP" ]; _fnc_applyMarkerFades = { //place eventHandler from previous post in here //uiNamespace getVariable ....... }; if !( _didJIP ) then { //MP and SP briefing screen waitUntil { !isNull ( uiNamespace getVariable [ "RscDiary", displayNull ] ) }; [] call _fnc_applyMarkerFades; }; //MP and SP map screen waitUntil { time > 0 && { ctrlIDD ( uiNamespace getVariable "RscDiary" ) isEqualTo 12 } }; [] call _fnc_applyMarkerFades; TEST_MISSION Tested in SP. Tested in Hosted with two clients, one of which JIPed. Tested in Dedicated with three clients, one of which JIPed. 2 1 Share this post Link to post Share on other sites
greenpeacekiller 14 Posted April 24, 2018 3 hours ago, Larrow said: //initPlayerLocal.sqf params[ "_player", "_didJIP" ]; _fnc_applyMarkerFades = { //place eventHandler from previous post in here //uiNamespace getVariable ....... }; if !( _didJIP ) then { //MP and SP briefing screen waitUntil { !isNull ( uiNamespace getVariable [ "RscDiary", displayNull ] ) }; [] call _fnc_applyMarkerFades; }; //MP and SP map screen waitUntil { time > 0 && { ctrlIDD ( uiNamespace getVariable "RscDiary" ) isEqualTo 12 } }; [] call _fnc_applyMarkerFades; TEST_MISSION Tested in SP. Tested in Hosted with two clients, one of which JIPed. Tested in Dedicated with three clients, one of which JIPed. Tested, worked just perfect. Thanks alot for your time & effort, im sure people will love it . Share this post Link to post Share on other sites