Help with skill

Lmfaocj

Active Member
Reaction score
1
Can someone help me? I've been trying to make thunder clap deal double damage when there is only one unit but it isn't working -.-

JASS:
globals
    unit u
    group g
    unit ud
    integer m
endglobals
function Trig_TC_remastered_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'AHtc' ) ) then
        return false
    endif
    return true
endfunction

function Trig_TC_remastered_Func002002003 takes nothing returns boolean
    return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(u)) == true )
endfunction

function Trig_TC_remastered_Func004A takes nothing returns nothing
    set m = ( m + 1 )
    set ud = GetEnumUnit()
    call UnitDamageTargetEx( u, ud, ( 20.00 + ( I2R(GetUnitLevel(u)) * 15.00 ) ),true,false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS )
endfunction

function Trig_TC_remastered_Actions takes nothing returns nothing
    local location l
    set l = GetUnitLoc(GetTriggerUnit())
    set u = GetTriggerUnit()
    set g = GetUnitsInRangeOfLocMatching(( 150.00 + I2R(( GetUnitLevel(u) * 50 )) ), l, Condition(function Trig_TC_remastered_Func002002003))
    set m = 0
    call ForGroupBJ( udg_DeathGroup, function Trig_TC_remastered_Func004A )
    if ( m == 1 ) then
        call BJDebugMsg("win!")
        call AddSpecialEffectTarget("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl",ud,"origin")
        call UnitDamageTargetEx( u, ud, ( 20.00 + ( I2R(GetUnitLevel(u)) * 15.00 ) ),true,false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS )
        call DestroyEffect(GetLastCreatedEffectBJ())
    else
    endif
    call RemoveLocation(l)
    call DestroyGroup(g)
    set g=null
    set l=null
    set u=null
    set ud=null
endfunction

//===========================================================================
function InitTrig_TC_remastered takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Trig_TC_remastered_Conditions ) )
    call TriggerAddAction( t, function Trig_TC_remastered_Actions )
endfunction
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Does your thunder clap deal a preset amount of damage or is the damage of thunderclap triggered as well?

If it does use preset values from the object editor just pick every unit in range around the casting unit, compare the number of units picked to 1 and deal the additional damage.

Code:
Event
 A unit starts the effect of an ability
Condition
 Ability being cast == Thunder Clap
Action
 set Tmp_Pnt = Position of Triggering Unit
 set Tmp_Grp = Units in range X.XX of Tmp_Pnt
 set Tmp_Int = Number of Units in Tmp_Grp
 if Tmp_Int == 1 then{
   set Tmp_Real = Z.ZZ + (Y.YY * Level of Ability being Cast for Triggering Unit)
   unit - deal Tmp_Real damage to random unit from Tmp_Grp with ...
 }
 clear leaks
This little pseudo-code example should will hopefully do.

If the skill itself is triggered then it should be even easier but we would need to see the code in that case.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Although i didnt look at the whole code you might want to have a look at this particular bundle of lines:
Code:
set m = 0
call ForGroupBJ( udg_DeathGroup, function Trig_TC_remastered_Func004A )
if ( m == 1 ) then
 
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