ID:1856407
 
(See the best response by Kidpaddle45.)
Code:


Problem description:

Right now I'm working on a game and want to have a few different skin colors for players to be able to choose between.

Is there a way to code different color skins from one base icon? Or would I need separate colored bases for each icon?

If you didn't understand what I meant:

Let's just say that I have a white base icon, is there a way to use the rgb proc or something to make it a bit tanner? Or would there need to be a separate Tan colored base?
Yes, you can. It can be a white base and you use the rgb proc.
Icon.rgb(RED,GREEN,BLUE)
I'm kinda new to coding so can you guide me thru it a bit? lol

mob
icon = 'mob.dmi'


That's the thing I have for the mob icon, where exactly would I put the Icon.rgb part?
Oh I think I got it
I do usr.icon += rgb(w.e) right?
Best response
Yep exactly. It's very simple. The base needs to be black though. To test it, create a new base icon that we'll use for this test and make it a white rectangle.

then add this code:
mob/player
icon = 'mob.dmi'
Login()
src.loc = locate(1,1,1)
src.icon += rgb(255,0,0) // THIS WILL MAKE A RED BASE


You can use a combination of red,green and blue to create skin colors and I can confirm it'll work as if you had multiple base icons with different skin tones.
It works lol and u said i need black base but is der a way to just do opp on white base? like rgb - instead of +
btw ur a good helper
Yes it will work with a white base but the color combinations will be completely different. For example, it was quiet simple to make the black base red. All we needed to do is increase the R value to 255.

If we do Icon-=rgb(255,0,0) it wont have the same effect, so you'll have to keep trying to get the result you want but yep it can also be done.

And thank you. Appreciated.
It wont work with whtie base? oh and np
I meant white base. Sorry. edited my post.
Lol np
If you have a white base, you can use the color variable. It's much faster than "icon +=" and "icon -=" because it doesn't involve /icon objects or the dynamic resource cache.
color = "red"
In response to Kaiochao
Kaiochao wrote:
If you have a white base, you can use the color variable. It's much faster than "icon +=" and "icon -=" because it doesn't involve /icon objects or the dynamic resource cache.
> color = "red"
>


He could if all he wanted were solid colors.
He wants to create skin tones. He'll have to use the rgb() proc :/
In response to Kidpaddle45
Kidpaddle45 wrote:
Kaiochao wrote:
If you have a white base, you can use the color variable. It's much faster than "icon +=" and "icon -=" because it doesn't involve /icon objects or the dynamic resource cache.
> > color = "red"
> >

He could if all he wanted were solid colors.
He wants to create skin tones. He'll have to use the rgb() proc :/

You can still use hex values or a call to RGB with the color proc though, like this:

color = "blue" // Blue
//or
color = rgb(0,0,255) // Also Blue
//or
color = "#0000FF" // Still Blue

My preferred way to blend icons is to have one icon for color, one for highlights. The color icon is actually white and shades of gray, and is multiplied by the desired color. The highlight icon is then added to that.

If your highlights are only ever shades of gray, then you can achieve this with one icon using MapColors().
id just make a cacausain skin tone. And than add colour to it. I think that would get a good look though ive never tried it.
Tbh I think rgb would be better since I don't think I'ma need several bases in this case, just going to do a thing where ur default icon is like tanish, and you can add/take away brightness, making it brighter or darker
If I change the icon's color, would it change the icon states' colors too?
nvm solved my own question lol
Btw hi Lummox