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

[JASS] A Very Strange Bug ( TriggerSleepAction() makes it work? lol WUT?)

Status
Not open for further replies.
Level 4
Joined
Nov 24, 2007
Messages
55
So I encountered this strange bug while going through all my triggers, trying to purge all remnants of the use of

TriggerSleepAction()

now that I know how to use timers. I stumbled upon this one spell that uses it, a mere .1 second call, that I thought was completely unneccessary, since all that happens afterwards is a

call KillUnit()

function. After removing it I cleaned up the code (some), and went to save to make sure everything was okay before continuing (I am on a mac and am currently waiting for an upload of the RoC image to finish this minute actually, before i can download it onto my windows partition and install it on there and use NewGen or something more useful than default WE)
when I got an error in my script.

Looking at the error, I noticed it came from code created via GUI which made zero sense, since that code always worked fine. I then disabled the spell I was working on (this JASS one I'll display shortly), and viola, it compiled fine, thus confirming that it was causing the issue. I re-enabled, and again, no compilation. I then reinserted the TriggerSleepAction() command, and it worked.

Anyone have a freaking clue as to why that call would make this code compile, and why removing it would cause it to not compile? I am at a complete loss.

JASS:
function Trig_Sacrificial_Pit_Actions takes nothing returns nothing
    local unit spUnit = GetSpellTargetUnit()
    local unit caster = GetTriggerUnit()
    local unit dummy
    local integer loopstart = 1
    local integer loopend = 10

    call DestroyEffect(AddSpecialEffectLoc( "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", GetUnitLoc(spUnit) ) )

    loop
        exitwhen loopstart > loopend
        call DestroyEffect(AddSpecialEffectLoc( "Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", PolarProjectionBJ(GetUnitLoc(spUnit), 350.00, ( 36.00 * loopstart )) )
        set loopstart = loopstart + 1
    endloop

    dummy =  CreateUnit( GetOwningPlayer(caster), 'h003', GetUnitX(spUnit), GetUnitY(spUnit), 0 )
    call UnitAddAbilityBJ( 'A03P', dummy )
    call SetUnitAbilityLevelSwapped( 'A03P', dummy, GetUnitAbilityLevelSwapped('A02Y', caster) )
    call IssuePointOrderLocBJ( dummy, "flamestrike", GetUnitLoc( spUnit )  )
    call UnitApplyTimedLifeBJ( 3.00, 'BTLF', dummy )
    call TriggerSleepAction( 1.0 )
    call KillUnit( spUnit )
    set spUnit = null
endfunction
 
Status
Not open for further replies.
Top