• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[JASS] Spell Help Please

Status
Not open for further replies.
JASS:
function Trig_snapdragonpoison_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A000' ) ) then
        return false
    endif
    return true
endfunction
globals
unit sdpTarget
real sdpDamage
endglobals
function Trig_snapdragonpoison_Actions takes nothing returns nothing
local integer i = 7
set sdpTarget = GetSpellTargetUnit()
set sdpDamage = 0.01 * GetUnitAbilityLevelSwapped('A000',GetSpellAbilityUnit())
loop
 exitwhen i == 0
     call UnitDamageTargetBJ(GetSpellAbilityUnit(),sdpTarget,(GetUnitState(GetSpellTargetUnit(),UNIT_STATE_LIFE) * sdpDamage),ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC)
	 call TriggerSleepAction(1.00)
	 set i = i - 1
endloop
endfunction

//===========================================================================
function InitTrig_snapdragonpoison takes nothing returns nothing
    set gg_trg_snapdragonpoison = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_snapdragonpoison, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_snapdragonpoison, Condition( function Trig_snapdragonpoison_Conditions ) )
    call TriggerAddAction( gg_trg_snapdragonpoison, function Trig_snapdragonpoison_Actions )
endfunction
why does this only work once then stops?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,233
JASS:
function Trig_snapdragonpoison_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000' 
endfunction

function Trig_snapdragonpoison_Actions takes nothing returns nothing
    local unit sdpTarget = GetSpellTargetUnit()
    local real sdpDamage = 0.01 * GetUnitAbilityLevelSwapped('A000',GetSpellAbilityUnit())
    local integer i = 7
    loop
        exitwhen i == 0
        call UnitDamageTargetBJ(GetSpellAbilityUnit(),sdpTarget,(GetUnitState(GetSpellTargetUnit(),UNIT_STATE_LIFE) * sdpDamage),ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC)
        call TriggerSleepAction(1.00)
        set i = i - 1
    endloop
endfunction

function InitTrig_snapdragonpoison takes nothing returns nothing
    set gg_trg_snapdragonpoison = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_snapdragonpoison, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_snapdragonpoison, Condition( function Trig_snapdragonpoison_Conditions ) )
    call TriggerAddAction( gg_trg_snapdragonpoison, function Trig_snapdragonpoison_Actions )
endfunction

I even made it more efficent for you, do note though that this takes into account that you used only normal WE since you did not state you used any other editor.
 
Level 8
Joined
Jul 23, 2005
Messages
329
Aye, but considering the
JASS:
globals
    unit sdpTarget
    real sdpDamage
endglobals
And that he did not say anything about WE crashing, I think you can safely assume that vJASS is enabled.
 
Status
Not open for further replies.
Top