- Joined
- Aug 1, 2007
- Messages
- 66
I'm trying to learn jass. I've converted my triggers to script and am going through changing things. I'm up to my ability triggers and am trying to switch from globals to locals. I haven't been able to figure out what's causing errors on this script:
Here's the errors I'm getting:
Syntax error on the local unit target line
Undeclared variable on the set percentage[1] line
Percentage not an array on all the set percentage lines
Undeclared variable on the set damage line
This spell was created by Nightsong and credit is given.
Thanks alot for any help.
JASS:
function Trig_Transfusion_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0L1' ) ) then
return false
endif
return true
endfunction
function Trig_Transfusion_Actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local integer level = GetUnitAbilityLevel(caster,'A0L1')()
local real damage
local real array percentage
set percentage[1] = 0.05
set percentage[2] = 0.06
set percentage[3] = 0.08
set percentage[4] = 0.10
set percentage[5] = 0.12
set percentage[6] = 0.15
set percentage[7] = 0.19
set percentage[8] = 0.24
set percentage[9] = 0.30
set percentage[10] = 0.37
set damage = ( GetUnitStateSwap(UNIT_STATE_LIFE, target) * percentage[level] )
call SetUnitLifeBJ( caster, ( GetUnitStateSwap(UNIT_STATE_LIFE, caster) + damage ) )
call UnitDamageTargetBJ( caster, target, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endfunction
//===========================================================================
function InitTrig_Transfusion takes nothing returns nothing
set gg_trg_Transfusion = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Transfusion, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Transfusion, Condition( function Trig_Transfusion_Conditions ) )
call TriggerAddAction( gg_trg_Transfusion, function Trig_Transfusion_Actions )
endfunction
Here's the errors I'm getting:
Syntax error on the local unit target line
Undeclared variable on the set percentage[1] line
Percentage not an array on all the set percentage lines
Undeclared variable on the set damage line
This spell was created by Nightsong and credit is given.
Thanks alot for any help.