- Joined
- Feb 11, 2011
- Messages
- 1,860
Hi guys,
I have 'installed' NewGen and tried to save my map it gives me an error. When I saved it with the normal editor it was fine.
One of my heroes, the Priest, has this spell called Replenish:
Here is the script:
What am I doing wrong? Also, if there are aspects that I could improve on, please point them out.
Thanks!
I have 'installed' NewGen and tried to save my map it gives me an error. When I saved it with the normal editor it was fine.
One of my heroes, the Priest, has this spell called Replenish:
ReplenishHeals all allied heroes. The amount healed depends on the Priest's intelligence.
Level 1: Heals by 4x intelligence
Level 2: Heals by 6x intelligence
Level 3: Heals by 8x intelligence
Level 4: Heals by 10x intelligence
Level 5: Heals by 10x intelligence
JASS:
function Replenish_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit targ = GetEnumUnit()
local real r = ((2 * GetUnitAbilityLevel(u, 'A014') + 2) * GetHeroInt(u, true))
local texttag t = CreateTextTag()
call SetUnitState(targ, UNIT_STATE_LIFE, GetUnitState(targ, UNIT_STATE_LIFE) + r)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", targ, "origin"))
call SetTextTagText(t, "|cff00ff00+" + I2S(R2I(r)) + "|r", 0.023)
call SetTextTagPosUnit(t, targ, 50)
call SetTextTagVelocity(t, 0, 64 * 0.071 / 128)
call SetTextTagPermanent(t, false)
call SetTextTagLifespan(t, 2)
call SetTextTagFadepoint(t, 1)
call SetTextTagVisibility(t, true)
set t = null
set u = null
set targ = null
endfunction
function Replenish_Conditions takes nothing returns boolean
return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == true and IsPlayerAlly(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetTriggerUnit())) == true
endfunction
function act_Replenish takes nothing returns nothing
local group ug = CreateGroup()
call GroupEnumUnitsInRect(ug, GetPlayableMapRect(), Condition(function Replenish_Conditions))
call ForGroup(ug, function Replenish_Actions)
call DestroyGroup(ug)
set ug = null
endfunction
function cond_Replenish takes nothing returns boolean
if (GetSpellAbilityId() == 'A014') then
return true
endif
return false
endfunction
function InitTrig_Replenish takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function cond_Replenish))
call TriggerAddAction(t, function act_Replenish)
endfunction
Thanks!