- Joined
- Feb 3, 2013
- Messages
- 277
JASS:
scope ASStrike initializer init
globals
private constant string FX = "war3mapImported\\BlinkCaster.mdx"
private constant integer ID = 'A000'
endglobals
private function AS_Actions takes nothing returns nothing
local unit target = GetTriggerUnit()
local unit attacker = GetEventDamageSource()
local location blinkpoint = GetUnitLoc(attacker)
local location targetpoint = GetUnitLoc(target)
local location newpoint = PolarProjectionBJ(targetpoint, 100, GetRandomReal(0,360))
if GetUnitAbilityLevel(attacker, ID) > 0 then
call DestroyEffect(AddSpecialEffectLoc(FX, blinkpoint))
call SetUnitX(attacker, GetLocationX(newpoint))
call SetUnitY(attacker, GetLocationY(newpoint))
endif
set target = null
set attacker = null
call RemoveLocation(blinkpoint)
call RemoveLocation(targetpoint)
call RemoveLocation(newpoint)
endfunction
private function Register takes nothing returns nothing
local trigger t2 = CreateTrigger()
call TriggerRegisterUnitEvent(t2, GetTriggerUnit(), EVENT_UNIT_DAMAGED)
call TriggerAddAction(t2, function AS_Actions)
endfunction
private function init takes nothing returns nothing
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t1, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddAction(t1, function Register)
endfunction
endscope
This time I got it to work for all units being attacked and receiving damage, but for some reason - the blink effect is created multiple times :/ Why?

Once again thanks in advance
EDIT1:
JASS:
scope GiantSwing initializer init
globals
private constant unit attacker = udg_DamageEventSource
private constant unit target = udg_DamageEventTarget
private constant integer ID = 'A000'
private constant string FX = "Abilities\\Spells\\Orc\\Disenchant\\DisenchantSpecialArt.mdl"
private constant string WFX = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl"
private constant string AP = "right, hand"
private constant real damage = udg_DamageEventAmount
private integer i
endglobals
private function GS_Cond takes nothing returns boolean
return IsPlayerEnemy(GetOwningPlayer(attacker),GetOwningPlayer(target))
endfunction
private function GS_Damage takes nothing returns nothing
call UnitDamageTargetBJ(attacker, GetEnumUnit(), 2 * damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)
endfunction
private function GS_Effect takes nothing returns nothing
call AddSpecialEffectTarget(FX, GetEnumUnit(), "chest")
endfunction
private function GS_Actions takes nothing returns nothing
local location target_point = GetUnitLoc(target)
local group g = CreateGroup()
local effect Last_FX
if GetUnitAbilityLevel(attacker, ID) > 0 then
if i < 2 then
set i = i + 1
elseif i == 2 then
call AddSpecialEffectTarget(WFX, attacker, AP)
set Last_FX = GetLastCreatedEffectBJ()
set i = i + 1
elseif i == 3 then
call DestroyEffect(Last_FX)
call GroupEnumUnitsInRangeOfLoc(g, target_point, 285, Filter(function GS_Cond))
call ForGroup(g, function GS_Damage)
call ForGroup(g, function GS_Effect)
set i = 0
endif
endif
call DestroyGroup(g)
call RemoveLocation(target_point)
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterVariableEvent(t, "udg_DamageEvent", EQUAL, 1.00)
call TriggerAddAction(t, function GS_Actions)
set i = 0
endfunction
endscope
i'm using bribe's damage detectino system; on every x hits, the unit is supposed to deal a splash damage with an effect
once again saves fine, but can't get it to work :/ - absolutely nothing shows in game
thanks to all that helped me out + REP and much love <333
edit2: SOLVED
Last edited: