Jump to content
Sign in to follow this  
anthonyfromtheuk

Map view control via scripting?

Recommended Posts

Is there a way via scripting to set the map zoom and map center view? What I am trying to achieve is a briefing that shows markers as a player is given a brief via text. I would like the map view to jump from spot to spot on the map via a script and have control over the maps zoom as well. Is this possible? If so could somebody point me in the right direction or give an example please?

Share this post


Link to post
Share on other sites

You can use simply mapAnimAdd. Or if you're a knuckle head, you can do it the hard way ...

((uiNamespace getVariable "RscDiary") displayCtrl 51) ctrlMapAnimAdd [0,0.05,getMarkerPos "myMrk"]; 
ctrlMapAnimCommit ((uiNamespace getVariable "RscDiary") displayCtrl 51);

Bonus infoz!

Turn the maps textures off initially.

waitUntil {visibleMap}; 
ctrlActivate ((findDisplay 12) displayCtrl 107); // Auto activate the textures button

Edited by Iceman77

Share this post


Link to post
Share on other sites
You can use simply mapAnimAdd. Or if you're a knuckle head, you can do it the hard way ...

((uiNamespace getVariable "RscDiary") displayCtrl 51) ctrlMapAnimAdd [0,0.05,getMarkerPos "myMrk"]; 
ctrlMapAnimCommit ((uiNamespace getVariable "RscDiary") displayCtrl 51);

Bonus infoz!

Turn the maps textures off initially.

waitUntil {visibleMap}; 
ctrlActivate ((findDisplay 12) displayCtrl 107); // Auto activate the textures button

That's some brilliant stuff, right there! If/when I ever get a mission published be sure your name will be in the credits, Iceman77. You are a font of scripting knowledge, I swear.

So to continue the OP's question how would one go about "proper" scripting of say three or four map changes with text for each one? Thanks!

Share this post


Link to post
Share on other sites
You are a font of scripting knowledge, I swear.

I'm getting there. Larrow has helped me understand things a great deal.

---------- Post added at 23:13 ---------- Previous post was at 21:41 ----------

Oops, misunderstood the topic entirely. Maybe reading the post aswell would help lol. Though I'm still a bit unclear on what the OP wants... In any case, you can create hyperlinks in the briefing. So when you click on text it will move the camera to a marker. IE;

player createDiaryRecord ["Diary", ["Insertion","You will <font color='#84e4ff'><marker name = 'LZ'>insert</marker></font color> via assault boat at 2200."]];

Edited by Iceman77

Share this post


Link to post
Share on other sites

I wanted the map to automatically jump from spot to spot based on time set in a script that is running during a briefing from an NPC i will check out these options. Thanks Iceman77

--- Edit ---

Found knucklehead version most effective does what I want it to do tried using mapAnimAdd but I guess I don't quite get it because I cannot get it working as easily

Working Knucklehead way

openMap true;
Sleep 0.1;
((uiNamespace getVariable "RscDiary") displayCtrl 51) ctrlMapAnimAdd [0,0.05,getMarkerPos "myMrk"];   ctrlMapAnimCommit ((uiNamespace getVariable "RscDiary") displayCtrl 51);
Sleep 5;
((uiNamespace getVariable "RscDiary") displayCtrl 51) ctrlMapAnimAdd [0,0.02,getMarkerPos "myMrk2"];   ctrlMapAnimCommit ((uiNamespace getVariable "RscDiary") displayCtrl 51);
Sleep 10;
openMap false;

Not working Other way

openMap true;
Sleep 1;
mapAnimAdd [0, 0.05, markerPos "myMrk"];
Sleep 5;
[0, 0.02, markerPos "myMrk2"];
Sleep 10;
openMap false;

Edited by Anthonyfromtheuk

Share this post


Link to post
Share on other sites

mapAnimAdd and MapAnimCommit is working for me. I'm not using it in tasks, but a different type of script or context like this:

GetClick = true;
openMap true;
waitUntil {visibleMap}; 
ctrlActivate ((findDisplay 12) displayCtrl 107);// map texture toggle
titletext ["Click on Map for Extraction Point or escape to cancel","plain down"];
onMapSingleClick "'extractmkr' setMarkerPos _pos; GetClick = false; onMapSingleClick '';";
waituntil {!GetClick or !(visiblemap)};
if (!visibleMap) exitwith {hint "Evac on Standby"; openMap false; player addAction [("<t color=""#12F905"">") + ("Heli Extraction") + "</t>","JIG_EX\grp_ground_troops.sqf",JIG_EX_Caller removeAction jig_ex_actid_show,1, false, true,"","player ==_target"]};

call do_code;
mapAnimAdd [0.5, 0.1, markerPos "myMkr"];
mapAnimCommit;
sleep 3;
ctrlActivate ((findDisplay 12) displayCtrl 107);// map texture toggle
openMap false;

Thanks for the headsup on mapAnimAdd Iceman. I had been wondering how to do that. I knew about the dynamic links for tasks but didn't know how to do it in another context.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×