View Single Post
06/02/14, 09:43 AM   #4
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by Ryainor View Post
Thanks for letting me know.
If any addon creator decides they want a new project maybe they can look into if it's possible colouring it on the map
I'd be sure to use it.
It is possible to change color of map pins, for example HarvestMap addon it does.
Map uses two different types of group pins (group leader / group mebers). If you want to have different color for each group member, it is doable, but it is not that simple matter.

If you do not have HarvestMap addon installed, just copy&paste the following code into the .lua file of any addon you use:
Lua Code:
  1. --set pin colors:
  2. ZO_MapPin.PIN_DATA[MAP_PIN_TYPE_GROUP_LEADER].color = {1, 0.65, 0, 1} --r,g,b,alpha (orange)
  3. ZO_MapPin.PIN_DATA[MAP_PIN_TYPE_GROUP].color = {0, 1, 0, 1} --(green)
  4.  
  5. --hook function to make it work:
  6. ZO_PreHook(ZO_MapPin, "SetData",
  7.    function(self, pinTypeId)
  8.       local control = GetControl(self:GetControl(), "Background")
  9.       local color = ZO_MapPin.PIN_DATA[pinTypeId].color or {1, 1, 1, 1}
  10.       control:SetColor(unpack(color))
  11.    end)

If you use HarvestMap, you will need either replace custom hook in HarvestMapMarkers.lua with the code above or change my code to post hook:
Lua Code:
  1. --set pin colors:
  2. ZO_MapPin.PIN_DATA[MAP_PIN_TYPE_GROUP_LEADER].color = {1, 0.65, 0, 1} --r,g,b,alpha (orange)
  3. ZO_MapPin.PIN_DATA[MAP_PIN_TYPE_GROUP].color = {0, 1, 0, 1} --(green)
  4.  
  5. --hook function to make it work:
  6. local SetData = ZO_MapPin.SetData
  7. ZO_MapPin.SetData = function(self, pinTypeId, ...)
  8.    SetData(self, pinTypeId, ...)
  9.    local control = GetControl(self:GetControl(), "Background")
  10.    local color = ZO_MapPin.PIN_DATA[pinTypeId].color or {1, 1, 1, 1}
  11.    control:SetColor(unpack(color))
  12. end
  Reply With Quote