Faust
You can change this now in User CP.
- Reaction score
- 123
EDIT:
Shiiiiiiiiiiit, I put i > 0... fixed... but they still only move ~400 distance.
EDIT2: Meh, I calculated the timedlife duration myself, now it's fine...
Well, any optimization recommendations?
EDIT3: Well, timedlife is okay (I tested with visible units), but for some reason the fan of knives effect stay there for a second... wtf?
This should spawn 10 units, attach the effect to each one of them, then order them outwards, creating some kind of fan of knives nova.
The problem is, it only spawns one unit, at 0 degrees (east), and it goes only for ~400 distance.
What did I mess up?
Oh here is the custom effect creation:
Shiiiiiiiiiiit, I put i > 0... fixed... but they still only move ~400 distance.
EDIT2: Meh, I calculated the timedlife duration myself, now it's fine...
Well, any optimization recommendations?
EDIT3: Well, timedlife is okay (I tested with visible units), but for some reason the fan of knives effect stay there for a second... wtf?
JASS:
scope ScryeLeaves initializer I
globals
group Group
integer i = 0
endglobals
struct SL
group AlreadyDamaged = CreateGroup()
unit array Leaves [10]
effect array LeaveEffects [10]
timer clock = CreateTimer()
unit caster
integer ticks = 0
method onDestroy takes nothing returns nothing
call PauseTimer(.clock)
call ClearTimerStructA(.clock)
call DestroyTimer(.clock)
call DestroyGroup(.AlreadyDamaged)
loop
exitwhen i > 10
call DestroyEffect(.LeaveEffects<i>)
set i = i+1
endloop
endmethod
endstruct
private function C1 takes nothing returns boolean
return GetSpellAbilityId() == 039;A02T039;
endfunction
private function IsUnitAnEnemyP takes nothing returns boolean
if IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), udg_Player) and GetUnitAbilityLevel(GetFilterUnit(), 039;Aloc039;) == 0 and GetWidgetLife(GetFilterUnit()) >= 1 and IsUnitInGroup(GetFilterUnit(), Group) == false then
return true
else
return false
endif
endfunction
private function H1 takes nothing returns nothing
local SL dat = GetTimerStructA(GetExpiredTimer())
local integer i = 0
set udg_Player = GetOwningPlayer(dat.caster)
loop
exitwhen i > 0
set Group = dat.AlreadyDamaged
call GroupEnumUnitsInRange(G, GetUnitX(dat.Leaves<i>), GetUnitY(dat.Leaves<i>), 75, Condition(function IsUnitAnEnemyP))
loop
set bj_lastCreatedUnit = FirstOfGroup(G)
exitwhen bj_lastCreatedUnit == null
call UnitDamageTarget(dat.caster, bj_lastCreatedUnit, GetHeroAgi(dat.caster, true) * 15, false, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call CreateEffectOnUnit("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl", bj_lastCreatedUnit, "chest")
call GroupRemoveUnit(G, bj_lastCreatedUnit)
call GroupAddUnit(dat.AlreadyDamaged, bj_lastCreatedUnit)
endloop
set i = i+1
endloop
set dat.ticks = dat.ticks + 1
if dat.ticks > 10 then
call dat.destroy()
endif
endfunction
private function A1 takes nothing returns nothing
local SL dat = SL.create()
local integer i = 0
local real Angle = 0
local real x
local real y
set dat.caster = GetTriggerUnit()
loop
exitwhen i > 10
set dat.Leaves<i> = CreateUnit(GetOwningPlayer(dat.caster), 039;h03H039;, GetUnitX(dat.caster), GetUnitY(dat.caster), Angle)
set dat.LeaveEffects<i> = CreateEffectOnUnit("Abilities\\Spells\\NightElf\\FanOfKnives\\FanOfKnivesMissile.mdl", dat.Leaves<i>, "origin")
call SetUnitMoveSpeed(dat.Leaves<i>, 522)
call SetUnitFlyHeight(dat.Leaves<i>, 150, 0)
call UnitApplyTimedLife(dat.Leaves<i>, 039;lmao039;, 1.7)
set x = GetUnitX(dat.caster) + 800 * Cos((36 * i) * bj_DEGTORAD)
set y = GetUnitY(dat.caster) + 1000 * Sin(Angle * bj_DEGTORAD)
call IssuePointOrder(dat.Leaves<i>, "move", x, y)
set i = i + 1
set Angle = Angle + 36
endloop
call SetTimerStructA(dat.clock, dat)
call TimerStart(dat.clock, 0.191, true, function H1)
endfunction
//============================================================================
private function I takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEvent(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function C1))
call TriggerAddAction(t, function A1)
endfunction
endscope</i></i></i></i></i></i></i></i></i></i>
This should spawn 10 units, attach the effect to each one of them, then order them outwards, creating some kind of fan of knives nova.
The problem is, it only spawns one unit, at 0 degrees (east), and it goes only for ~400 distance.
What did I mess up?
Oh here is the custom effect creation:
JASS:
function CreateEffectOnUnit takes string whateffect, unit u, string attachpoint returns effect
if IsPlayerInForce(GetLocalPlayer(), SlowPC) == true then
set whateffect = ""
endif
set bj_lastCreatedEffect = AddSpecialEffectTarget(whateffect, u, attachpoint)
return bj_lastCreatedEffect
endfunction