[Include] DissolvePlayerScreen
#1

DissolvePlayerScreen v0.01


[*] Introduction
Hello, this is an include I've scripted for my gamemode but I decided to share it here, luckily someone else finds it useful. I'm using YSI 4.x right now for my gamemode, so this include makes use of it also.

I know there are other includes like this out there, but I decided to script this because YSI allows me to do it without the need of additional includes. If you don't use YSI and you don't want to, maybe easy-fade by kvann is what you're looking for. kvann's include inspired me to script this version.

Please note the main purpose of this script is to dissolve the screen for cinematics and create a transition between scenes. It could also be used when entering interiors to loads objects and similar stuff. This hasn't been made to flash player's screen when he takes damage or when he crashes a car.


[*] Video
Here you can find a video.
You can find the code which I used in the video on the GitHub repository.


[*] Download
Here is the GitHub repository.


[*] Documentation
This include is really simple, these are the functions available:
Code:
IsPlayerScreenDissolving(playerid)
DissolvePlayerScreenToBlank(playerid, Func:response_func<i> = NO_TRANSITION_RESPONSE)
DissolvePlayerScreenToBlack(playerid, Func:response_func<i> = NO_TRANSITION_RESPONSE)
DissolvePlayerScreen(playerid, init_color, end_color, Func:response_func<i> = NO_TRANSITION_RESPONSE)
Here you can find the full documentation and a few usage examples.

I've added DissolvePlayerScreenToBlank and DissolvePlayerScreenToBlack to make things easier for me, only black is used there for the interpolation, basically it interpolates the alpha value from 0x00 to 0xFF and vice versa. Consider them shortcuts.

If you use YSI remember you can use y_colours to access colors easier. For example:
PHP Code:
public OnPlayerConnect(playerid)
{
    
// Dissolve from transparent black to full orange:
    
DissolvePlayerScreen(playeridY_BLACK 0x00Y_ORANGE 0xFF, &Transition_Complete);
    return 
1;
}
Transition_Complete(playerid)
{
    
// Dissolve from full orange to transparent black.
    
DissolvePlayerScreen(playeridY_ORANGE 0xFFY_BLACK 0x00);
}
/*
In this case the colors used for the interpolation were BLACK
and ORANGE, but you could use whatever you wish, obviously.
*/ 
Something good about this include is that the TextDraw used for the transition is destroyed and created again every time you use any of the functions above. This means it overlays to other TextDraws created previously and it hides everything. However, if you have TextDraws which update frequently like speedometers, clocks, etc. they might appear over the transition TextDraw. In this case, maybe you should stop updating your TextDraws using IsPlayerScreenDissolving as condition, or hiding them before the transition.


[*] Other
Thank you for reading my thread, if you want to support what I do you might buy me a coffe! Join to my Discord server if you want to follow the development of my gamemode.

If you find any bug, please let me know.

Best regards.
Reply
#2

You should add different dissolve types with different effects. Like timing, ambient fading overlay etc. Which means creating a function CreateDissolveType().
Reply
#3

Pretty good looking! Good job.
Reply
#4

Quote:
Originally Posted by Pottus
View Post
You should add different dissolve types with different effects. Like timing, ambient fading overlay etc. Which means creating a function CreateDissolveType().
This ^.

Thanks for the release, this is going to be very helpful on my upcoming project.
Reply
#5

Quote:
Originally Posted by Pottus
View Post
You should add different dissolve types with different effects. Like timing, ambient fading overlay etc. Which means creating a function CreateDissolveType().
Yea, that's cool.
Reply
#6

I think this is cool, good job!
Reply
#7

Look really good, thanks.
Reply
#8

Quote:
Originally Posted by cuber
View Post
This ^.

Thanks for the release, this is going to be very helpful on my upcoming project.
Looking at this release it looks more like a prototype than a polished release but still good enough for a early version release.

With some common sense feature updates this could be one of the better FS/Include released this year.
Reply
#9

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)