Jump to content
ROTAHOE

Adding custom 2d icon markers to map.

Recommended Posts

Hey I got 4 image.paa files that I would like to add to the map as a permanent  marker but unsure how to add them to my mission without a mod. I need to know how to add them via script and how to choose position and image. Not much I can find in google search. Everything is say you need a mod witch can't be true !! Any help would be amazing.

 

Please show an example of the how to code and where it needs to be added. 

 

cheers

Share this post


Link to post
Share on other sites

drawIcon

map display number is 12. Take a look at the first example and you'll get a pretty good idea as to how to do this.

 

  • Like 1

Share this post


Link to post
Share on other sites

Ok so I've tested this and all is working using the default icons in ui_f_data\map\vehicleicons but if I go to replace the icon with my own, I get ( cannot load texture images\towericon1_ca.paa )  when I bring up the map.

 

findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", " 
 _this select 0 drawIcon [ 
  'images\towericon1_ca.paa', 
  [1,0,0,1], 
  getPos Tower1, 
  24, 
  24, 
  getDir Tower1, 
  '', 
  1, 
  0.03, 
  'TahomaB', 
  'right' 
 ] 
"];

How do i call my image ? 

Share this post


Link to post
Share on other sites
1 hour ago, ROTAHOE said:

Ok so I've tested this and all is working using the default icons in ui_f_data\map\vehicleicons but if I go to replace the icon with my own, I get ( cannot load texture images\towericon1_ca.paa )  when I bring up the map.

 


findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", " 
 _this select 0 drawIcon [ 
  'images\towericon1_ca.paa', 
  [1,0,0,1], 
  getPos Tower1, 
  24, 
  24, 
  getDir Tower1, 
  '', 
  1, 
  0.03, 
  'TahomaB', 
  'right' 
 ] 
"];

How do i call my image ? 

look at the alt syntax. That's the only form of the syntax that supports custom images.

Share this post


Link to post
Share on other sites

Sorry mate I don't understand ? 

Share this post


Link to post
Share on other sites

Where is your image located at? Is it being pointed to properly?

Share this post


Link to post
Share on other sites

Its  in my mission, image folder?

 

Share this post


Link to post
Share on other sites

You need to declare the full path of your paa.

read here. Consider a light description.ext for returning a missionConfigFile

  • Like 2

Share this post


Link to post
Share on other sites

SOLVED

Awesome mate thank you very much ! 

 

init.sqf

MISSION_ROOT = call {
    private "_arr";
    _arr = toArray __FILE__;
    _arr resize (count _arr - 8);
    toString _arr
};

Marker.sqf

findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", " 
 _this select 0 drawIcon [ MISSION_ROOT + 
  'images\towericon1_ca.paa', 
  [1,0,0,1], 
  getPos Tower1, 
  24, 
  24, 
  getDir Tower1, 
  '', 
  1, 
  0.03, 
  'TahomaB', 
  'right' 
 ] 
"];

Tower1 init

this execVM "Marker.sqf";

 

Share this post


Link to post
Share on other sites

Ok now I can confirm this is not working on dedicated server and its showing no error in logs ?

 

Share this post


Link to post
Share on other sites

@pierremgi do you have any idea why its not working in mp mate? 

Share this post


Link to post
Share on other sites
4 hours ago, ROTAHOE said:

@pierremgi do you have any idea why its not working in mp mate? 

Well who isn't it appearing for?

 

Share this post


Link to post
Share on other sites
10 hours ago, pierremgi said:

You need to declare the full path of your paa.

read here. Consider a light description.ext for returning a missionConfigFile

pierre to the rescue. 

Share this post


Link to post
Share on other sites
1 hour ago, Midnighters said:

Well who isn't it appearing for?

 

Everybody. works in SP then trans to MP  and nothing. tried all his ways on that blog but nothing worked. Unless yous know something I don't?  

Share this post


