Mass root, Damage over time trigger

Furch4s

New Member
Reaction score
0
Hello, I've been having some problems with this spell i'm making. I firstly did it in GUI and then converted it to Jass and started editing. I added local variables to make sure the trigger rememberd the targets and dummy even though i inserted a wait command.

But now when i save i get tons of errors. Could someone look thru the code and see if they can find the problem? I will highlight the part that I altered after converting to jass

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

function Trig_Force_of_Nature_Copy_Func003001003001 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) == false )
endfunction

function Trig_Force_of_Nature_Copy_Func003001003002 takes nothing returns boolean
    return ( IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetTriggerUnit())) == true )
endfunction

function Trig_Force_of_Nature_Copy_Func003001003 takes nothing returns boolean
    return GetBooleanAnd( Trig_Force_of_Nature_Copy_Func003001003001(), Trig_Force_of_Nature_Copy_Func003001003002() )
endfunction


----------------------------thi is where i edited-----------------------------------------------------------------------
function Trig_Force_of_Nature_Copy_Func003A takes nothing returns nothing
local unit ua = GetTriggeringUnit()
local unit ub = CreateNUnitsAtLoc( 1, 'h010', GetOwningPlayer(GetSpellAbilityUnit()), GetUnitLoc(GetEnumUnit()), 0.00 )
local unit uc = GetEnumUnit()

    call UnitApplyTimedLifeBJ( 3.50, 'BTLF', u2 )
    call UnitAddAbilityBJ( 'A06F', u2 )
    call IssueTargetOrderBJ( u2, "entanglingroots", GetEnumUnit() )
    call UnitDamageTargetBJ( u2, u3, ( ( 15.00 * I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetSpellAbilityUnit())) ) + ( 0.25 * udg_Spell_Power[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] ) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING )
    call TriggerSleepAction( 0.50 )
    call UnitDamageTargetBJ( u2, u3, ( ( 15.00 * I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetSpellAbilityUnit())) ) + ( 0.25 * udg_Spell_Power[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] ) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING )
    call TriggerSleepAction( 0.50 )
    call UnitDamageTargetBJ( u2, u3, ( ( 15.00 * I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetSpellAbilityUnit())) ) + ( 0.25 * udg_Spell_Power[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] ) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING )
    call TriggerSleepAction( 0.50 )
    call UnitDamageTargetBJ( u2, u3, ( ( 15.00 * I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetSpellAbilityUnit())) ) + ( 0.25 * udg_Spell_Power[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] ) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING )
endfunction
------------------------this is where i edited---------------------------------------------------------
function Trig_Force_of_Nature_Copy_Actions takes nothing returns nothing
    call ForGroupBJ( GetUnitsInRangeOfLocMatching(350.00, GetSpellTargetLoc(), Condition(function Trig_Force_of_Nature_Copy_Func003001003)), function Trig_Force_of_Nature_Copy_Func003A )
endfunction

//===========================================================================
function InitTrig_Force_of_Nature_Copy takes nothing returns nothing
    set gg_trg_Force_of_Nature_Copy = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Force_of_Nature_Copy, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Force_of_Nature_Copy, Condition( function Trig_Force_of_Nature_Copy_Conditions ) )
    call TriggerAddAction( gg_trg_Force_of_Nature_Copy, function Trig_Force_of_Nature_Copy_Actions )
endfunction


Thanks! :)
 

Dirac

22710180
Reaction score
147
Even if fixed (and fixing converted GUI is such a huge pain) it wouldn't work, you're using waits inside ForGroup calls, that causes some major bugs.
Download vJass, read some tutorials, search for a good DoT system, profit!
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
[ljass]local unit ua = GetTriggeringUnit()[/ljass] --> [ljass]local unit ua = GetTriggerUnit()[/ljass]

swap the line that ub and uc are on then change ub

[ljass]local unit ub = CreateNUnitsAtLoc(1, 'h010', GetOwningPlayer(GetSpellAbilityUnit()), GetUnitLoc(GetEnumUnit()), 0.00)[/ljass]
-->
[ljass]local unit ub = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()), 'h010', GetUnitX(uc), GetUnitY(uc), 0)[/ljass]

then get rid of bjs, IE:

[ljass]call UnitApplyTimedLifeBJ(3.5, 'BTLF', u2)[/ljass] --> [ljass]call UnitApplyTimedLife(u2, 'BTLF', 3.5)[/ljass]

because they are just a function that calls another function, here is the function UnitApplyTimedLifeBJ:

