Gtam
Lerning how to write and read!! Yeah.
- Reaction score
- 164
JASS:
scope SoB initializer Init
globals
private constant integer AbilId = 039;A017039;
private constant integer DumyId = 039;D017039;
private constant string FX = "Abilities\\Spells\\Human\\StormBolt\\StormBoltMissile.mdl"
endglobals
private function Conditions takes nothing returns boolean
call BJDebugMsg("Conds")
return GetSpellAbilityId() == AbilId
endfunction
struct SoB extends array
//! runtextmacro AIDS()
group g
real x
real y
real ang
unit dumy
effect e
integer lvl
integer t
method AIDS_OnCreate takes nothing returns nothing
set .g = CreateGroup()
endmethod
endstruct
private function Filt takes nothing returns boolean
local unit u = GetFilterUnit()
return IsUnitType(u, UNIT_TYPE_STRUCTURE) == false and IsUnitEnemy(u, GetOwningPlayer(GetTriggerUnit())) == true
endfunction
private function Periodic takes nothing returns nothing
local SoB data = GetTimerData(GetExpiredTimer())
local unit u
local unit d
set data.t = data.t - 1
if data.t >= 0 then
set data.x = GetOffsetX(GetUnitX(data.dumy), 10, data.ang)
set data.y = GetOffsetY(GetUnitY(data.dumy), 10, data.ang)
call SetUnitX(data.dumy, data.x)
call SetUnitY(data.dumy, data.y)
call GroupEnumUnitsInRange(data.g, data.x, data.y, 225, Condition(function Filt))
set d = GetCaster(data.x, data.y)
call UnitAddAbility(d, DumyId)
call SetUnitAbilityLevel(d, DumyId, data.lvl)
loop
set u = FirstOfGroup(data.g)
exitwhen u == null
call IssueTargetOrder(d, "stormbolt", u)
endloop
else
call CasterDone(data.dumy, 0)
call DestroyEffect(data.e)
call FreeDTimer(GetExpiredTimer())
endif
endfunction
private function Actions takes nothing returns nothing
local SoB data = SoB[GetTriggerUnit()]
local timer ti = GetDTimer()
set data.lvl = GetUnitAbilityLevel(GetTriggerUnit(), AbilId)
set data.t = 96
set data.x = GetUnitX(GetTriggerUnit())
set data.y = GetUnitY(GetTriggerUnit())
set data.ang = GetAngleBetweenXY(data.x, data.y, GetSpellTargetX(), GetSpellTargetY())
set data.dumy = GetCaster(data.x, data.y)
set data.e = AddSpecialEffectTarget(FX, data.dumy, "origin")
call SetTimerData(ti, data)
call TimerStart(ti, 0.03125, true, function Periodic)
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call BJDebugMsg("Init")
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Conditions))
call TriggerAddAction(t, function Actions)
endfunction
endscope
Is see the Two BJDebugMsg but when i put one in the actions i dont see it?
Whats wrong?