• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Fading filter

Status
Not open for further replies.
Level 10
Joined
Apr 13, 2005
Messages
630
This is a really tuff trigger that idk how to make. if anyones know the cinematic trigger then you could help. my trigger is this
  • Cinematic - Apply a filter over 10.00 seconds using Modulated 2x blending on texture Dream, starting with color (50.00%, 50.00%, 50.00%) and 100.00% transparency and ending with color (0.00%, 0.00%, 0.00%) and 0.00% transparency
I want it to only show it to one player but idk how to. can anyone help?
 
Level 9
Joined
Jul 3, 2008
Messages
495
It is possible with jass. Just use the GetLocalPlayer() native.

Player(0) = Player 1
Player(1) = Player 2
Player(2) = Player 3
etc. etc. etc
  • Actions
    • Custom script: if GetLocalPlayer() == Player(0) then
    • Cinematic - Fade out and back in over 2.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
    • Custom script: endif
 
Level 10
Joined
Jan 5, 2007
Messages
283
That is the whole code.

  • Actions
    • Custom script: if GetLocalPlayer() == {{PLAYER}} then
    • Cinematic - Apply a filter over 10.00 seconds using Modulated 2x blending on texture Dream, starting with color (50.00%, 50.00%, 50.00%) and 100.00% transparency and ending with color (0.00%, 0.00%, 0.00%) and 0.00% transparency
    • Custom script: endif
Replace {{PLAYER}} with the player that you want it to show for, for example, as MeKC has said, if you want it to show for player 1, use:

JASS:
If GetLocalPLayer() == Player(0) then

As the first Custom script. For player 2, you would use Player(1). Basically just the ingame player number minus one in the brackets.

As another example, if your trigger is... triggered by the death of a unit, and you wanted to filter to display only to the owner of the dying unit, you could use:

JASS:
If GetLocalPLayer() == GetOwningPlayer(GetDyingUnit()) then

If you're unsure of what you want it to be, please specify for which player you want the filter to show.
 
Level 3
Joined
Sep 24, 2007
Messages
64
I need this aswell, but when I tried I got errors.

Please help, +rep n big thanks

If GetLocalPLayer() == GetOwningPlayer(GetSpellTargetUnit()) then call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUTIN, 5.00, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 100.00, 0, 0, 80.00 ) endif

In my variations I got these errors:
Expected endif
Expected a code statement
 
Level 3
Joined
Sep 24, 2007
Messages
64
Actually no, I tried implementing this into a "custom script" line in GUI, just like you did. :eek:

This is the Jass version

JASS:
function Trig_Kommentar_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'AEmb' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Kommentar_Actions takes nothing returns nothing
    If GetLocalPLayer() == GetOwningPlayer(GetSpellTargetUnit()) then call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUTIN, 5.00, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 100.00, 0, 0, 80.00 )
    call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUTIN, 5.00, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 100.00, 0, 0, 80.00 )
    endif
endfunction
 
Level 8
Joined
Jun 20, 2004
Messages
229
uh, wish i had seen this earlier I would have helped when you first posted...

put this code in your mapname.w3x area in triggers. this function is much more efficient and more editable than the BJ.

JASS:
function CinematicFilterGenericForPlayer takes player whichPlayer, real duration, blendmode bmode, string tex, real red0, real green0, real blue0, real trans0, real red1, real green1, real blue1, real trans1 returns nothing
    if ( GetLocalPlayer() == whichPlayer ) then
        call SetCineFilterTexture(tex)
        call SetCineFilterBlendMode(bmode)
        call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
        call SetCineFilterStartUV(0, 0, 1, 1)
        call SetCineFilterEndUV(0, 0, 1, 1)
        call SetCineFilterStartColor(PercentTo255(red0), PercentTo255(green0), PercentTo255(blue0), PercentTo255(100-trans0))
        call SetCineFilterEndColor(PercentTo255(red1), PercentTo255(green1), PercentTo255(blue1), PercentTo255(100-trans1))
        call SetCineFilterDuration(duration)
        call DisplayCineFilter(true)
    endif
