Ohhhh... I see what you mean. Sorry, I haven't touched GUI in a while, that code was just made freehand so I didn't know they placed that restriction.
Anyway, in that case, then you will have to use a custom script line. To do this, just create a separate trigger, and then add your filter function to it. Change everything as you want it, except for the texture (because we will change that later). Once you've done that, just go to
Edit -> Convert to Custom Text, and then copy the entire line that begins with
call CinematicFadeBJ
or anything similar.
For example, the custom script could look like this:
-
Custom script: call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUTIN, 2, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 100, 100, 100, 0 )
Now you just need to change the "ReplaceableTextures\\CameraMasks\\White_mask.blp" part. You can just change it to
udg_FilterString
So here is an example of what the entire trigger would look like:
-
Set FilterPath[1] = war3mapImported\MyFilter1.blp
-
Set FilterPath[2] = war3mapImported\MyFilter2.blp
-
Set FilterPath[3] = war3mapImported\MyFilter3.blp
-
Set FilterPath[4] = war3mapImported\MyFilter4.blp
-
Set FilterString = <Empty String>
-
-------- This is just to initialize the strings so that they are entered into the string table ---------
-
For each (Integer A) from 1 to 4, do (Actions)
-
Loop - Actions
-
Custom script: if GetLocalPlayer() == Player(bj_forLoopAIndex) then
-
Set FilterString = FilterPath[bj_forLoopAIndex]
-
Custom script: endif
-
Custom script: call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUTIN, 2, udg_FilterString, 100, 100, 100, 0 )
If you need to change it, just redo the process and replace the line. It is a little bit of a hassle, but it is the easiest way to do it in GUI. If you want to know what each part of the function does for easier modification, then you can read on:
function CinematicFadeBJ takes integer fadetype, real duration, string tex, real red, real green, real blue, real trans returns nothing
That is the base function. So when you want to execute it, you do
call CinematicFadeBJ( <fadetype>, <duration>, <tex>, <red%>, <green%>, <blue%>, <trans%>)
.
Here is a breakdown of each argument:
integer fadetype
- This is the type of fading. In GUI, it would be "Fade out", "Fade in", or "Fade out and back in". The three options in JASS can be written as:
JASS:
bj_CINEFADETYPE_FADEIN
bj_CINEFADETYPE_FADEOUT
bj_CINEFADETYPE_FADEOUTIN
Any of those three will work as the first argument in the parentheses. () In my example, I used bj_CINEFADETYPE_FADEOUTIN because I want it to fade out and then fade back in.
real duration
- This is the duration over which the filter occurs. Just like in GUI, it is just a number. In my example, I used 2
seconds. You can replace it with whatever you want.
string tex
- This is the texture file for the filter. In our case, we want to use the global variable "FilterString", so we just put udg_FilterString for that part.
real red, real green, real blue, real trans
- These are all the percentages of red, green, and blue color, as well as the alpha (transparency) as the last argument. The number will be anything from 0-100, just like GUI. In my example, I use 100 for all 3 colors with 0 transparency.
When you piece them all together, you get something like this:
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUTIN, 2, udg_FilterString, 100, 100, 100, 0 )
That is a filter that fades out and then back in over 2 seconds using the texture listed in FilterString. It has 100% red green and blue color, and 0% transparency. Voila, you are done. =)