Mini Colors

User avatar
Enalias
Site Admin
Site Admin
Posts: 200
Joined: Sat Sep 15, 2018 1:57 pm
Reputation: 9
Location: Florida, U.S.A.
Website: http://chaosrealm.co/memberlist.php?mod ... rofile&u=2
Discord: https://discord.gg/BUEZkef
Twitch: https://www.twitch.tv/enalias
Contact:
United States of America

Mini Colors

#1

Post by Enalias » Mon Nov 05, 2018 12:08 pm

Idea by Fard[a]y.

Mini Colors is a library to help change the Minimap UI for Wc3. Currently there is no way to change the color of a unit on the minimap, but this is a solution to that.

Examples/Ideas
A prime example of when this would be used is when your using the action Set Unit Color, that function does not change the unit's color on the minimap. Another example would be letting the map maker make it easier for the players to differentiate between allies and enemies.

Requirements:
It requires the icons in the testmap, they are all 1kb or 2kb.

GUI: You are required to know zero JASS, except how to call the JASS function. This can be used by using custom script.

JASS: Just place the script in and call the functions

Test Map: I have also included a test map so you can test it out. Just type a color into the chat and it will change the unit's color to that on the minimap.
Spoiler
Show
/////////////////////////////////////////////////////
//Created by SuPa_Link 3/3/12
//Credits given to Fard[a]y for idea
//Allows units to get custom minimap colors locally
//Example: A unit normally blue on the minimap can be orange
//Requires the icons included in this map
//This will only effect any unit you specify, and only players you specify
//Only one color can be used at a time


//------------------------------------------
////////////////////////////////////////////
//changeIcon takes string color, integer pId
////////////////////////////////////////////

//Takes a color in all lowercase.
//pId is the user you want to change it for
//Changes the current icon path

//------------------------------------------


//------------------------------------------
////////////////////////////////////////////
//enableIcon takes integer pId, unit u
////////////////////////////////////////////

//pId is the user you want to change it for
//u is the unit's icon you want to change
//Changes the icon for the unit on the minimap

//------------------------------------------


//------------------------------------------
////////////////////////////////////////////
//disableIcon takes integer pId, unit u
////////////////////////////////////////////

//pId is the user you want to change it for
//u is the unit's icon you want to change
//Changes the icon for the unit to the default value on the minimap

//------------------------------------------

/////////////////////////////////////////////////////

library MiniColors
globals
private constant string RED = "war3mapImported\\Red.blp"
private constant string BLUE = "war3mapImported\\Blue.blp"
private constant string TEAL = "war3mapImported\\Teal.blp"
private constant string PURPLE = "war3mapImported\\Purple.blp"
private constant string YELLOW = "war3mapImported\\Yellow.blp"
private constant string ORANGE = "war3mapImported\\Orange.blp"
private constant string GREEN = "war3mapImported\\Green.blp"
private constant string PINK = "war3mapImported\\Pink.blp"
private constant string GRAY = "war3mapImported\\Gray.blp"
private constant string LB = "war3mapImported\\LB.blp"
private constant string DG = "war3mapImported\\DG.blp"
private constant string BROWN = "war3mapImported\\Brown.blp"
private constant string BLACK = "war3mapImported\\Black.blp"
private constant string WHITE = "war3mapImported\\White.blp"
endglobals

function changeIcon takes string color, integer pId returns nothing
local string path = null
local player p = Player(pId)
local player pLocal = GetLocalPlayer()

if(color == "red") then
set path = RED
elseif(color == "blue") then
set path = BLUE
elseif(color == "teal") then
set path = TEAL
elseif(color == "purple") then
set path = PURPLE
elseif(color == "yellow") then
set path = YELLOW
elseif(color == "orange") then
set path = ORANGE
elseif(color == "green") then
set path = GREEN
elseif(color == "pink") then
set path = PINK
elseif(color == "gray") then
set path = GRAY
elseif(color == "grey") then
set path = GRAY
elseif(color == "lb") then
set path = LB
elseif(color == "light blue") then
set path = LB
elseif(color == "dg") then
set path = DG
elseif(color == "dark green") then
set path = DG
elseif(color == "brown") then
set path = BROWN
elseif(color == "black") then
set path = BLACK
elseif(color == "white") then
set path = WHITE
else
call BJDebugMsg("Error: Invalid Color")
return
endif

if(pLocal == p) then
call SetAltMinimapIcon(path)
endif

set p = null
set pLocal = null
endfunction

function enableIcon takes integer pId, unit u returns nothing
local player p = Player(pId)
local player pLocal = GetLocalPlayer()

if(pLocal == p) then
call UnitSetUsesAltIcon(u, true)
endif

set p = null
set pLocal = null
endfunction

function disableIcon takes integer pId, unit u returns nothing
local player p = Player(pId)
local player pLocal = GetLocalPlayer()

if(pLocal == p) then
call UnitSetUsesAltIcon(u, false)
endif

set p = null
set pLocal = null
endfunction
endlibrary
You do not have the required permissions to view the files attached to this post.

Return to “Systems”

×