OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: savedbygrace on 06 Aug 2011, 20:51:11

Title: Centering a forced map on a specific marker
Post by: savedbygrace on 06 Aug 2011, 20:51:11
Hey guys, I'd like to force the map to screen and then center the map on a marker so that all relevant information is being seen. Otherwise, the map comes up where the player last adjusted it and the new intel can not be seen. Any ideas?
Title: Re: Centering a forced map on a specific marker
Post by: Raptorsaurus on 07 Aug 2011, 20:51:14
I think it can be done with the map animation commands, but a cut scene might have to run to make it work. I will play around with it tonight to see what I find.
Title: Re: Centering a forced map on a specific marker
Post by: Walter_E_Kurtz on 08 Aug 2011, 17:43:36
It's a lot like scripting a cutscene, only slightly easier thanks to the two dimensions involved. Something like the following should work on a new marker named obj_marker:

Code: [Select]
showGPS false
showPad false
showCompass false
showWatch false
showRadio false

mapAnimClear
mapAnimAdd [1, 0.25, getPos player]
mapAnimCommit
ForceMap true
@mapAnimDone

~2

mapAnimAdd [2, 0.1, getMarkerPos "obj_marker"]
mapAnimCommit
@mapAnimDone

~2

ForceMap false

showGPS true
showPad true
showCompass true
showWatch true
showRadio true
A lot of that isn't strictly necessary:
   show... false / true hides the bits and pieces that might obscure the map screen
   the first mapAnimAdd [... getPos player] moves the map to the player's position from wherever it was before.

mapAnimAdd (http://www.ofpec.com/COMREF/index.php?action=details&id=210&game=All) is fairly straightforward, the only non-obvious aspect being the zoom attribute. This could rather be considered the resolution: the lower the number, the finer detail that can be seen - ie. greater zoom into the map. As if that's made things any more clear.

However, I can't find an off-screen way of returning the map to the player's position, so it will remain centered on the new objective.
Title: Re: Centering a forced map on a specific marker
Post by: savedbygrace on 10 Aug 2011, 02:36:36
Ah! Perfect. I just didn't know what command to look for. I had seen it in a previous campaign somewhere but couldn't find which one. Thanks bunches fellahs, now I can finish polishing things.
Title: Re: Centering a forced map on a specific marker
Post by: Gruntage on 10 Aug 2011, 09:57:50
Theres a good example of the 'forcemap' command in the mission 'Tank Platoon', as well as in the 'Grunt ONE' campaign by Mandoble.