endfunction

Now, to call the script:

Target Unit:
JASS:
Custom script:   call CinematicFilterGenericForPlayer(GetOwningPlayer(GetSpellTargetUnit()), 1.0, BLEND_MODE_BLEND, "ReplaceableTextures\\CameraMasks\\YOURFILTER.blp",  100.0, 100.0, 100.0, 0.0, 100.0, 100.0, 100.0, 0.0 )

Unedited:
JASS:
call CinematicFilterGenericForPlayer( LOCAL_PLAYER, 1.0, BLEND_MODE_BLEND, "ReplaceableTextures\\CameraMasks\\YOURFILTER.blp",  100.0, 100.0, 100.0, 0.0, 100.0, 100.0, 100.0, 0.0 )

player seeing filter, filter duration in seconds, several blend modes, filter path your using, start red % of filter, start green % of filter, start blue % of filter, start transparency % of filter, end red % of filter, end green % of filter, end blue % of filter, end transparency % of filter
 
Last edited:
Level 3
Joined
Sep 24, 2007
Messages
64
Very thankful for what I perceive is a professional post =P

I -tried- implementing your script, I'm perfectly and completely useless in Jass ~~ I haven't actually been trying to learn until now.
Of the compiler results I concluded I was missing some sort of header or identifier(?)
I tossed around the names a bit till it didn't abort which gave me
JASS:
function CinematicFilterGenericForPlayer takes player whichPlayer, real duration, blendmode bmode, string tex, real red0, real green0, real blue0, real trans0, real red1, real green1, real blue1, real trans1 returns nothing
    if ( GetLocalPlayer() == whichPlayer ) then
        call SetCineFilterTexture(tex)
        call SetCineFilterBlendMode(bmode)
        call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
        call SetCineFilterStartUV(0, 0, 1, 1)
        call SetCineFilterEndUV(0, 0, 1, 1)
        call SetCineFilterStartColor(PercentTo255(red0), PercentTo255(green0), PercentTo255(blue0), PercentTo255(100-trans0))
        call SetCineFilterEndColor(PercentTo255(red1), PercentTo255(green1), PercentTo255(blue1), PercentTo255(100-trans1))
        call SetCineFilterDuration(duration)
        call DisplayCineFilter(true)
    endif
endfunction

//===========================================================================
function InitTrig_cinem takes nothing returns nothing
    set gg_trg_cinem = CreateTrigger(  )
    call TriggerAddAction( gg_trg_cinem, function CinematicFilterGenericForPlayer )
endfunction

Though, the trigger that calls the function won't compile after what I did.
Some further guidance would be greatly appreciated, and I will try and learn wtf I am doing. :hohum:

Edit: Oh by the way, the "Unedited" is the version to use in Jass scripts and other for GUI ~~ Or am I wrong? :/
 
Last edited:
Level 8
Joined
Jun 20, 2004
Messages
229
hmm, are you not showing the cinem function or you dont have it at all? also, what i posted was meant to be used as a custom script.

lol, what I think your doing right now is trying to make the filter function an action which will essentially wont work.

your going to need to make your cinem actions function and add each call in the filter function and define their values so it works. i should have pointed out to use it for script calling but you can just call.

JASS:
    if ( GetLocalPlayer() == whichPlayer ) then
        call SetCineFilterTexture(tex)
        call SetCineFilterBlendMode(bmode)
        call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
        call SetCineFilterStartUV(0, 0, 1, 1)
        call SetCineFilterEndUV(0, 0, 1, 1)
        call SetCineFilterStartColor(PercentTo255(red0), PercentTo255(green0), PercentTo255(blue0), PercentTo255(100-trans0))
        call SetCineFilterEndColor(PercentTo255(red1), PercentTo255(green1), PercentTo255(blue1), PercentTo255(100-trans1))
        call SetCineFilterDuration(duration)
        call DisplayCineFilter(true)

