ID:268936
![]() Dec 30 2004, 4:10 pm
|
|
Okay, How do I make an object change its color according to the players color? But, it only changes the WHITE part of the icon, and the rest stays the same.... Is it possible?
|
Actually, you can do this, it will just require the host uploading more resource files. Set the icon you want to change to an /icon variable with the icon() procedure, like this...
var/icon/I = icon(MyObj.icon, MyObj.icon_state)
Once this is done, use the /icon procedure, SwapColor(), and set the object's icon, like this... I.SwapColor("#FFFFFF", rgb(NewRed, NewGreen, NewBlue)) Here's a warning though, if you don't give an icon state when you use the icon() procedure here, it will edit, and upload ALL of the states with white in them. Same goes for directions and frames, but we want that. If this is an icon that does change it's state a lot, then you mine as well leave out the icon state when you do this.
var/icon/I = icon(MyObj.icon)
Hope this helped. |
Yota wrote:
Actually, you can do this, it will just require the host uploading more resource files. I didn't think of SwapColor(). Good point! |
Well, unfortunately, there's no way to get the rgb of a specific pixel. You could, however, make an overlay, in the same poosition as the "WHITE part of the icon" and rgb() it according to the player's color.