• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Imported fade filter for single player

Status
Not open for further replies.
Level 5
Joined
Sep 27, 2011
Messages
141
how do I apply a different imported fade filter for each player of 4 players. Heres what i have been using but it doesnt work so i would like a neew trigger.

Set Players = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User)))
Custom script: if IsPlayerInForce(GetLocalPlayer(),udg_Players) then
Custom script: call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.00, "ReplaceableTextures\\CameraMasks\\Scope_Mask.blp", 0, 0, 0, 0 )
Custom script: endif
Custom script: call DestroyForce(udg_Players)

whenever i use this it just causes a fatal error i don't know why so please help.
 
Use [ trigger ] and [ /trigger ] to show gui triggers :)

Btw, I suggest loop instead group because group call another function and you can't share local player like that, it's unsafe.
Dunno am I right about this one but try not to store it into variables and move from function to function.
Otherwise it can cause disconnects.
  • Custom script:local integer i = 0
  • Custom script:loop
  • Custom script:exitwhen i> 11
  • Custom script:if GetLocalPlayer() == Player(i) then
  • DO YOUR STUFF HERE
  • Custom script:endif
  • Custom script:set i = i + 1
  • Custom script:endloop
local player will always be some player, so you don't need conditions like is player(0) user, also if player(4) isn't playing, if function will just skip that part.
Small note: Player(0) <- Red, Player(1) <-Blue

JASS:
local integer i = 0

loop
    exitwhen  i> 11

     if GetLocalPlayer() == Player(i) then
     //DO YOUR STUFF HERE
     endif

     set i = i + 1
endloop
 
Level 5
Joined
Sep 27, 2011
Messages
141
K ill try that but how do you apply an imported fade filter eg what would the path be like warcraft3mapimported or something?

Edit. I tried both you gui and jass neither of which work i mean i cannot enable them due to errors.
 
I guess because you just imported whole code just like this right?
local variables local integer i = 0 must be declared below function declaration.

JASS:
function testF takes nothing returns nothing
    local integer i = 0
    
    //bla bla bla bla
    
    loop
    exitwhen  i> 11

     if GetLocalPlayer() == Player(i) then
     //DO YOUR STUFF HERE
     endif

     set i = i + 1
endloop
endfunction

//===========================================================================
function InitTrig_test takes nothing returns nothing
    set gg_trg_test = CreateTrigger(  )
    call TriggerAddAction( gg_trg_test, function testF )
endfunction

Same thing for gui, just move that local variable custom script to the top.

THIS WILL WORK
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: local integer i
      • Melee Game - Use melee time of day (for all players)
THIS WON'T WORK
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Melee Game - Use melee time of day (for all players)
      • Custom script: local integer i
 
Level 5
Joined
Sep 27, 2011
Messages
141
thanks kobas i dont know aything about jass but it works now here is my script please tell me if there is anything wrong with it.

function Trig_Camera_filter_Actions takes nothing returns nothing
local integer i = 0



loop
exitwhen i> 3

if udg_Integer> 6 then
if GetLocalPlayer() == Player(i) then
call CinematicFilterGenericBJ( 0.00, BLEND_MODE_KEYALPHA, "ReplaceableTextures\\CameraMasks\\K5.blp", 100, 100, 100, 0.00, 1000, 100, 100, 0 )
endif
if udg_Integer == 14 then
set udg_Integer = 1
endif
else
if GetLocalPlayer() == Player(i) then
call CinematicFilterGenericBJ( 0.00, BLEND_MODE_KEYALPHA, "ReplaceableTextures\\CameraMasks\\K1.blp", 100, 100, 100, 0.00, 1000, 100, 100, 0 )
endif
endif

set i = i + 1
endloop
set udg_Integer = udg_Integer + 1
endfunction

//===========================================================================
function InitTrig_Camera_filter takes nothing returns nothing
set gg_trg_Camera_filter = CreateTrigger( )
call DisableTrigger( gg_trg_Camera_filter )
call TriggerRegisterTimerEventPeriodic( gg_trg_Camera_filter, 0.03 )
call TriggerAddAction( gg_trg_Camera_filter, function Trig_Camera_filter_Actions )
endfunction
 
