ID:163330
 
Would this be a good idea..and how would I approach it? I think Blend() would be the best for my case, since I've tried the 4.0 Transparancy, but it doesn't give me the outcome I hoped, and Blend seems as if it would.

Any ideas? Thanks.
You should be able to use rgb(0,0,0,alpha) where alpha is the new alpha channel you want to accomplish your effect. Otherwise, icon.MapColors() may be able to help.

icon.Blend() is mainly for pasting one icon onto another. In 4.0, it's even possible to make screenshots with this, but I haven't figured out on how to do so, even after following Lummox JR's instructions on the darn thing. *cough*

-- Data
Wait, you tried the 4.0 transparency? How so?

It works fine for me, I dunno. Try making a screen object for this:

obj
darkness
icon = 'night.dmi' //a set of black squares with variable alpha
screen_loc = "1,1 to 15,15" //replace x,x with your viewport's max dimensions
layer = 10000 //set this to a high number, but set any HUD higher than this.


Then, when you want it to be night:

usr.client.screen += new/obj/darkness


That ought to blanket the world in darkness... Might not do so well for indoor areas... Using area overlays is always a good approach too.
In response to Android Data
Alpha, can you explain more? I haven't experimented with..mapcolors, swapcolors, blend or anything. I haven't even touched that section to be honest. I am a decent coder, I just NEVER even knew about that stuff before. So I don't really know how the format is for some things.

Do you think this will give me the outcome I want, which is to darken the actual icon, and not just give it a transparancy? Because the transparancy on 4.0 just DARKENS things, not actually changes the color of the turf like I want, and it seems as if Mapcolor would be the one to do that.

Sorry for the long post, just asking for some information ya know.


This is my basic path and grass.
http://img300.imageshack.us/img300/8237/ screenhunter001ct4.png (During day time)

What I want is this.
http://img300.imageshack.us/img300/2199/ screenhunter002fr4.png (For night time)

With transparancy, it just doesn't work like that, it makes the path a yucky color, and the grass into basically.. a dark bright green. Which isn't what I want ya know.
In response to Enzan
Uh... yeah... You're right. It doesn't work like that. If you have a specific color you want, go back and make a new icon for night, and swap every turf in the world's icon... It's gonna lag your world like hell, though... Your best bet, aside from swapping icon colors only within players' viewports, is to use proper alpha channel overlays...
In response to Ter13
No no no, I know its possible instead of having to swap icons, because where I'm getting this idea from, is that I saw this guys game before, and he had Blend()for Day/Night, so when it turned night, it didn't lag. Atleast from my knowledge, it made his game get the outcome that I want.

I know that swapping all the icons causes massive lag, so thats why I'm resorting to blend, mapcolors, swapcolors, what ever the hell I need to do.
In response to Enzan
Isn't that Pokemon Gold / Silver?
In response to Flame Sage
Why indeed it is, hahah.
In response to Enzan
But what you aren't listening to, is that even if you use Blend() you are going to have to use it on every individual tile in the game also.

Either way you go, you can't globally change tiles. You have to do it instance by instance.
In response to Enzan
I'll give you a tip. This problem can easily be fixed with a bit of knowledge on colours and shadows and how they work.
You see, most people think that when it gets dark it gets black, and they think shadows are also just black. This is inaccurate, both night time and shadows actually have a tint of blue/purple in them, so when you are trying to use a transparent colour to achieve a night time effect, don't make it a transparent black colour, make it a transparent dark blue/purple colour. It'll look a lot better.
In response to The Magic Man
Tried it before, sadly, same results. I've tried from blue through dark purple.
In response to Enzan
After 5 minutes of testing, the closest I could get using just transparency was resonably close, though getting the exact same results are impossible, even if you tried using alpha blending.
I used an icon that had 55 red, 120 green and 255 blue and had a transparency of 80. It looked similar if you ask me.

And, if you wanted to achieve those results exactly then you would have to use an icon for every other icon effected in the game, you couldn't just add a transparent image over the top, or use alpha blending.
Why? Take a closer look at the grass.
The light colour is R 184 G 184 and B 152
The dark colour however is R 88 G 122 B 56.
On the night time version those values are.
Light, R 144 G 160 B 184.
Dark, R 40 G 120 B 128.
That means on the light grass colour you would need to subtract 40 red, 24 green and add 32 blue.
On the dark grass colour you'd need to subtract 44 red, 2 green and add 72 blue.
Which means if you subtracted the values for the light grass colour the darker grass colour would be lighter and look more green than blue. (In other words, you'd get the exact same results as I got by using overlaying a single transparent icon)
If you subracted the values of the darker grass colour the light colour would look like a dark sky blue colour (it would still look very light however, and a lot brighter).

In other words, unless you want to make two icons for everything (one day, one night) you're not going to emulate those effects exactly and you'll have to settle with close but not exactly.
In response to Enzan
You don't need <code>Blend()</code>. <code>MapColors()</code> and <code>rgb()</code> will do here:

obj
light
icon = 'darkness.dmi' // default icon is pure black (flood black)
screen_loc = "SOUTHWEST to NORTHEAST"
layer = FLY_LAYER

New()
..()
icon += rgb(,,,100) // Add 60 alpha to the icon.

moonlight
New()
..()
var/icon/I = new(icon)

/*
This should result in the night icon you want.
(from reference: "Or this will make a nice moonlight effect:")
*/

I.MapColors(0.2,0.05,0.05, 0.1,0.3,0.2, 0.1,0.1,0.4, 0,0,0)
icon = I

sunlight
New()
..()
var/icon/I = new(icon)

/*
Create a sunlight effect.
*/


// note: this is less complicated than mapping a moonlight effect, so
// rgb() will do here.
I.icon += rgb(255,255,80,50)

icon = I


Then you can add these to the client's screen like this:
var
obj/light
moonlight/moonlight = new /obj/light/moonlight
sunlight/sunlight = new /obj/light/sunlight

mob/verb
DefaultLight()
if(moonlight in client.screen)
client.screen -= moonlight
if(sunlight in client.screen)
client.screen -= sunlight

MoonLight()
client.screen += moonlight

SunLight()
client.screen += sunlight