Strange Bug

theXact

New Member
Reaction score
0
So I have this spell which a projectile bounces between players and puts them to sleep when hit, Every once and a while when they bounce a player will not be put to sleep, after many bug tests I have come to the conclusion that the dummy caster is not being created! So I added a loop to make the action be drawn out until the dummy caster was created and the target put to sleep but still no dummy caster was created, Just my bug finder flashing every 0.1 seconds because the exitwhen was never completed!

Please take a look at the code for this function and let me know what you think!

JASS:
function Cast_Sleep takes unit Target, unit Caster returns nothing
    local unit DCS // Dummy Caster
    local integer AL = GetUnitAbilityLevel(Caster, 'A01G') //ability level
    loop   
        if(GetUnitAbilityLevel(Target, 'B00J') > 0) then
            loop
                set DCS = CreateUnit(GetOwningPlayer(Caster),'e001',GetUnitX(Target),GetUnitY(Target),270) // DCS = Dummy Caster Sleep
                call UnitApplyTimedLife(DCS,'BTLF',10)
                call UnitAddAbility(DCS,'A01H')
                call SetUnitAbilityLevel(DCS,'A01H',AL)
                call SetUnitPathing(DCS,false)
                call SetUnitInvulnerable(DCS,true)
                call IssueTargetOrderById(DCS,OrderId("sleep"),Target)
                exitwhen GetUnitAbilityLevel(Target, 'B00I') > 0 or GetUnitState(Target, UNIT_STATE_LIFE)>0 == false
                // BUG FILTER PLACED HERE!!
                call TriggerSleepAction( 0.01 )
                call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl", Target, "origin"))
            endloop
            exitwhen 1==1
        endif
        call TriggerSleepAction( 0.01 )
    endloop
    if(IsUnitType(Caster, UNIT_TYPE_HERO))then 
        call Everlasting_Horrors(Target)
    endif
    call Sleep_Damage(Target, Caster, DCS)
    set DCS = null
    set Caster = null
    set Target = null
    set AL = 0
endfunction


If you feel the rest of the trigger code is relevant let me know and ill post it!
 

theXact

New Member
Reaction score
0
1 == 1 will always be true so when it reaches that point the loop will end, I suppose i could have just put true but i wasnt really thinking and just put what would have worked. That point will only be reached once a target is put to sleep, so it is not the cause of this bug.
 

ZugZugZealot

New Member
Reaction score
33
You can just use "exitwhen true" for that.

------

First of all, you should try this...
after local declaration and before the loop...
JASS:
if Target != null then
    BJDebugMsg( "Target is not null" )
else
    BJDebugMsg( "|cffE50000Target is null|r" )
endif
if Caster != null then
    BJDebugMsg( "Caster is not null" )
else
    BJDebugMsg( "|cffE50000Caster is null|r" )
endif


If either of them is null, that will be your problem.
 

Rainther

I guess I should write something of value here...
Reaction score
61
Use a timer system. Having Trigger Sleep Action in a loop is just suicide. :p
 

theXact

New Member
Reaction score
0
I tried ZugZug's debug in pretty much everyplace I could think of, at no point was caster or target null.

I also agree with Rainther, I should probably change that to a timer. In the mean time any other ideas?
 
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