SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 10/03/2019, 12:11 PM   #1
RIDE2DAY
Huge Clucker
 
RIDE2DAY's Avatar
 
Join Date: Jul 2015
Location: Modena, Italy
Posts: 213
Reputation: 381
Default DissolvePlayerScreen

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.

Last edited by RIDE2DAY; 10/03/2019 at 03:00 PM.
RIDE2DAY is offline   Reply With Quote
Old 10/03/2019, 06:21 PM   #2
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,885
Reputation: 1321
Default Re: DissolvePlayerScreen

You should add different dissolve types with different effects. Like timing, ambient fading overlay etc. Which means creating a function CreateDissolveType().
Pottus is offline   Reply With Quote
Old 10/03/2019, 07:33 PM   #3
TheToretto
Gangsta
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 585
Reputation: 66
Default Re: DissolvePlayerScreen

Pretty good looking! Good job.
__________________






Toretto#9902

Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Old 10/03/2019, 09:21 PM   #4
cuber
Gangsta
 
cuber's Avatar
 
Join Date: Oct 2016
Posts: 848
Reputation: 213
Default Re: DissolvePlayerScreen

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.
__________________



A new Heavy Roleplay server.

Forums | Discord

cuber is offline   Reply With Quote
Old 10/03/2019, 10:12 PM   #5
FinStar
Big Clucker
 
Join Date: Nov 2013
Location: Instead of nothing
Posts: 155
Reputation: 0
Default Re: DissolvePlayerScreen

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.
FinStar is offline   Reply With Quote
Old 11/03/2019, 04:45 AM   #6
N0FeaR
High-roller
 
N0FeaR's Avatar
 
Join Date: Nov 2011
Location: Sweden
Posts: 2,304
Reputation: 167
Default Re: DissolvePlayerScreen

I think this is cool, good job!
N0FeaR is offline   Reply With Quote
Old 11/03/2019, 06:03 AM   #7
N3cromancer
Big Clucker
 
N3cromancer's Avatar
 
Join Date: Feb 2015
Location: Venezuela
Posts: 137
Reputation: 10
Default Re: DissolvePlayerScreen

Look really good, thanks.
__________________
Need scripter for fix bugs / make new systems to your server? add me on Discord: LuisR#9288
N3cromancer is offline   Reply With Quote
Old 11/03/2019, 04:17 PM   #8
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,885
Reputation: 1321
Default Re: DissolvePlayerScreen

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.
Pottus is offline   Reply With Quote
Old 21/03/2019, 04:29 PM   #9
Chaprnks
Gangsta
 
Chaprnks's Avatar
 
Join Date: Sep 2007
Location: Soviet America
Posts: 592
Reputation: 69
Default Re: DissolvePlayerScreen

__________________
Chaprnks is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 08:27 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.