- Joined
- Jul 9, 2008
- Messages
- 253
Hey guys, I have another problem. As I said before I am new to JASS so this might seem stupid for you good JASS'ers.
Code:
Code:
JASS:
function Trig_Energy_Sap_Conditions takes nothing returns unit
return GetUnitTypeId(GetAttacker) == 'H009' //This line gives an error that says it needs another "("
endfunction
function Trig_Energy_Sap_Actions takes nothing returns nothing
local unit attacker = GetAttacker()
local unit attacked = GetTriggerUnit()
local real X = GetUnitX(attacked)
local real Y = GetUnitY(attacked)
local integer level = GetUnitAbilityLevel(attacker, 'A00F')
local real mana = GetUnitState(attacked,UNIT_STATE_MANA)
local real agi = (I2R(GetHeroAgi(attacker,true))
local real burn = ((I2R(level)) * agi)
local string sfx = "Abilities\\Spells\\Human\\Feedback\\ArcaneTowerAttack.mdl"
//Actions//
if mana >= burn then
call UnitDamageTarget(attacker,attacked,burn,true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call SetUnitState(attacked,UNIT_STATE_MANA, (mana - burn))
call DestroyEffect(AddSpecialEffect(sfx, X,Y)
endif
//Actions//
set attacked = null
set attacker = null
set sfx = null
endfunction
//===========================================================================
function InitTrig_Energy_Sap takes nothing returns nothing
set gg_trg_Energy_Sap = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Energy_Sap, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Energy_Sap, Condition( function Trig_Energy_Sap_Conditions ) )
call TriggerAddAction( gg_trg_Energy_Sap, function Trig_Energy_Sap_Actions )
set gg_trg_Energy_Sap = null
endfunction