those would all have to be called inside the cinem actions function with actual values unless you want to just use a script and call it like:

JASS:
function Trig_Filter_Actions takes nothing returns nothing
    call CinematicFilterGenericForPlayer(GetOwningPlayer(GetSpellTargetUnit()), 1.0, BLEND_MODE_BLEND, "ReplaceableTextures\\CameraMasks\\White_Mask.blp", 100.0, 100.0, 100.0, 0.0, 100.0, 100.0, 100.0, 100.0 )
endfunction

get spell target unit was assuming the filter appears when an ability is cast on the player.
 
Last edited:
Level 3
Joined
Sep 24, 2007
Messages
64
Hm.. I think you're overrating me :s

I don't really get what you're saying, I don't know the basics of programming - and this is not using vJass or something of the sort?
I can't see how deathdoorway even got the first, simple GUI script to work since it just won't compile for me. I copy-pasted it all aswell.

Maybe knowing my course of actions would help you help me :?

I opened the WE
I opened the trigger window
I made a trigger and named it cinem
I converted it to custom script
I copy pasted the first piece of script you posted into my trigger
JASS:
function CinematicFilterGenericForPlayer takes player whichPlayer, real duration, blendmode bmode, string tex, real red0, real green0, real blue0, real trans0, real red1, real green1, real blue1, real trans1 returns nothing
    if ( GetLocalPlayer() == whichPlayer ) then
        call SetCineFilterTexture(tex)
        call SetCineFilterBlendMode(bmode)
        call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
        call SetCineFilterStartUV(0, 0, 1, 1)
        call SetCineFilterEndUV(0, 0, 1, 1)
        call SetCineFilterStartColor(PercentTo255(red0), PercentTo255(green0), PercentTo255(blue0), PercentTo255(100-trans0))
        call SetCineFilterEndColor(PercentTo255(red1), PercentTo255(green1), PercentTo255(blue1), PercentTo255(100-trans1))
        call SetCineFilterDuration(duration)
        call DisplayCineFilter(true)
    endif
endfunction
I added the other line (and skipped the last because I thought it wasnt necessary(?)) into a Custom Script action in a normal GUI trigger
I compiled, and got errors.
I then rewrote some of it on random and the compilation for the first script worked - the one I posted. I thought you had left something out(?)

I shall not give up! :/
 
Level 8
Joined
Jun 20, 2004
Messages
229
you should probably just stick to gui and use it as a script. so, instead paste the filter code into your map name area. if my map was named test, go to the triggers and click on test.w3x and there is a comment and custom script area. paste it in the custom scripts box. i still dont know what your trigger is going to do, like is the filter being applied when you cast an ability on someone etc? the custom scripts local player will be different depending on how your cinem trigger will work. we can get it working easily using custom scripts instead if you can just make the trigger in gui and paste the text. (not convert to code)
 
Level 3
Joined
Sep 24, 2007
Messages
64
Oh, shit.. Now I get it xD --- stupid.

So I inserted your first script into the mapname.w3x area, but I got over 1000 compile errors when trying to run the map after that.

expected code statement, expected endif etc all over.

---

Is the first script dependent on how I am going to use it? Just the 'call' right? :grin:
I have an AoE custom spell that would pick the nearest target in a small area and run the cinematic script on that picked target player. The unit would probably be given a variable in GUI.
Then that's the first, main use right now ~~ though there is probably alot to come using this kind of function.

It looks like this atm
111hlap.jpg

Hope it's not too small ;...;
 
Level 8
Joined
Jun 20, 2004
Messages
229
yup thats it. now if you want to call the custom script and apply it to the player of picked unit do this.

JASS:
call CinematicFilterGenericForPlayer(GetOwningPlayer(GetEnumUnit()), 1.0, BLEND_MODE_BLEND, "ReplaceableTextures\\CameraMasks\\White_Mask.blp", 100.0, 100.0, 100.0, 0.0, 100.0, 100.0, 100.0, 0.0 )