Link to post
Share on other sites
13 minutes ago, ROTAHOE said:

Everybody. works in SP then trans to MP  and nothing. tried all his ways on that blog but nothing worked. Unless yous know something I don't?  

That's the problem each time you have to refer to the full path of something (sound, picture..) In MP, there is no easy method to satisfy clients path ans server one.

Even with the methods explained in the link above.

The alternate method is possibly to create your own class of icon, with inheritance of an existing one in configFile  cfgMarkers ?

I didn't test that.

  • Like 2

Share this post


Link to post
Share on other sites

I may have found a more simple approach by having a server side addon 

 

config.cpp

class CfgPatches
{
  class Markers
  {
    units[] = {};
    weapons[] = {};
    requiredVersion=1.00;
  };
};

 class CfgMarkers
 {
 
    class Tower1
    {
      name="Tower1";
      icon="\TowerMarkers\icons\towericon1_ca.paa";
      color[]={1,1,1,1};
      size=32;
      shadow = 0;
      scope = 2;
      markerClass = "Flags";
    };

    class Tower2
    {
      name="Tower2";
      icon="\TowerMarkers\icons\towericon2_ca.paa";
      color[]={1,1,1,1};
      size=32;
      shadow = 0;
      scope = 2;
      markerClass = "Flags";
    };
	
	class Tower3
    {
      name="Tower3";
      icon="\TowerMarkers\icons\towericon3_ca.paa";
      color[]={1,1,1,1};
      size=32;
      shadow = 0;
      scope = 2;
      markerClass = "Flags";
    };
	
	class Tower4
    {
      name="Tower4";
      icon="\TowerMarkers\icons\towericon4_ca.paa";
      color[]={1,1,1,1};
      size=32;
      shadow = 0;
      scope = 2;
      markerClass = "Flags";
    };
 };

then place the needed paa files into the icons folder then repack it into TowerMarker.pbo and place in the addons folder. 

I will have to place them on the map via editor and trans the the mission.sqm an TowerMarker.pbo to the server.

Testing now but I can see this worrking else I will have to sign the pbo and call it as server mod ? This will save mission file size also.

  • Thanks 1

Share this post


Link to post
Share on other sites

Solved: made addon:  http://steamcommunity.com/sharedfiles/filedetails/?id=920910695

 

Even though I was trying to avoid a addon, this way seems to work better using  KK's code Automatic Marker Resizing.

 

Since I'm using player markers it was causing them to flicker as KK's code is using allMapMarkers/ICON and  player markers calls onEachFrame.

 

I added to his code to point at my addons marker classname instead of it calling on every Icon/allMapMarkers.

 

Example:

Marker classname Tower1

0 = 0 spawn { 
    waitUntil {!isNull findDisplay 12}; 
    findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", { 
        if (visibleMap) then { 
            _scale = 0.05 / ctrlMapScale (_this select 0); 
            { 
                _m = "#markerSize_" + _x; 
                if (markerShape _x == "ICON") then { 
                  if (getMarkerType _x == "Tower1") then { 
                    if (isNil {missionNamespace getVariable _m}) then { 
                        missionNamespace setVariable [_m, markerSize _x]; 
                    }; 
                    _x setMarkerSizeLocal [ 
                        ((missionNamespace getVariable _m) select 0) * _scale, 
                        ((missionNamespace getVariable _m) select 1) * _scale 
                    ];}; 
      
                };               
            } forEach allMapMarkers; 
        }; 
    }]; 
};

 

Share this post


Link to post
Share on other sites

If someone search solution in 2k21, you can use getMissionPath:
 

findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", " 
   _this select 0 drawIcon [ 
    getMissionPath 'images\towericon1_ca.paa', 
    [1,0,0,1], 
    getPos Tower1, 
    24, 
    24, 
    getDir Tower1, 
    '', 
    1, 
    0.03, 
    'TahomaB', 
    'right' 
   ] 
"];

 

  • Like 1

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

×