f2k sel 164 Posted August 19, 2012 Hi, I can't seem to locate any useful info. I'm placing a marker on a map while the game is running that's ok but I also need to be able to re-adjust the marker and set the direction. Can anyone point me in the right direction. openMap [true,false]; onMapSingleClick "loc = _pos;clicked=false"; waitUntil {!clicked}; _marker = createMarker ["Road Block",loc]; _marker setMarkerType "Arrow"; _marker setMarkerColor "ColorRed"; _marker setMarkerPos loc; waituntil {!visibleMap}; ["objects",(markerdir _marker), getmarkerpos _marker] execVM "spawn.sqf"; Cheers sel. Share this post Link to post Share on other sites
Horner 13 Posted August 20, 2012 When you use - _marker = createMarker ["Road Block", loc]; The "Road Block" is the name of your marker. I wouldn't use a space between those two words, for explanation purposes let's just say you used "Road_Block". So later on you would just use something like this. "Road_Block" setMarkerDir 0; Hope that helped. :) Share this post Link to post Share on other sites
f2k sel 164 Posted August 20, 2012 Thanks I missed that. My main problem is how to rotate a marker on the map, I know I can set it using setmarkerdir but how to get the new direction. In the editor you click on the marker and while holding shift can rotate it, I'd like something like this when running the game. Share this post Link to post Share on other sites
kylania 568 Posted August 20, 2012 Maybe some kind of mapclick thing where you compare the direction from player position to mapclick pos? Share this post Link to post Share on other sites
Horner 13 Posted August 20, 2012 The only way I can see this working is if you run some kind of very very complicated display event handler. Even then I don't know how to get the position of the cursor on the map. Sorry, I think the rotation effect is hard-coded into the game. Maybe a GUI where you can set the direction of the marker using a 0-360 value? Share this post Link to post Share on other sites
kylania 568 Posted August 20, 2012 SPONMap used to be able to do this in ArmA right? Maybe see how he did it? Share this post Link to post Share on other sites
f2k sel 164 Posted August 20, 2012 (edited) Cheers I'll have to take a look at that. Using a display event handler I have the marker tracking the cursor but not accurately. SPONMap is way too complicated for my brain it's all user created functions. Edited August 20, 2012 by F2k Sel Share this post Link to post Share on other sites
riouken 15 Posted August 20, 2012 You could make a small dialog with a Slider Control and then use sliderSetRange to set the min to 0 and the max to 360. Have the slider call a small function each time it is moved and that function can then set the dir for your marker. Here is an example for a view distance slider: dialog.hpp (lots of things were removed from this just to show the slider example.) #include <RSLO_UI_Base.hpp> class RSLO_dlg { idd = -1; movingEnable = false; onLoad = execVM "RSLO\RSLO_ui_setup.sqf"; objects[] = {}; class controlsBackground { class background: RSLO_RscPicture { idc = 1200; text = "\ca\ui\data\ui_background_controls_ca.paa"; x = 0.0138894; y = 0.194989; w = 0.810784; h = 0.629413; moving = false; }; }; class controls { class RscSlider_1900: RSLO_RscSlider { idc = 1900; x = 0.138889; y = 0.666667; w = 0.379412; h = 0.0488018; onSliderPosChanged = "_this call RSLO_set_vd_fnc;"; tooltip = "Slide to set View Distance."; }; }; }; slider_ui_setup.sqf: sliderSetRange [1900, 1000, 10000]; RSLO_set_vd_fnc: private ["_nvd"]; _nvd = round(_this select 1); ctrlSetText [1100, "" + (str(_nvd))]; setViewDistance _nvd; Just remember that who ever is using the UI this effect will be local, if you need this marker update to be gloabal you will need to pass the dir change to the server and have it update the marker. Share this post Link to post Share on other sites
f2k sel 164 Posted August 20, 2012 Thanks Riouken but Dialog scripting is a black art to me I wouldn't have a clue how to implement any of the above. I've tried in the past and found most tutorials to be broken and any tools just seem to crash. Share this post Link to post Share on other sites
cuel 25 Posted August 21, 2012 Wouldn't something like this be enough onMapSingleClick { _d = [(markerPos "Road_Block"),_pos] call BIS_fnc_dirTo; if (_d < 0) then {_d = _d + 360;}; "Road_Block" setMarkerDir _d; }; Can't test this atm. Share this post Link to post Share on other sites
riouken 15 Posted August 21, 2012 I threw this together real quick for you F2K. download test mission: http://www.jackknife.us/wordpress/?wpfb_dl=8 You can merge it with your mission. Right now its just set up to test from the action menu. But just call the gui start script from your ui eventhandler and it should work as intended. then just plug in your marker info in the function to update it on the fly. Share this post Link to post Share on other sites
f2k sel 164 Posted August 21, 2012 (edited) That's excellent thanks I've always wanted a working slider template. Setting up the marker and opening it on the map was easy enough. Thanks again. I'd still like to know how to do it correctly so if anyone does ever come across how to move the marker around and change direction in the player map it would be great. Until then I'll use Rioukens slider option for direction and onmapsingleclick to position it. Edited August 21, 2012 by F2k Sel Share this post Link to post Share on other sites