• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] Custom "Blink" SFX only shows target SFX

Status
Not open for further replies.
Level 12
Joined
Jan 30, 2020
Messages
875
Hello again everyone !

The last inexplicable bug I can not solve in my map is really strange :

I made a custom "auto-blink" ability for my map's Hero Builders, based off the "smart" order. It allows the builder to move fast in order to manage everything (attacking Balls or building Towers / Maze).

Anyways, the ability works like a charm, except that when it is triggered, I want to display the Blink Caster effect on the original unit position, and the Blink Target special effect on the target point of the order.
But the Blink Caster effect does not show.
When I debug the two positions, they are effectively different, but for some MAGICAL reasons, only the second effect actually shows.

Note that I also have a custom spell for one of my Towers that also teleports targets from point A to point B with the Mirror Image Caster special effect, and this one, although looking nearly identical, does indeed display both special effects at the right positions !!!!

So here is the Auto-Blink trigger action :

JASS:
function DoTheBlink takes nothing returns nothing
    local unit theUnit=GetOrderedUnit()
    local real oX=GetUnitX(theUnit)
    local real oY=GetUnitX(theUnit)
    local real tX=GetOrderPointX()
    local real tY=GetOrderPointY()

    // For some reason, the Origin and the target have proper different values, yet the SFX does not display at (oX, oY)
    // call BJDebugMsg("Origin$"+R2S(oX)+","+R2S(oY)+" - Destination ="+R2S(tX)+","+R2S(tY)) ----> Shows proper different coordinates
    call PlayCleanSFX(SFXBlinkCaster , oX , oY, 1.40, 0.00, 1.00)
    call SetUnitPosition(theUnit, tX, tY)
    call PlayCleanSFX(SFXBlinkTarget , tX , tY, 1.40, 0.00, 1.00)
    set theUnit=null
endfunction

I initially though I messed up the sfx string global variable SFXBlinkCaster so I tried with other sfx strings with no more success.

As for PlayCleanSFX function, it's just a custom function to display an SFX with coordinates, effect size, effect facing angle and expiration timer) - this function works great I can't explain why this Blink origin effect does not show.

Just to compare, the other similar action I mentioned earlier that actualy displays both effects properly is this one :

JASS:
function DoFlashForward takes nothing returns nothing
    local unit exGF=GetSpellTargetUnit()
    local real oX=GetUnitX(exGF)
    local real oY=GetUnitY(exGF)
    local integer exGFNb=GetUnitUserData(exGF)
    local integer dest=Destination[exGFNb]
    local real tX=WPx[dest]
    local real tY=WPy[dest]
    local real exGFHP=GetWidgetLife(exGF)
 
    if (ModuloInteger(dest, 10))<8 then
        call PlayCleanSFX(SFXFlashForward, oX , oY, 1.40, 0.00, 1.00)
        call PauseUnit(exGF, true)
        call SetUnitInvulnerable(exGF, true)
        call ShowUnit(exGF, false)
        call SetUnitPosition(exGF, tX, tY)
        call PlayCleanSFX(SFXFlashForward, tX , tY, 1.40, 0.00, 1.00)
        call SetWidgetLife(exGF, exGFHP/2)
        call ShowUnit(exGF, true)
        call SetUnitInvulnerable(exGF, false)
        call PauseUnit(exGF, false)
        set Destination[exGFNb]=dest+1
        call IssuePointOrder(exGF, "move", WPx[dest+1], WPy[dest+1])
    endif
    set exGF=null
endfunction

Destination is just an array that stores the current WayPoint Rect number the target is moving to.
And the WPx and WPy global arrays contain the coordinates of the said WayPoints.

If anyone is able to understand why the Origin special effect works in second example and not in the first one, this would be pure genius as I have been banging my head on the walls about this issue since December 2019 !!!

Thanks to anyone who will be able to help, take care guys !
 
Last edited:
Level 12
Joined
Jan 30, 2020
Messages
875
Oh no, I can't be THAT stupid.

Well obviously I am... I can't believe I missed this. Thanks, and sorry for wasting your time : after 4 months I really have no excuse whatsoever.
 
Status
Not open for further replies.
Top