ID:141814
 
Code:
                right
Click()
if(usr.race == "Human")
usr.Current["tone"]++
if(usr.Current["tone"]>skintone.len)
usr.Current["tone"]=1
var/I2=skintone[usr.Current["tone"]]
if(I2=="white")
usr.whitetone()
if(I2=="tan")
usr.tantone()
if(I2=="black")
usr.blacktone()


mob
proc
whitetone()
var/icon/I = icon('Human.dmi')
var/icon/I2 = icon('Human Top.dmi')
I.SwapColor(rgb(203,155,103),rgb(203,155,103))
I.SwapColor(rgb(227,186,109),rgb(227,186,109))
I.SwapColor(rgb(232,197,133),rgb(232,197,133))
I.SwapColor(rgb(239,215,169),rgb(239,215,169))
I.SwapColor(rgb(246,233,208),rgb(246,233,208))
I.SwapColor(rgb(212,172,130),rgb(212,172,130))
I.SwapColor(rgb(216,180,141),rgb(216,180,141))

I2.SwapColor(rgb(203,155,103),rgb(203,155,103))
I2.SwapColor(rgb(227,186,109),rgb(227,186,109))
I2.SwapColor(rgb(232,197,133),rgb(232,197,133))
I2.SwapColor(rgb(239,215,169),rgb(239,215,169))
I2.SwapColor(rgb(246,233,208),rgb(246,233,208))
I2.SwapColor(rgb(212,172,130),rgb(212,172,130))
I2.SwapColor(rgb(216,180,141),rgb(216,180,141))
var/image/IM=new
IM.icon=I2
IM.pixel_y=32
src.icon= I
src.underlays = null
src.underlays += IM
tantone()
var/icon/I = icon('Human.dmi')
var/icon/I2 = icon('Human Top.dmi')
I.SwapColor(rgb(203,155,103),rgb(194,135,73))
I.SwapColor(rgb(227,186,109),rgb(222,174,84))
I.SwapColor(rgb(232,197,133),rgb(228,188,114))
I.SwapColor(rgb(239,215,169),rgb(237,207,151))
I.SwapColor(rgb(246,233,208),rgb(244,229,199))
I.SwapColor(rgb(212,172,130),rgb(212,172,130))
I.SwapColor(rgb(216,180,141),rgb(216,180,141))

I2.SwapColor(rgb(203,155,103),rgb(194,135,73))
I2.SwapColor(rgb(227,186,109),rgb(222,174,84))
I2.SwapColor(rgb(232,197,133),rgb(228,188,114))
I2.SwapColor(rgb(239,215,169),rgb(237,207,151))
I2.SwapColor(rgb(246,233,208),rgb(244,229,199))
I2.SwapColor(rgb(212,172,130),rgb(212,172,130))
I2.SwapColor(rgb(216,180,141),rgb(216,180,141))
var/image/IM=new
IM.icon=I2
IM.pixel_y=32
src.icon= I
src.underlays = null
src.underlays += IM
blacktone()
var/icon/I = icon('Human.dmi')
var/icon/I2 = icon('Human Top.dmi')
I.SwapColor(rgb(203,155,103),rgb(122,84,42))
I.SwapColor(rgb(227,186,109),rgb(171,102,48))
I.SwapColor(rgb(232,197,133),rgb(180,113,49))
I.SwapColor(rgb(239,215,169),rgb(204,128,51))
I.SwapColor(rgb(246,233,208),rgb(228,170,98))
I.SwapColor(rgb(212,172,130),rgb(155,92,44))
I.SwapColor(rgb(216,180,141),rgb(172,108,47))

I2.SwapColor(rgb(203,155,103),rgb(122,84,42))
I2.SwapColor(rgb(227,186,109),rgb(171,102,48))
I2.SwapColor(rgb(232,197,133),rgb(180,113,49))
I2.SwapColor(rgb(239,215,169),rgb(204,128,51))
I2.SwapColor(rgb(246,233,208),rgb(228,170,98))
I2.SwapColor(rgb(212,172,130),rgb(155,92,44))
I2.SwapColor(rgb(216,180,141),rgb(172,108,47))
var/image/IM=new
IM.icon=I2
IM.pixel_y=32
src.icon= I
src.underlays = null
src.underlays += IM


Problem description:
Hi there, I have been having some problems and I was wondering if anyone could help me out. A sum up of what I am doing is, basicly in the character creation you have arrows, you click left or right and it changes your skin tone, easy enough. Above is how I have done it but, its glitchy and dosen't work well with a two tile base. Is there a better way of going about this? Any assistance would be of great help.

Kenjo
Well, I could suggest you have multiple icons with variations (I suggest photoshop if your going to do this) however, this may increase the size of the resource file by however many shades x however many icons you have
Ie 3 shades of 3 Races = 9
But thats just a thought (probbably take longer to do that then fix the code though :P)
All this is doing is taking each pixel from the base and changing it so it looks Tan, and Black, because I didnt want to have Human male white.dmi, human make tan.dmi and so fourth. I think the problem im running into is
var/image/IM=new

Its messing up the top of the icon. So I don't know if theres an easier way or a better way of what I am trying to do....
I would recommend the Blend() proc or SetIntensity() proc (they might not get you exactly where you want, but they usually do a fairly good job).
In response to Nickr5
Ive tried setintensity and it's crap, and blend isnt working out for me...
In response to Kenjo
There's also MapColors, if you can figure out how to use it.