Fade System's really horrible bug!

Reaction score
456
Fade System thread

When I create units like this..

JASS:
function FadeSystemDoesNotWorkProperly takes nothing returns nothing
    local integer i = 0
    local unit u
    local location l = GetRectCenter(bj_mapInitialPlayableArea)
    loop
        exitwhen i == 8
        set u = CreateUnitAtLoc(Player(15), 'h000', l, i*(360/8))
        call FadeUnit(u, 0.00, 2.00, true)
        set u = null
        set i = i + 1
    endloop
    call RemoveLocation(l)
    set l = null
endfunction


.. it first creates one unit, fades it, and after the unit has faded, it creates another unit and fades it..

So I have no idea what's happenin' here :p ?
 

Omni

Ultra Cool Member
Reaction score
37
Explain whats wrong?

i see you create a unit then you do that fade thing.

ehh:
.. it first creates one unit, fades it, and after the unit has faded, it creates another unit and fades it..

whats wrong ô.ô?

Edit
i mean if you dont want it to wait, mix in some globals and execute func.
 
Reaction score
456
So if there is no this line in the loop..

JASS:
        call FadeUnit(u, 0.00, 2.00, true)


.. it creates the units at the same time, but if it is there, the units aren't created at the same time.
 
Reaction score
456
Oh god.. How should I explain this... :rolleyes:

Let's say.. You would like to create 2 units to the middle of the map at the same time. You'll be using this function:

JASS:
function Function001 takes nothing returns nothing
    local unit peasant
    local location center = GetRectCenter(bj_mapInitialPlayableArea)
    local integer i = 0 
    loop
        exitwhen i == 2
        set peasant = CreateUnitAtLoc(Player(15), 'hpea', center, 0.00)
        set peasant = null
        set i = i + 1
    endloop
endfunction


But then you think that it would be nice to fade them away after they are created, then you add this function call to it:

JASS:
function Function001 takes nothing returns nothing
    local unit peasant
    local location center = GetRectCenter(bj_mapInitialPlayableArea)
    local integer i = 0 
    loop
        exitwhen i == 2
        set peasant = CreateUnitAtLoc(Player(15), 'hpea', center, 0.00)
        call FadeUnit(peasant, 0.00, 5.00, true)
        set peasant = null
        set i = i + 1
    endloop
endfunction


But then it would create the first unit and fade it... but the second unit is created after the first unit has faded...

So that is my problem.
 

Omni

Ultra Cool Member
Reaction score
37
It will work you probably did something wrong, because execte func does not well ehh.. unexplainable the stuff will wait, but not what executed it:D

and why is it spam you dont listen to what i say, what i say is right(this time:p )

JASS:
function Omni takes nothing returns nothing
    call FadeThing(global,global,global,global)
endfunction

function Uberplayer takes ??? returs nothing
      set global = ???
      etc.
      call executefunc("Omni")
endfunction


maybe it doesnt work cause imnot case sensitive so correct some things but th should do it
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
You're spell uses a wait in a loop:
JASS:


The actual wait time it will do is about 0.27 seconds. So it waits that amount and may cause a delay. :)

And the periodic timer adds to the duration. :D
 

Tom Jones

N/A
Reaction score
437
In your system, I don't get this part:
JASS:
    loop
        exitwhen (dat.fade_current124k >= 100.00 - dat.fade_minimum124k)
        call TriggerSleepAction(0.00)
    endloop
Why not:
JASS:
function PeriodUnitFade takes nothing returns nothing
    local integer i = 0
    local fadesystem_data dat
    loop
        exitwhen (i == FadeSystem_total)
        set dat = FadeSystem_array<i>
        if (dat.fade_current124k &gt;= 100.00 - dat.fade_minimum124k) then
            if (dat.fade_remove124k == true) then
                call RemoveUnit(dat.fade_unit124k)
            endif
            set FadeSystem_array<i> = FadeSystem_array[FadeSystem_total - 1]
            set FadeSystem_total = FadeSystem_total - 1
            call dat.destroy()
            set i = i - 1
        else
            set dat.fade_current124k = dat.fade_current124k + ((100-dat.fade_minimum124k)/dat.fade_duration124k)*0.03
            call SetUnitVertexColor(dat.fade_unit124k, 255, 255, 255, R2I((100-dat.fade_current124k)*I2R(255)*0.01))    
        endif
        set i = i + 1
    endloop
    if (FadeSystem_total == 0) then
        call PauseTimer(FadeSystem_timer)
    endif
endfunction</i></i>
That method saves you a struct member, not that it matters much though.
 
Reaction score
456
>You're spell uses a wait in a loop:
Not a spell, but a system. And of course it uses wait.. Else it would hit op limit.

@Tom Jones
Ah.. I don't mind changing that right now, thanks for the notice though.. You still helped me with my system in the thread, thanks for that!
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
call code_func executes a code given to him, in the same thread. In other words, in your system you use waits to detemine when the unit has faded, which means the code will not proceed until the unit, indeed finished fading, it is not a bug, this is how Jass works as far as I know.

What can you do about it? I don't think you can do something about it without globals and ExecuteFunc or timer, or try to replace TriggerSleepActions with something else.





I might have been wrong in this whole post, what I said here is not confirmed, but rather just guesses.
 
Reaction score
456
Well.. It is not a bug in JASS, but it was a bug in my Fade System.

Thanks for your time, but the system works now when I use a bit different way, which Tom told in the main Fade System thread.
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
> Well.. It is not a bug in JASS, but it was a bug in my Fade System.

May have been both things. And I never said it was a Jass bug, but rather, the way Jass works.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top