• 🏆 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!

[JASS] Help! - Applying a Fade Filter for only one player

Status
Not open for further replies.
Level 2
Joined
Oct 4, 2009
Messages
8
Hi lads.
Im currently working on a version of BattleShips that allows ships to submerge down to the ground of the sea, offering a second plane to fight. My trigger in GUI works pretty well, but i stumbled across some problems concering fade filters. As a total JASS newbie (yeah, im working on that ) i dont really know how to adapt a fade filter (white mask, slightly blue transparent to show you are really underwater) so that it only affects the submerging player, not everyone. As far as i know, it's JASS only, and I know this works, because I've seen it in a map called Water Wars - but as i said, im a newb. I just want to know what to script in order to achieve this effect (and maybe to end it upon emerging from the ground)
Here's my first trigger:

Code:
JASS:
function Trig_SubmersionDownwards_Actions takes nothing returns nothing
    call CameraSetTargetNoiseForPlayer( GetOwningPlayer(GetTriggerUnit()), 10.00, 1.00 )
    call SetCameraBoundsToRectForPlayerBJ( GetOwningPlayer(GetTriggerUnit()), gg_rct_Submersion )
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 6
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call SetItemDroppableBJ( UnitItemInSlotBJ(GetEnteringUnit(), GetForLoopIndexA()), false )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    set udg_ShipSpeedSubmersion[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] = GetUnitMoveSpeed(GetTriggerUnit())
    call SetUnitMoveSpeed( GetEnteringUnit(), ( GetUnitMoveSpeed(GetTriggerUnit()) / 2.00 ) )
endfunction

//===========================================================================
function InitTrig_SubmersionDownwards takes nothing returns nothing
    set gg_trg_SubmersionDownwards = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_SubmersionDownwards, gg_rct_Submersion )
    call TriggerAddAction( gg_trg_SubmersionDownwards, function Trig_SubmersionDownwards_Actions )
endfunction


A little explanation: It sets the camera field to the underwater zone, so noone can watch the upper and the lower plane the same time. It also makes all items carried by the hero undroppable and sets his movement speed to 50%. It would be great if the trigger would also create a fade filter for the player until his hero "emerges" from the sea.
And here's the "Emerge" Trigger:

Code:
JASS:
function Trig_SubmersionUpwards_Actions takes nothing returns nothing
    call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetTriggerUnit()), GetUnitLoc(GetTriggerUnit()), 0 )
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 6
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call SetItemDroppableBJ( UnitItemInSlotBJ(GetEnteringUnit(), GetForLoopIndexA()), true )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    call SetUnitMoveSpeed( GetEnteringUnit(), udg_ShipSpeedSubmersion[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] )
endfunction

//===========================================================================
function InitTrig_SubmersionUpwards takes nothing returns nothing
    set gg_trg_SubmersionUpwards = CreateTrigger(  )
    call TriggerRegisterLeaveRectSimple( gg_trg_SubmersionUpwards, gg_rct_Submersion )
    call TriggerAddAction( gg_trg_SubmersionUpwards, function Trig_SubmersionUpwards_Actions )
endfunction


I hope you can tell me what and where to script my trigger in order to recieve the effect I want.

Greetings, Atarion
 
Last edited:
Level 6
Joined
Oct 31, 2008
Messages
229
Well.. you must learn first of all jass, so you can use the GetLocalPlayer() command.
Then you can find what you need in the function list in jngp (jassnewgenpack)

And if this is converted GUI, why dont you just send it in GUI form?
 
Level 2
Joined
Oct 4, 2009
Messages
8
Ok i thought converted JASS would make things a easier for scripting but as you wanted, I now post it in GUI (added the "wrong" fade filter, you won't find it in the JASS script).
  • Ereignisse
    • Einheit - A unit enters Submersion <gen>
  • Bedingungen
  • Aktionen
  • Aktionen
    • Video - Ausblenden over 0.00 seconds using texture Weiße Maske and color (0.00%, 75.00%, 100.00%) with 60.00% transparency
    • Kamera - Sway the camera target for (Owner of (Triggering unit)) with magnitude 10.00 and velocity 1.00
    • Kamera - Set the camera bounds for (Owner of (Triggering unit)) to Submersion <gen>
    • For each (Integer A) from 1 to 6, do (Actions)
      • Schleifen - Aktionen
        • Gegenstand - Make (Item carried by (Entering unit) in slot (Integer A)) Nicht ablegbar
    • Set ShipSpeedSubmersion[(Player number of (Owner of (Triggering unit)))] = (Current movement speed of (Triggering unit))
    • Einheit - Set (Entering unit) movement speed to ((Current movement speed of (Triggering unit)) / 2.00)
And concerning JASS newGen pack: I tried to download it twice but my AVG just deleted some files without my permission. So this doesn't work for me. I also checked the internet for finding a tutorial and stumbled over this one in a very old thread:

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

Well, though I tried to jump the gats of my JASS knowledge with the help of internet I wasn't able to script it so it will work for me.
Can you tell me what to change and post the adapted JASS script?
 
Status
Not open for further replies.
Top