Home   Help Search Login Register  

Author Topic: force map? this is a request  (Read 1965 times)

0 Members and 1 Guest are viewing this topic.

Offline Black

  • Members
  • *
force map? this is a request
« on: 30 Jun 2008, 21:34:14 »
hi all

is there any way to force the map to open zoomed maby locked on a object or a marker?
im thinking of making small close combat areas

1)i need a script that can be configed for different map size (like zoom config
so when you push M key the zoomed map come out(and i dont what any mouse zoom on the map just a fixed posision

is there any great scripter with some time over
you make my arma map soo good

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: force map? this is a request
« Reply #1 on: 30 Jun 2008, 22:15:53 »
This pretty much works, though the map does wobble a bit, at least when I tried it on Rahmadi, when you double-click on the notepad:
Code: (init.sqf) [Select]
// Only run on a client machine.
if ((not isServer) or (not (isNull player))) then
{
    [] spawn
    {
    waitUntil { not (isNull (findDisplay 12)) };
    _map = (findDisplay 12) displayCtrl 51;
   
    waitUntil
    {
    // The second number is the zoom level. Think it goes from about
    // 0.0 to 1.0. Just play about and find a number you like.
    // 3rd number is position of the centre of the visible map.
    // You could use 'markerPos "fred"'
    // instead for a map that stays locked.
    _map ctrlMapAnimAdd [0, 0.1, getPos player];
    ctrlMapAnimCommit _map;

    false;
    };
    };
};

A better alternative might be to construct an entirely new map as a dialog, then you have complete control over it, but it seems like a lot of work for something that can be solved easily.
« Last Edit: 30 Jun 2008, 22:18:58 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Black

  • Members
  • *
Re: force map? this is a request
« Reply #2 on: 30 Jun 2008, 23:10:20 »
look nice but how do i run it :)

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: force map? this is a request
« Reply #3 on: 30 Jun 2008, 23:41:17 »
Well, as it says, "Code: (init.sqf)". I was just throwing it together to go in your mission's "init.sqf" file, though perhaps I should have made it as a separate script originally to make it a bit simpler and more versatile.

The first number is the zoom level to lock at (0.1 here). Think it goes from about 0.0 (zoomed in) to 1.0 (zoomed out); Just play about and find a number you like. Second value is the name of a marker you have placed in the editor, which will be at the centre of the visible map (here, I've used "myMarker" for the example).
Code: (put this in the "init.sqf" OR "init.sqs" file in your mission folder. You probably have to create this file yourself, but if it already exists, then just add this text to it) [Select]
[0.1, "myMarker"] execVM "lockMap.sqf";

Code: ("lockMap.sqf" also in your mission folder. You'll have to create this file) [Select]
// Lock the map view by giving a zoom level and the name of a marker you have placed on the map.
_zoomLevel = _this select 0;
_markerName = _this select 1;

// Only run on a client machine.
if ((not isServer) or (not (isNull player))) then
{
    waitUntil { not (isNull (findDisplay 12)) };
    _map = (findDisplay 12) displayCtrl 51;
   
    waitUntil
    {
    _map ctrlMapAnimAdd [0, _zoomLevel, getMarkerPos _markerName];
    ctrlMapAnimCommit _map;

    false;
    };
};

EDIT: Clarified some of the descriptive text.
EDIT2: Corrected stupid script error!
« Last Edit: 01 Jul 2008, 00:52:19 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Black

  • Members
  • *
Re: force map? this is a request
« Reply #4 on: 01 Jul 2008, 00:35:34 »
do this work in mp?

i cant get it to work right

some script error

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: force map? this is a request
« Reply #5 on: 01 Jul 2008, 00:55:09 »
Sorry, I made a small change after I copy-and-pasted it, and, as usual, broke the code :whistle:. I've corrected the above code so it doesn't appear to have been written by an idiot. Now I have just double, double-checked it and it will work now (sorry!).

Actually, the marker is a bit off-centre on the map you see, but anyway. You can always use an invisible marker so it isn't distracting in-game.

EDIT: I think I worked out why the map "wobbles" about when you are moving or zooming the notepad. As far as I can tell, it is trying to ensure you can always see the map's focal point (which for you is the marker), regardless of where the notepad is on the screen. Nothing you can do about it I don't think, without making your own map dialog, so stick with this.
« Last Edit: 01 Jul 2008, 12:42:18 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Black

  • Members
  • *
Re: force map? this is a request
« Reply #6 on: 01 Jul 2008, 12:09:43 »
this is sooo great thanks for the map script i like this
spooner keep up the good work   :good: