- Joined
- Jul 28, 2008
- Messages
- 211
Im still learning JASS and the best way to learn is to try and make something.
I came up with this:
Basicly, its a user defined function. But, it doesn't work. When i try to start the map, nothing happens. It just won't start.
Whats the problem?
Thx!
I came up with this:
JASS:
globals
unit cast
unit targ
real per = 0.5
real tim = 15.
real dam = 8
endglobals
//=========================================================================
function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'qwer'
endfunction
function Trig_Spell_Actions takes nothing returns nothing
set cast = GetSpellAbilityUnit()
set targ = GetSpellTargetUnit()
call DoT( targ, cast, per, tim, dam )
endfunction
//===========================================================================
function InitTrig_Spell 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 Trig_Spell_Actions )
endfunction
JASS:
function DoT takes unit target, unit caster, real period, real time, real dmg returns nothing
local real t = time
local real p = 0.
loop
exitwhen t == p
call UnitDamageTarget( caster, target, dmg, false, true, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
call TriggerSleepAction(period)
set p = p + period
endloop
endfunction
Basicly, its a user defined function. But, it doesn't work. When i try to start the map, nothing happens. It just won't start.
Whats the problem?
Thx!
