Code:
scope Spell initializer JassSpell
function Spell_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'A000' then
return true
endif
return false
endfunction
struct spell
unit caster
unit target
string ma
integer i
endstruct
function Action takes nothing returns nothing
call GetTimerData(t)
if s.i > 3 then
call spell.destroy()
call ReleaseTimer(t)
else
set s.i = s.i + 1
call FireProjectile( s.caster, s.target, 0, 400, 0.15, true, s.ma)
call UnitDamageTargetEX( s.caster, s.target, 25, true, true)
endif
endfunction
function Spell_Actions takes nothing returns nothing
local spell
set s = spell.create()
set s.caster = GetSpellAbilityUnit()
set s.target = GetSpellTargetUnit()
set s.ma = "Abilities\\Weapons\\SpiritOfVengeanceMissile\\SpiritOfVengeanceMissile.mdl"
local timer t = GetExpiredTimer()
set t = NewTimer()
call SetTimerData (t, 1)
set s.i = 0
endfunction
//===========================================================================
function JassSpell takes nothing returns nothing
local trigger g = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( g, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( g, Condition( function Spell_Conditions ) )
call TriggerAddAction( g, function Spell_Actions )
endfunction
endscope
Ai rành xem giúp mình tìm chổ sai, vì khi save nó báo "s (biến struct) is not type allow . syntax". Cụ thể mình muốn làm spell mỗi 1s bắn đạn vào target, bắn 3 lần.