I'm making a spell called Bloodfire, which deals a certain amount of damage, and then heals the caster for a percentage of the target's remaining health. I got the spell to work using GUI, but it used globals so I tried converting it to custom text and changing all the udg_ variables to local real variables. However, this didn't work (much to my surprise) and I've tried many times to fix it to no avail. Here are the GUI and JASS versions:
NOTE: I'm planning on using this spell in the current hero contest going on, so if it's against the rules for me to get help then.. well, I dunno. Anyways, in the case that it's fine thanks in advance!
-NS
-
Bloodfire GUI
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Bloodfire
-
Actions
- Set TaintMultiplier = 1.00
- If (((Target unit of ability being cast) has buff Taint (Level 1)) Equal to True) then do (Set TaintMultiplier = 1.20) else do (Do nothing)
- If (((Target unit of ability being cast) has buff Taint (Level 2)) Equal to True) then do (Set TaintMultiplier = 1.30) else do (Do nothing)
- If (((Target unit of ability being cast) has buff Taint (Level 3)) Equal to True) then do (Set TaintMultiplier = 1.40) else do (Do nothing)
- If (((Target unit of ability being cast) has buff Taint (Level 4)) Equal to True) then do (Set TaintMultiplier = 1.50) else do (Do nothing)
- Set BloodfireDamage = (TaintMultiplier x (40.00 + (50.00 x (Real((Level of (Ability being cast) for (Triggering unit)))))))
- Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing BloodfireDamage damage of attack type Chaos and damage type Normal
- Set BloodfireHeal = ((Life of (Target unit of ability being cast)) x (0.05 x (Real((Level of (Ability being cast) for (Triggering unit))))))
- Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + BloodfireHeal)
-
Events
JASS:
function Bloodfire_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A008'
endfunction
function Bloodfire_Func002001 takes nothing returns boolean
return ( UnitHasBuffBJ(GetSpellTargetUnit(), 'B001') == true )
endfunction
function Bloodfire_Func003001 takes nothing returns boolean
return ( UnitHasBuffBJ(GetSpellTargetUnit(), 'B002') == true )
endfunction
function Bloodfire_Func004001 takes nothing returns boolean
return ( UnitHasBuffBJ(GetSpellTargetUnit(), 'B003') == true )
endfunction
function Bloodfire_Func005001 takes nothing returns boolean
return ( UnitHasBuffBJ(GetSpellTargetUnit(), 'B000') == true )
endfunction
function Bloodfire_Actions takes nothing returns nothing
local real taintmultiplier = 1.0
if ( Trig_Bloodfire_Func002001() ) then
local real taintmultiplier = 1.2
else
if ( Trig_Bloodfire_Func003001() ) then
local real taintmultiplier = 1.3
else
if ( Trig_Bloodfire_Func004001() ) then
local real taintmultiplier = 1.4
else
if ( Trig_Bloodfire_Func005001() ) then
local real taintmultiplier = 1.5
local real BloodfireDamage = ( TaintMultiplier * ( 40.00 + ( 50.00 * I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetTriggerUnit())) ) ) )
call UnitDamageTargetBJ( GetTriggerUnit(), GetSpellTargetUnit(), BloodfireDamage, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL )
local real BloodfireHeal = ( GetUnitStateSwap(UNIT_STATE_LIFE, GetSpellTargetUnit()) * ( 0.05 * I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetTriggerUnit())) ) )
call SetUnitLifeBJ( GetTriggerUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) + BloodfireHeal ) )
endif
endif
endif
endif
endfunction
//===========================================================================
function InitTrig_Bloodfire takes nothing returns nothing
set gg_trg_Bloodfire = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Bloodfire, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Bloodfire, Condition( function Bloodfire_Conditions ) )
call TriggerAddAction( gg_trg_Bloodfire, function Bloodfire_Actions )
endfunction
NOTE: I'm planning on using this spell in the current hero contest going on, so if it's against the rules for me to get help then.. well, I dunno. Anyways, in the case that it's fine thanks in advance!
-NS