JASS:
function UnitApplyTimedLifeBJ takes real duration, integer buffId, unit whichUnit returns nothing
    call UnitApplyTimedLife(whichUnit, buffId, duration)
endfunction
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
The beauty of vJass.
Actually one dummy per map is enough, as the spell casting is instant if you set the animation time for the dummy to 0.000
JASS:
library ForceOfNature initializer OnInit requires GT, TimerUtils, GroupUtils, DummyCaster
	
    globals
        private constant integer ABIL_ID='A066'
        private constant integer ENTANGLE_ID='A06F'
    endglobals
    
    private function DamageTimeout takes integer level returns real
        return 0.5
    endfunction
    
    private function DamageTimes takes integer level returns real
        return 4
    endfunction
    
    private function DamageMultiplier takes integer level returns real
        return 0.25
    endfunction
    
    private function Radius takes integer level returns real
        return 350.0
    endfunction
    
    private struct Data
        private static thistype temp
        unit caster
        player owner
        integer level
        real damage
        integer tick
        timer t
        group g
        
        private static method filt takes nothing returns boolean
            return IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD)==false and IsUnitEnemy(GetFilterUnit(),thistype.temp.owner)
        endmethod
        
        private static method entangle takes nothing returns nothing
            call IssueTargetOrder(DUMMY,"entangle",GetEnumUnit())
        endmethod
        
        private static method damageUnits takes nothing returns nothing
            call UnitDamageTarget(thistype.temp.caster,GetEnumUnit(),thistype.temp.damage,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_LIGHTNING,null)
        endmethod
        
        private static method periodic takes nothing returns nothing
            local thistype this=GetTimerData(GetExpiredTimer())
            set this.tick=this.tick-1
            set thistype.temp=this
            call ForGroup(this.g,function thistype.damageUnits)
            if this.tick<=0 then
                call ReleaseGroup(this.g)
                call ReleaseTimer(this.t)
                call this.destroy()
            endif
        endmethod
        
        static method action takes nothing returns boolean
            local thistype this=thistype.allocate()
            set this.caster=GetTriggerUnit()
            set this.owner=GetOwningPlayer(this.caster)
            set this.level=GetUnitAbilityLevel(this.caster,ABIL_ID)
            set this.damage=DamageMultiplier(this.level)*udg_Spell_Power[GetPlayerId(this.owner)]
            set this.tick=DamageTimes(this.level)
            set this.g=NewGroup()
            set thistype.temp=this
            call GroupEnumUnitsInRange(this.g,GetUnitX(this.caster),GetUnitY(this.caster),Radius(this.level),Condition(function thistype.filt))
            call UnitAddAbility(DUMMY,ENTANGLE_ID)
            call ForGroup(this.g,function thistype.entangle)
            set this.t=NewTimer()
            call SetTimerData(this.t,this)
            call TimerStart(this.t,DamageTimeout(this.level),true,function thistype.periodic)
            return false
        endmethod
    endstruct
    
    private function OnInit takes nothing returns nothing
        call GT_AddStartsEffectAction(function Data.action,ABIL_ID)
    endfunction
    
endlibrary
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
>The beauty of vJass.

Beauty is in the eye of the beholder =)

JASS:





module MassRootDamageOverTime

enum mass-root-damage-over-time
{
    int        id                = 'MRDO'
    real       delay             = 0.5
    int        repeatbase        = 4
    real       rangebase         = 350
    real       damagefactor      = 0.25
    attacktype attack-type       = ATTACK_TYPE_NORMAL
    damagetype damage-type       = DAMAGE_TYPE_LIGHTNING
    weapontype weapon-type       = WEAPON_TYPE_WHOKNOWS
    xeffect    fx                = Effect("NightElf/Keeper of the Grove/Entangle")
} conf;

event.onspelleffect += func(unit trigger_unit(u))
{
    var ulvl   = u.ability_level(conf.id)
    var repeat = ulvl * conf.repeatbase

    while repeat > 0
    {
        for units_in_range(u.x, u.y, conf.rangebase * ulvl) -> $curr_unit
        {
            if curr_unit.is_alive() and u.owner.is_enemy(curr_unit)
            {
                u.damage(curr_unit, u.intelligence * conf.damagefactor, conf.attack-type, conf.damage-type, conf.weapon-type)
                u.effect(curr_unit, conf.fx)
            } 
        }

        repeat--
        sleep(conf.delay)
    }
}
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top