manofsteel
New Member
- Reaction score
- 36
This is my first submitted spell and also one of my first spells done in JASS.
Name: Deadly Survival
Description Absorbs energy from nearby corpses and gives it to you. If the corpse is an ally corpse you gain mana if it's an enemy corpse you gain health.
GUI/JASS: JASS
MUI/MPI: Both
Laggfree: Yes
Leakfree: Yes
Import difficulty: Very Easy
, just follow the instructions in the map.
A didn't think a screenshot was needed since it's really nothing to see(and I can't take screenshots on this computer...).
Code:
Name: Deadly Survival
Description Absorbs energy from nearby corpses and gives it to you. If the corpse is an ally corpse you gain mana if it's an enemy corpse you gain health.
GUI/JASS: JASS
MUI/MPI: Both
Laggfree: Yes
Leakfree: Yes
Import difficulty: Very Easy
, just follow the instructions in the map.
A didn't think a screenshot was needed since it's really nothing to see(and I can't take screenshots on this computer...).
Code:
JASS:
function Trig_DS_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A000039; //the ability that's being casted
endfunction
function Trig_dead takes nothing returns boolean
return IsUnitType (GetFilterUnit (), UNIT_TYPE_DEAD)
endfunction
function Trig_DS_Actions takes nothing returns nothing
local unit c = GetTriggerUnit()
local real x = GetUnitX(c)
local real y = GetUnitY(c)
local unit pu
local group g = CreateGroup()
local real r = (R2I(GetUnitAbilityLevel(c, 039;A000039; ))) *5 + 20
call GroupEnumUnitsInRange(g, x, y, 800.00, Condition(function Trig_dead))
loop
set pu = FirstOfGroup(g)
exitwhen pu == null
call GroupRemoveUnit(g, pu)
if IsUnitEnemy(pu, GetOwningPlayer(c)) == true then
call SetUnitState (c, UNIT_STATE_LIFE, GetWidgetLife(c) + r )
call RemoveUnit( pu )
else
call SetUnitState (c, UNIT_STATE_MANA, GetUnitState(c, UNIT_STATE_MANA) + r )
call RemoveUnit( pu )
endif
endloop
call DestroyGroup(g)
set g = null
set c = null
endfunction
//===========================================================================
function InitTrig_DS takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Trig_DS_Conditions ) )
call TriggerAddAction( t, function Trig_DS_Actions )
endfunction