Hi,
I wanted to create a spell, that deals damage to an enemy unit based on the current MP of the casting Unit.
Now there are 2 problems.
1. I didnt find a function on how to get the exact amount of the current Mana of the casting unit, only the ManaPercent. (solved)
2. The Moving Order targeting the enemy Unit doesnt work and Im pretty sure Ive taken the wrong Order, but Idk which one I shouldve taken.
So heres the script:
Hope you can help me,
Thx in advance
I wanted to create a spell, that deals damage to an enemy unit based on the current MP of the casting Unit.
Now there are 2 problems.
1. I didnt find a function on how to get the exact amount of the current Mana of the casting unit, only the ManaPercent. (solved)
2. The Moving Order targeting the enemy Unit doesnt work and Im pretty sure Ive taken the wrong Order, but Idk which one I shouldve taken.
So heres the script:
Code:
function trig_Manaburst_conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A004' )
endfunction
function trig_Manaburst_actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit dmgUnit = null
local unit targetUnit = GetSpellTargetUnit()
[COLOR="Blue"][B] local real damage = ( 0.5 * GetUnitManaPercent(caster) )[/B][/COLOR]
set dmgUnit = CreateUnitAtLoc( GetOwningPlayer(caster), 'h004', GetUnitLoc(caster), bj_UNIT_FACING )
[COLOR="Blue"][B] call SetUnitMoveSpeed( dmgUnit, 1000 )
call IssueTargetOrderBJ( dmgUnit, "move", targetUnit )[/B][/COLOR]
call UnitDamageTargetBJ( dmgUnit, targetUnit, damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC )
call RemoveUnit( dmgUnit )
endfunction
function InitTrig_Manaburst takes nothing returns nothing
local trigger trg_manaburst = null
set trg_manaburst = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( trg_manaburst, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( trg_manaburst, Condition( function trig_Manaburst_conditions ) )
call TriggerAddAction( trg_manaburst, function trig_Manaburst_actions )
endfunction
Hope you can help me,
Thx in advance
Last edited: