HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Whats supposed to happen here?

07-09-2005, 08:03 AM#1
Limb_Smasher
Ok to me this trigger is supposed to create the special effects offset with polar coords on the target unit of ability being cast, and the circle should slowly but surely get smaller. but thats not what happens... it starts to work, but after like 5 or so it stops. If you could lemme know whats wrong that would be awesome. Thanks for the help, Im VERY new to JASS.
Code:
function Trig_Circle_of_Death_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A06W' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Circle_of_Death_Actions takes nothing returns nothing
 local integer a=0
 local real b=500
 local effect Skull
   loop
     call AddSpecialEffectLocBJ( PolarProjectionBJ(GetUnitLoc(GetSpellTargetUnit()), b, a), "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilMissile.mdl" )
     set Skull=GetLastCreatedEffectBJ()
     set a=a+10
     set b=b-5
     exitwhen b==0
     call TriggerSleepAction( 0.01 )
     call DestroyEffectBJ( Skull )
   endloop
endfunction

//===========================================================================
function InitTrig_Circle_of_Death takes nothing returns nothing
    set gg_trg_Circle_of_Death = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Circle_of_Death, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Circle_of_Death, Condition( function Trig_Circle_of_Death_Conditions ) )
    call TriggerAddAction( gg_trg_Circle_of_Death, function Trig_Circle_of_Death_Actions )
endfunction
07-09-2005, 09:12 AM#2
Anitarf
You are advised to use PolledWait() instead of TriggerSleepAction(). It was mentioned that these actions can't give you a smaller wait than 0.25, though. Also, cast event responses are bugged, they act globaly and can be reset by other spells. You need another local unit variable to store the target unit at start of trigger. You also need to clear your memory leaks better. Here's an updated trigger:

Code:
function Trig_Circle_of_Death_Actions takes nothing returns nothing
 local integer a=0
 local real b=500
 local effect Skull
 local unit targt = GetSpellTargetUnit()
 local location point1
 local location point2

    if ( not ( GetSpellAbilityId() == 'A06W' ) ) then
        return
    endif

   loop
     set point1 = GetUnitLoc( targt )
     set point2 = PolarProjectionBJ( point1, b, a )
     call AddSpecialEffectLocBJ( point2, "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilMissile.mdl" )
     set Skull=GetLastCreatedEffectBJ()
     set a=a+10
     set b=b-5
     call TriggerSleepAction( 0.01 )
     call DestroyEffectBJ( Skull )
     call RemoveLocation( point1 )
     call RemoveLocation( point2 )
     exitwhen b==0
   endloop

   set point1 = null
   set point2 = null
   set Skull = null
   set targt = null
endfunction

//===========================================================================
function InitTrig_Circle_of_Death takes nothing returns nothing
    set gg_trg_Circle_of_Death = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Circle_of_Death, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddAction( gg_trg_Circle_of_Death, function Trig_Circle_of_Death_Actions )
endfunction
07-09-2005, 06:04 PM#3
Limb_Smasher
oh ok that makes sense, so the PolledWait is better for time smaller than .25? well thanks for the help.