• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

DoT Attribute-based Spells

Status
Not open for further replies.
Level 10
Joined
Jun 10, 2007
Messages
557
  • Constrictingvinesdamage
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Constricting Vines
    • Actions
      • Set DoTUnit = (Casting unit)
      • Set VinesTempReal = (Real(((Intelligence of DoTUnit (Include bonuses)) / 2)))
      • Unit - Cause DoTUnit to damage (Target unit of ability being cast), dealing VinesTempReal damage of attack type Spells and damage type Normal
      • Wait 1.00 seconds

This is the basis of my trigger, the actions seen above (except for Set DoTUnit = (Casting unit)) are repeated 15 times to deal an amount of damage equal to half of the casting unit's Intelligence every tick (second) for 15 seconds. Essentially, the spell ticks about 3 times, then stops working. The spell is basically Entangling Roots, and the dummy spell works fine and dandy, it just doesnt deal damage (as intended, because the trigger (which doesnt work) is supposed to deal it) for the rest of the duration. So, is there a more efficient way to do this, and/or a way that also works?

Sorry for all of the recent spell related questions, but I'm getting a bit more adventurous when it comes to triggering, especially as this map nears it's public debut.
 
Level 11
Joined
Feb 22, 2006
Messages
752
Put this code into your trigger. It should work.

JASS:
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local real damage = GetHeroInt( caster, true ) / 2
local integer counter = 0
loop
    exitwhen ( counter > 14 or GetUnitState( target, UNIT_STATE_LIFE ) < 0.405 )
    call UnitDamageTarget( caster, target, damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
    call TriggerSleepAction( 1.00 )
    set counter = counter + 1
endloop
set caster = null
set target = null
 
Level 10
Joined
Jun 10, 2007
Messages
557
  • Constrictingvinesdamage
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Constricting Vines
    • Actions
      • Set DoTUnit = (Target unit of ability being cast)
      • Set VinesTempReal = (Real(((Intelligence of DoTUnit (Include bonuses)) / 2)))
      • Unit - Cause DoTUnit to damage (Triggering unit), dealing VinesTempReal damage of attack type Spells and damage type Normal
      • Wait 1.00 seconds
      • If ((DoTUnit has buff Constricting Vines) Equal to True) then do (Trigger - Run (This trigger) (ignoring conditions)) else do (Do nothing)

This doesn't work either. I think what's preventing it from happening is the "Set DoTUnit to Casting Unit" and referring to it as the casting unit, but after the loop, there is no casting unit.

Put this code into your trigger. It should work.

I assume that this would be used instead of my trigger, right? As opposed to, like, using a dozen lines of Custom Script actions?

EDIT: And how do I make said code only activate when a certain type of unit casts the spell?
 
Level 10
Joined
Jun 10, 2007
Messages
557
Okay, I feel like an idiot, but... where? >.<

JASS:
function Trig_Constrictingvinesdamage_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A00M' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Constrictingvinesdamage_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_Constrictingvinesdamage takes nothing returns nothing
    set gg_trg_Constrictingvinesdamage = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Constrictingvinesdamage, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Constrictingvinesdamage, Condition( function Trig_Constrictingvinesdamage_Conditions ) )
    call TriggerAddAction( gg_trg_Constrictingvinesdamage, function Trig_Constrictingvinesdamage_Actions )
endfunction
 
Level 11
Joined
Aug 25, 2006
Messages
971
JASS:
function Trig_Constrictingvinesdamage_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A00M' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Constrictingvinesdamage_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local real damage = GetHeroInt( caster, true ) / 2
local integer counter = 0
loop
    exitwhen ( counter > 14 or GetUnitState( target, UNIT_STATE_LIFE ) < 0.405 )
    call UnitDamageTarget( caster, target, damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
    call TriggerSleepAction( 1.00 )
    set counter = counter + 1
endloop
set caster = null
set target = null
endfunction

//===========================================================================
function InitTrig_Constrictingvinesdamage takes nothing returns nothing
    set gg_trg_Constrictingvinesdamage = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Constrictingvinesdamage, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Constrictingvinesdamage, Condition( function Trig_Constrictingvinesdamage_Conditions ) )
    call TriggerAddAction( gg_trg_Constrictingvinesdamage, function Trig_Constrictingvinesdamage_Actions )
endfunction

Replace everything you see with the above. I just inserted his code where it needs to be. Whether or not his code works is his problem.
 
Level 10
Joined
Jun 10, 2007
Messages
557
JASS:
function Trig_Constrictingvinesdamage_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A00M' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Constrictingvinesdamage_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local real damage = GetHeroInt( caster, true ) / 2
local integer counter = 0
loop
    exitwhen ( counter > 14 or GetUnitState( target, UNIT_STATE_LIFE ) < 0.405 )
    call UnitDamageTarget( caster, target, damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
    call TriggerSleepAction( 1.00 )
    set counter = counter + 1
endloop
set caster = null
set target = null
endfunction

//===========================================================================
function InitTrig_Constrictingvinesdamage takes nothing returns nothing
    set gg_trg_Constrictingvinesdamage = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Constrictingvinesdamage, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Constrictingvinesdamage, Condition( function Trig_Constrictingvinesdamage_Conditions ) )
    call TriggerAddAction( gg_trg_Constrictingvinesdamage, function Trig_Constrictingvinesdamage_Actions )
endfunction

Replace everything you see with the above. I just inserted his code where it needs to be. Whether or not his code works is his problem.

I just tested it, and it works! The amount of rep I can give you is incredibly small compared to how much you deserve. :grin:
 
Status
Not open for further replies.
Top