this will go in a custom script action and you can mess around with the numbers and filter paths to get what you want.
 
Level 3
Joined
Sep 24, 2007
Messages
64
Yeah, you're right.. I mixed stuff up in the calling, it works! +REP

But it's permanent, you said I could easily change it in the calling?
There's no explaining what all those variables do, but I set all 0's to 1 because I assumed a 0 would be infinite - it's still the same, exactly :eek:

So what do I do? And how do I abort the filter in a function? And can I stack multiple filters with this?

Sorry for the question flooding :D ~~
 
Level 8
Joined
Jun 20, 2004
Messages
229
sorry i was busy today so im just now getting to reply...
JASS:
call CinematicFilterGenericForPlayer( LOCAL_PLAYER, 1.0, BLEND_MODE_BLEND, "ReplaceableTextures\\CameraMasks\\YOURFILTER.blp", 100.0, 100.0, 100.0, 0.0, 100.0, 100.0, 100.0, 0.0 )

ok basically, the 1.0 up there between local player and the blend mode is how long the filter will fade, meaning how long it takes to get from the first RGB T to the second RGB T. So if you want, say a blood screen you would have your filter path and then if the filter were white, you would have 100.0, 0.0, 0.0, 0.0. These first four numbers are the Red Green and Blue as well as the Transparency. There are a total of eight numbers to edit. The first four are the starting values the second are the ending values. So in the beginning 100,0,0,0 will mean the filter will appear with 100% red coloring and 0% coloring in everything else and be completely solid since the transparency is 0. Now, the last four numbers are the ending colors. So if you want the blood to just flash for a few seconds, the last numbers would be 0.0,0.0,0.0,100.0. you can actually have any values set since the last number will be 100.0 meaning the whole image will be 100% see through and you can not see it, This basically means after the 2 seconds or whatever it was set to, the filter will still be there but you cant see it. This will not effect future filters so it works out nicely.

So, just to make sure you understand. Here would be an example of a filter that flashes in and out as if you were being shot or hurt and it brings up a short blood screen.

JASS:
call CinematicFilterGenericForPlayer( LOCAL_PLAYER, 2.0, BLEND_MODE_BLEND, "ReplaceableTextures\\CameraMasks\\DiagonalSlash_mask.blp", 100.0, 0.0, 0.0, 0.0, 100.0, 100.0, 100.0, 100.0 )

This will instantly bring up a red slash filter that would appear instantly and fade out over 2 seconds. There are other blend mode options to put in instead of blend_mode_blend that may fade in as well as fade out but I would have to find the list somewhere if I can find it.
 
Level 3
Joined
Sep 24, 2007
Messages
64
Hmmm, I see..
One thing though,
for instance my filter would apply when unit is picked, if would be like a devour and the targeted player is looking out ~~ it will lock and sway the camera aswell. But when the triggering - devouring - unit dies, this would have to be aborted, since the unit is released. How do I solve this problem?

Edit: I found a kind of solution, getting it to apply the filter every 1 seconds as long as a trigger is on, but.. The filter applies to a player owning a unit I have given a variable in GUI which is called BodyslamPloppad.
So if I want to apply the filter to the player owning that unit, how do I do? I tried GetOwningPlayer(BodyslamPloppad()) and GetOwningPlayer(GetBodyslamPloppad()) - none worked obviously :)
Or isn't this possible?

I think this question will finish it =P
 
Last edited:
Level 8
Joined
Jun 20, 2004
Messages
229
well if i understand you correctly, you want the filter to be applied when a unit is picked and the filter to stay on for the player until the unit dies? if that is the case, just make the filter 100 100 100 0 100 100 100 0. So basically it will start with the image fully colored and no transparency, and end the same as well so when the script is done you will still have the filter on the players screen. and when he dies, just make a script that calls a filter that will make it 0 0 0 100 0 0 0 100 so they cant see it.

use this for the picked unit.

JASS:
GetOwningPlayer(udg_BodyslamPloppad[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))])
 
Status
Not open for further replies.
Top