ID:159262
 
Okay, so, I had an idea to make it so that when you move from map to map, and in between certain sections of the character-creation, the screen faded to black, and then faded into the next screen. Now I did find a way to do this, with relocating the character to several different identical maps that were pre-faded, but that's not that efficient, as I'm sure you could imagine.

My question is would I make a proc that gets initiated everytime I want to make the screen fade to black, and from black to clear? If so, how would I go about doing so? Thank you so much for reading and answering if you do. :D


-Yurokei
You can do this pretty easily by using a single screen object that is set to occupy the whole screen. That screen object's icon (with multiple icon states with increasing levels of fading) will use either dithering or alpha transparency (which is better) to cause a fading effect. Just use a black icon with varying levels of transparency in different states, of course, and slowly switch the screen object's icon between them all. If you haven't used screen objects before, read in the DM Reference about screen and screen_loc, and you may also want to check out some HUD-related demos. Your fading proc could look something like this:
obj/fade
icon = 'fade.dmi'
screen_loc = "SOUTHWEST to NORTHEAST"
client/proc/Fade()
var/obj/fade/O = new
src.screen += O
/*now loop through the icon states, setting the obj to
each one and sleep()ing a little before the next one.
you could either use numbered icon states, or loop through
all the states in the file by using the <tt>icon_states()</tt>
proc, etc.*/
In response to Kaioken
Ohh thank you! I'll give it a try. And what is the purpose of the screen_loc = "SOUTHWEST to NORTHEAST"? Will it always have to be those directions? I'm sorry, I guess I was just confused by that. :3
In response to Kaioken
Now that I look at it, does that mean that it covers everywhere between the southwest corner and northeast corner? (I figured I'd give it a shot at figuring it out first before asking, .... after I asked... lol.)
In response to Yurokei
Basically it's just drawing a box across the whole map control, where the screen obj should live. SOUTHWEST and NORTHEAST are just nice names for the bottom left and top right of the map control, so that you can change the world.view for example and have it still cover the full map control. You could do NORTHWEST to SOUTHEAST if you liked, for instance.
In response to Stephen001
Ahh, I see, thank you.

And when he said to loop through the icon states of the fades, would it go like

client/proc/Fade()
var/obj/Fade/O = new
src.screen += O
icon_state = "yadda yadda"
and so on


I know I'm new. x_x
In response to Yurokei
You'd use a loop, like for(), to go through the icon states. How you do that exactly depends on how you name the states and what file you put them in. You can name them in a numbered fashion (e.g. "1", "2"... or "fade1", "fade2"...) then just loop through the total amount of numbers/states and use the current number to update the state. There are multiple ways to make a loop that loops X times.
for(var/i=1,i <= 10,i++) //loop 10 times
world << i //output the current number to the world

for(var/i = 1 to 10) //loop 10 times
world << i

As I said previously you could also incorporate the icon_states() proc in your code that can be used to get a list of the icon states in a file, but as you're new it'd be easier to just do it like above, hardcoding the state names.
In response to Kaioken
Okay, I'll give it a shot!
And I was wondering how you'd call Fade? Like, I tried Fade(), which obviously wouldn't work, because it's a client proc, so then I tried call_Fade(), and I got all sortsa errors.
In response to Yurokei
Personally, I'd just made it a mob proc just to make it easier on myself. But you'd call a client proc the same as any other atom proc, so long as you call it with a person's client, not their mob.

turf/Transition
Entered(atom/A)
if(ismob(A))
var/mob/M = A //type cast their mob
var/client/C = M.client //type cast their client
C.Fade() //call the Fade() proc
M.Move(locate(/*location here*/)) //relocate them


Probably not how Kaioken would do it, but whatever.
In response to Spunky_Girl
Har, thanks Kitty. I'll give this one a try to. I'm pretty open minded, lol.
In response to Kaioken
Why not just make an icon state with however many frames of fading that you need and then set a sleep() or spawn() for the same amount and then play the reverse animation. And of course, change the mob's location in between.
In response to Hiro the Dragon King
You can't count on the obj's icon state to begin looping from the beginning in just that moment; it doesn't reset when you assign the state. flick()ing it could work, though.
In response to Kaioken
Well, I didn't say you couldn't loop it. I meant to say flick but I forgot. I, myself was working on doing this but reversing it was a pain so I gave up.