Immolation
Member
- Reaction score
- 20
God's Hand
Calls forth rays of holy light to allies around the caster. The rays jump and heal nearby targets. Heals less each bounce.
GUI/vJASS= vJASS
Leakless?= Yes.
Lagless?= Yes.
MUI/MPI?= MUI
Changelog:
v2.00
-Updated code.
-Spell can now target random units around the caster.
-Replaced some globals with configurable functions.
-Changed test map.
Code:GUI/vJASS= vJASS
Leakless?= Yes.
Lagless?= Yes.
MUI/MPI?= MUI
Changelog:
v2.00
-Updated code.
-Spell can now target random units around the caster.
-Replaced some globals with configurable functions.
-Changed test map.
JASS:
scope GodsHand initializer Init
//-------------------------------------------------------------
// God's Hand by Immolation
//-------------------------------------------------------------
// Description:
//---------------------------
// Calls forth rays of holy light to allies around the caster. The rays jump and heal nearby targets.
// Heals less each bounce.
// What do I need to import it in my map?
//---------------------------
// You need to download JASS NewGen, available at the following links:
//
// -http://www.thehelper.net/forums/showthread.php?t=73936-
// -http://www.wc3c.net/showthread.php?t=90999-
//
//Install it and then read the following paragraph.
// How do I put it in my map?
//---------------------------
// 1. Copy:
// a. The "God's Hand" ability.
// b. The "Healing Wave(God's Hand) ability.
// c. Copy the "Dummy Unit" into your map(if you already don't have one).
// d. Copy this trigger.
// 2. Press CTRL + D while in Abilities section in Object Editor to find out the rawcode of:
// a. The "God's Hand" ability. Change the SPELL_ID to the rawcode that you find(it's 'A000' in this map).
// b. The "Healing Wave(God's Hand)" ability. Change the HEALWAVE_ID to the rawcode that you find(it's 'A001' in this map).
// c. The "Dummy Unit" unit. Change the DUMMY_ID to the rawcode that you find(it's 'n000' in this map).
// (If you already have a dummy unit, change DUMMY_ID to the rawcode of your unit.)
// 3. You have succesfully imported the spell <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" />
// Changelog:
//---------------------------
// v2.00
//-Updated code.
//-Spell can now target random units around the caster.
//-Replaced some globals with configurable functions.
//-Changed test map.
//---------------------------
// TheHelper.net
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// LIST OF CONFIGURABLES
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//About Configurables:
// Configure the bounces and the healing amount in the Object Editor.
globals
//Rawcodes:
private constant integer SPELL_ID = 039;A000039; //Rawcode of the "God's Hand" ability.
private constant integer HEALWAVE_ID = 039;A001039; //Rawcode of the "Healing Wave(God's Hand)" ability.
private constant integer DUMMY_ID = 039;n000039; //Rawcode of the "Dummy Unit".
//Other stuff:
private constant boolean RANDOM_RAYS = true // If set to true, rays will choose a random target within range to heal.
// If set to false, rays will always heal the caster and then bounce to nearby targets.
endglobals
private function DummyHeight takes integer level returns real
return 3000 + (level * 1000.00) //Note that this has a graphical effect in game, rays are "faster" if the dummy is higher.
endfunction
private function NumberOfRays takes integer level returns integer
return 2 + level
endfunction
private function TimeBetweenRays takes integer level returns real
return 0.50 - (0.03 * level)
endfunction
private function RandomizeArea takes integer level returns real
return 400.00 + (level * 15.00) // No use unless RANDOM_RAYS is set to true.
endfunction
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
globals
private group g = CreateGroup()
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
private function GroupFilter takes nothing returns boolean
return IsPlayerAlly(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetTriggerUnit())) == true and GetUnitTypeId(GetFilterUnit()) != 039;n000039;
endfunction
private function Main takes nothing returns nothing
local unit caster = GetTriggerUnit()
local real x
local real y
local integer level = GetUnitAbilityLevel(caster, SPELL_ID)
local integer LoopStart = 1
local integer LoopEnd = NumberOfRays(level)
local player p = GetOwningPlayer(caster)
local unit dummy
local unit target
loop
exitwhen LoopStart > LoopEnd
set LoopStart = LoopStart + 1
if RANDOM_RAYS == true then
set x = GetUnitX(caster)
set y = GetUnitY(caster)
call GroupEnumUnitsInRange(g, x, y, RandomizeArea(level), Condition(function GroupFilter))
set target = GroupPickRandomUnit(g)
set dummy = CreateUnit(p, DUMMY_ID, x, y, 0.00)
call UnitAddAbility(dummy, HEALWAVE_ID)
call SetUnitAbilityLevel(dummy, HEALWAVE_ID, GetUnitAbilityLevel(caster, level))
call SetUnitFlyHeight(dummy, DummyHeight(level), 0.00)
call SetUnitState(target, UNIT_STATE_LIFE, GetUnitState(target, UNIT_STATE_LIFE) - 1.00) //Dummies won't cast the spell on units with full HP.
call IssueTargetOrder(dummy, "healingwave", target)
call TriggerSleepAction(TimeBetweenRays(level))
else
set x = GetUnitX(caster)
set y = GetUnitY(caster)
set dummy = CreateUnit(p, DUMMY_ID, x, y, 0.00)
call UnitAddAbility(dummy, HEALWAVE_ID)
call SetUnitAbilityLevel(dummy, HEALWAVE_ID, GetUnitAbilityLevel(caster, level))
call SetUnitFlyHeight(dummy, DummyHeight(level), 0.00)
call SetUnitState(caster, UNIT_STATE_LIFE, GetUnitState(caster, UNIT_STATE_LIFE) - 1.00) //Dummies won't cast the spell on units with full HP.
call IssueTargetOrder(dummy, "healingwave", caster)
call TriggerSleepAction(TimeBetweenRays(level))
endif
endloop
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Conditions))
call TriggerAddAction(t, function Main)
endfunction
endscope
Need feedback, thanks.