Here you go test map!
0.03 will result fast blinking, light lightning when you turn switch on.

You can use GUI, just look at my code.
Also you can run that trigger on map initialization it will crush game.

Another thing, udg_i is your integer i variable, but because you use it in custom script you must add udg_ before it's name.

I show player number (in jass player red is Player(0), player blue is Player(1), in GUI Player(1) ir red and Player(2) is blue) that's why I added that udg_i = i + 1

Don't forget to set it's value back to 0 like I did, otherwise it will increase it's value to infinite.

Trigger show in test map will show different fade filter to first 3 players and to other players, just like I did that in example trigger.

And that's it, you don't need jass at all :)
 

Attachments

  • aaa.w3x
    16.3 KB · Views: 112
There is a risk of having a desync when you use a fade filter within a local player block. If you can, you should try to change your trigger so it is more like the one described here:
http://www.hiveworkshop.com/forums/cinematics-268/tips-tricks-cinema-39854/#F

That way, it will show properly without any player disconnections. =)

i dont know how to give +rep

You simply click this image
reputation.gif
underneath their name/avatar.
 
It can desync because it will destroy a timer within a local player block. (and locally destroying handles can desync [with the exception of certain handles that have separate handle stacks])

This is how I would approach it:
  • 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
  • Cinematic - Fade out and back in over 2.00 seconds using texture FilterString and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
Just change the trigger accordingly. You need two variables. One string array named FilterPath and one string variable named FilterString.

Change the FilterPath variables to the different filter masks you want to show. (Filter[1] will be showed to Player 1 (red), Filter[2] will be showed to Player 2 (blue), etc...)

Keep the loop the same way as I made it. Then just change the cinematic filter function according to however you want the filter to be made. (although, make sure that the texture used is the FilterString variable)

That should work just fine without creating any desyncs. It works by setting the path for the filter differently for each player. That way, they are all shown a filter at the same time with the same settings, but with a different mask. =)
 
Last edited:
Level 5
Joined
Sep 27, 2011
Messages
141
hey purge and fire one problem i have with using the filters is that tooltips for spells and anything else for the unit do not show up is there anyway to fix this. And ill try your system.
 
I'm not sure what you mean. Here are the textures for the filters:
  • Set FilterPath[1] = "war3mapImported\\MyFilter1.blp"
  • Set FilterPath[2] = "war3mapImported\\MyFilter2.blp"
  • Set FilterPath[3] = "war3mapImported\\MyFilter3.blp"
  • Set FilterPath[4] = "war3mapImported\\MyFilter4.blp"
You can replace them with whatever you want. If you don't want a filter to be displayed, you can just use ""

Some can also be the same as well, if you want it to be. It depends on what you are going for. Perhaps you can rephrase your question, I'm not exactly sure what you're asking.
 
Level 5
Joined
Sep 27, 2011
Messages
141
Well first of all this is for an fps I'm making but my problem is that variables array or not cannot be used in the fade filter function because it does not give you the option to do so.
 
Um, out of curiosity, what is a fade filter?

A fade filter is basically an image spread across the screen. It is often used for cinematics to fade in and out. (for example, you can fade the screen to go black, then fade it back in) For more information, you can check any of the cinematic tutorials we have here. ;)

Well first of all this is for an fps I'm making but my problem is that variables array or not cannot be used in the fade filter function because it does not give you the option to do so.

You don't use the array in that function. You just do it like I did in my trigger that I posted earlier. (using the string variable) It only uses the array for convenience so that you can set the texture paths easily. It will automatically loop through and set the actual string used to their corresponding filter. (player 1 red uses the FilterPath[1], player 2 blue uses FilterPath[2], player 3 teal uses the FilterPath[3]..etc..)
 
Level 5
Joined
Sep 27, 2011
Messages
141
That's why i said array or not because i cannot use either if i was able to use variables in a fade filter i would have already done so. So could you explain how to use the v.ariable in the fade filter
 
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. =)
 
Status
Not open for further replies.
Top