• 🏆 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] Local Fade Filter

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
Early days of creating a simple local fade filter and I'm new to Jass. I can save my map without compiling errors, but when the function is called in-game, Warcraft 3 crashes. Can someone help me work out why?

JASS:
function LocalFadeFilter takes player p , string texture , integer duration returns nothing

    local timer delay = CreateTimer()

    call BJDebugMsg("LocalFadeFilter called")
    call TriggerSleepAction( 2 )

    if GetLocalPlayer() == p then
        call EnableUserUI(false)
        call SetCineFilterTexture(texture)
        call SetCineFilterBlendMode(BLEND_MODE_BLEND)
        call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
        call SetCineFilterStartUV(0, 0, 1, 1)
        call SetCineFilterEndUV(0, 0, 1, 1)
        call SetCineFilterStartColor(255, 255, 255, 255)
        call SetCineFilterEndColor(255, 255, 255, 0)
        call SetCineFilterDuration(duration)
        call BJDebugMsg("Variables Set. Ready to Display Filter")
        call TriggerSleepAction( 2 )
        call DisplayCineFilter(true)
    endif

    //call TimerStart(delay, duration, false, function LocalFadeFilterContinued(p, filter, duration))

endfunction

The function is called from a GUI trigger.

  • FadeFilter Test
    • Events
      • Player - Player 1 (Red) types a chat message containing -fade as A substring
    • Conditions
    • Actions
      • Custom script: call LocalFadeFilter(GetTriggerPlayer() , "PalletTown.blp" , 3 )
I'm not really sure what this native does or how to use it:

JASS:
SetCineFilterTexMapFlags texmapflags whichFlags
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
I've been using that page as a reference though I was experiencing crashes however I found out the problem. The GUI was passing the wrong texture path!! It was an null texture! I corrected the path and it now works. It's always something so simple.....

Edit:

You shouldn't use TriggerSleepAction locally, it can screw things up.

I only implemented them with the debug messages to see when the function crashed. Though can you tell me why I shouldn't use them within locals? I'm using local variables, so data shouldn't be overwritten by future executions?
 
Level 39
Joined
Feb 27, 2007
Messages
5,024
Nothing to do with local variables or things being overwritten. He means don't use it inside of a local player if-block:
JASS:
if GetLocalPlayer() == whateverPlayer then
    //call TriggerSleepAction(don't)
endif
It can desync the trigger queue, which most likely disconnects some of your players
 
Status
Not open for further replies.
Top