Noob quiestion >.<

ic3_water

Member
Reaction score
0
Ability Info
Targets allowed : enemy (creep , hero , even air mobs)
Summon the shade allow target.
After 5 second deal dmg depend number of unit target meet.

Bug (Question):
In the wait of first casting , if i use this skill again on other target . The first skill will deal damage of second skill.
Code:
function Trig_ShadowArrows_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A04U'        
endfunction

function Trig_ShadowArrows_Func012002003 takes nothing returns boolean
    return ( GetUnitTypeId(GetFilterUnit()) != GetUnitTypeId(udg_SDDummy) )
endfunction

function Trig_ShadowArrows_Actions takes nothing returns nothing
    local unit u = GetSpellTargetUnit()
    local unit c = GetSpellAbilityUnit()
    local group g
    local unit i
    set udg_SDLevel = GetUnitAbilityLevelSwapped('A04U', c)
    call CreateNUnitsAtLoc( 1, 'n00U', GetOwningPlayer(c), GetUnitLoc(u), bj_UNIT_FACING )
    call UnitApplyTimedLifeBJ( ( I2R(udg_SDLevel) + 2.10 ), 'BTLF', GetLastCreatedUnit() )
    set i = GetLastCreatedUnit()
    call IssueTargetOrderBJ( i, "move", u )
    set udg_SDGroup = GetUnitsInRangeOfLocMatching(600.00, GetUnitLoc(udg_SDDummy), Condition(function Trig_ShadowArrows_Func012002003))
    set g = udg_SDGroup
    call EnableTrigger( gg_trg_ShadowLink )
    call TriggerSleepAction( ( I2R(udg_SDLevel) + 2.00 ) )
    set g = udg_SDGroup
    call DisableTrigger( gg_trg_ShadowLink )
    call AddSpecialEffectTargetUnitBJ( "origin", u, "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl" )
    call UnitDamageTargetBJ( i, u, ( ( 10.00 * ( I2R(udg_SDLevel) + 2.00 ) ) * ( ( ( 30.00 - ( I2R(udg_SDLevel) * 5.00 ) ) * 0.01 ) * I2R(udg_SDNumber) ) ), ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL )
    call UnitDamageTargetBJ( i, u, ( ( 10.00 * ( I2R(udg_SDLevel) + 2.00 ) ) * ( ( ( 30.00 - ( I2R(udg_SDLevel) * 5.00 ) ) * 0.01 ) * I2R(udg_SDNumber) ) ), ATTACK_TYPE_PIERCE, DAMAGE_TYPE_NORMAL )
    call UnitDamageTargetBJ( i, u, ( ( 10.00 * ( I2R(udg_SDLevel) + 2.00 ) ) * ( ( ( 30.00 - ( I2R(udg_SDLevel) * 5.00 ) ) * 0.01 ) * I2R(udg_SDNumber) ) ), ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL )
    call UnitDamageTargetBJ( i, u, ( ( 10.00 * ( I2R(udg_SDLevel) + 2.00 ) ) * ( ( ( 10.00 + ( I2R(udg_SDLevel) * 15.00 ) ) * 0.01 ) * I2R(udg_SDNumber) ) ), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL )
    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
    set u = null
    set g = null
endfunction

//===========================================================================
function InitTrig_ShadowArrows takes nothing returns nothing
    set gg_trg_ShadowArrows = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_ShadowArrows, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_ShadowArrows, Condition( function Trig_ShadowArrows_Conditions ) )
    call TriggerAddAction( gg_trg_ShadowArrows, function Trig_ShadowArrows_Actions )
endfunction
Code:
ShadowLink
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Distance between (Position of SDTarget) and (Position of (Picked unit))) Less than or equal to 600.00
                    Then - Actions
                        Unit Group - Add (Picked unit) to SDGroup
                        Set SDNumber = (Number of units in SDGroup)
                    Else - Actions

Srry 4 my bad english >.<
 

woot

New Member
Reaction score
8
I only looked it over briefly but I bet this is your problem:

You are using global variables and waits.

When you do this, global variables can get changed around in ways you don't forsee.

Between the time the wait started and the wait ended a global variable can change to something else.

Try using local variables instead

Instead of looping through a group of units using globals and Enum you can do something like this:

JASS:

set g = GetUnitsInRectAll(rect)
loop
    exitwhen CountUnitsInGroup(g) == 0
    set u = GroupPickRandomUnit(g)
        //do stuff to the picked unit
    

    call GroupRemoveUnit(g,u)
    set u = null
    endloop
    call DestroyGroup(g)
    set g = null
 

woot

New Member
Reaction score
8
it doesn't make any other difference? for instance: not saving the last so that you can use a function like GetLastCreatedEffectBJ() ?
 

saw792

Is known to say things. That is all.
Reaction score
280
Less function calls = less the computer has to do. Thus, it will happen faster (microseconds faster, but it builds up obviously).
JASS:
function GetLastCreatedEffectBJ takes nothing returns effect
    return bj_lastCreatedEffect
endfunction


Why use GetLastCreatedEffectBJ() when you can just use bj_lastCreatedEffect? Or even better, save the variable on creation:
JASS:
local effect sfx = AddSpecialEffect(...)


EDIT: Natives do not save the last created unit/effect/destructible etc. Neither do many BJs. If you are using jass you should be able to save it to a global variable yourself (in the worst case scenario), as that is just what bj_lastCreated<...> is.
 

woot

New Member
Reaction score
8
I see now that I can control+click functions in newgen and see what they do :)

thanks all :)

this is incredibly helpful, i see where a lot of my problems are now (in these blizzard functions) ...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top