Laiev
Hey Listen!!
- Reaction score
- 188
based on spell (rewrited everything) at wc3c by dextreme, the sacred circlet...
my friend want it to create a spiral and after 50% of channeling time it start a closing spiral...
basically you create a spiral... when spiral reach 5 second of channeling, get the last point of that spiral and start a new spiral closing the spiral....
here the trigger and if need, i can post an image
any help is welcome :thup:
my friend want it to create a spiral and after 50% of channeling time it start a closing spiral...
basically you create a spiral... when spiral reach 5 second of channeling, get the last point of that spiral and start a new spiral closing the spiral....
here the trigger and if need, i can post an image
JASS:
scope SacredCirclet initializer init //requires TimerUtils
native UnitAlive takes unit id returns boolean //remove this if you already got it
globals
private constant integer ABILITY_ID = 039;A000039; //Ability ID
private constant integer DAMAGE_PER_LEVEL = 100 //Damage dealt per level
private constant real STRIKE_INTERVAL = .04 //Interval per strike
private constant real STRIKE_PER_LEVEL = .0 //Interval per level
private constant real DAMAGE_RADIUS = 175. //Damage radius
private constant real DAMAGE_RADIUS_LVL = .0 //Damage radius per lvl
private constant string EFFECT_ART = "war3mapImported\\HolyStrike.mdx" //Model of effect
private constant attacktype ATTACK_TYPE = ATTACK_TYPE_CHAOS //Type of attack
private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_FIRE //Type of damage
private constant weapontype WEAPON_TYPE = null //Type of weapon
endglobals
private struct data
unit u
timer t
integer i = 0
real x = 0.
real y = 0.
real cx = 0.
real cy = 0.
real angle = 0.
real r = 0.
unit ta
player p
group g
integer count = 0
method onDestroy takes nothing returns nothing
call ReleaseTimer(.t)
set .ta = null
set .g = null
set .p = null
set .u = null
endmethod
endstruct
private function CheckMagicImmune takes unit targ returns boolean
return not IsUnitType(targ, UNIT_TYPE_MAGIC_IMMUNE)
endfunction
private function CheckEnemy takes unit targ, player p returns boolean
return IsUnitEnemy(targ, p)
endfunction
private function Acts takes nothing returns nothing
local data d = GetTimerData(GetExpiredTimer())
set d.cx = GetUnitX(d.u)
set d.cy = GetUnitY(d.u)
set d.count = d.count + 1
if d.count >= 50 then
set d.x = d.cx + (50 - d.r * 5) * Cos(d.angle * bj_DEGTORAD) //~~~~~~~~~~~
set d.y = d.cy + (50 - d.r * 5) * Sin(d.angle * bj_DEGTORAD) //~~~~~~~~~~~
else
set d.x = d.cx + (50 + d.r * 10) * Cos(d.angle * bj_DEGTORAD)
set d.y = d.cy + (50 + d.r * 10) * Sin(d.angle * bj_DEGTORAD)
endif
if GetUnitCurrentOrder(d.u) != 852183 then
call d.destroy()
return
endif
set d.g = CreateGroup()
set d.p = GetOwningPlayer(d.u)
call DestroyEffect(AddSpecialEffect(EFFECT_ART, d.x, d.y))
call GroupEnumUnitsInRange(d.g, d.x, d.y, DAMAGE_RADIUS + DAMAGE_RADIUS_LVL * d.i, null)
loop
set d.ta = FirstOfGroup(d.g)
exitwhen d.ta == null
if d.ta != d.u and CheckEnemy(d.ta, d.p) and CheckMagicImmune(d.ta) and UnitAlive(d.u) then
call UnitDamageTarget(d.u, d.ta, DAMAGE_PER_LEVEL * d.i, true, false, ATTACK_TYPE, DAMAGE_TYPE, WEAPON_TYPE)
endif
call GroupRemoveUnit(d.g, d.ta)
set d.ta = null
endloop
set d.angle = d.angle + 24. - d.r / 6.
set d.r = d.r + 1.
call DestroyGroup(d.g)
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
set d.t = NewTimer()
set d.u = GetTriggerUnit()
set d.i = GetUnitAbilityLevel(d.u, ABILITY_ID)
call SetTimerData(d.t, d)
call TimerStart(d.t, STRIKE_INTERVAL - STRIKE_PER_LEVEL * d.i, true, function Acts)
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == ABILITY_ID
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Conditions))
call TriggerAddAction(t, function Actions)
call Preload(EFFECT_ART)
endfunction
endscope
any help is welcome :thup: