Prometheus
Everything is mutable; nothing is sacred
- Reaction score
- 590
Homing Missiles
Import Diff: 2/10 ~ Copying all the abilities
MUI: Yes
JESP: Yes
Constants: Yes
Units Affected: Enemy, Vulnerable
Target Type: Non-Target
Spell Info:
The caster shoots out a number of slow moving fire balls that last for 10 seconds. The fire balls will chase the randomly targeted units until they come it contact with them.
Level 1 - Shoots out 4 missiles, 100 damage if hit.
Level 2 - Shoots out 8 missiles, 200 damage if hit.
Level 3 - Shoots out 12 missiles, 300 damage if hit.
JASS:
scope HM initializer Init
//***************************************
// Spell Name: Homing Missiles *
// Spell Author: kc102/R34P3R *
// Optimized for vJass! *
//***************************************
//*************************************
// Start Configuration Functions
//*************************************
globals
private constant integer ABID = 039;A000039;
//Replace A000 with your spell ID.
private constant integer TRACK = 039;n000039;
//The ID of the unit that follows the enemies so the flame can see them.
private constant integer DUMID = 039;n002039;
//The ID for the dummy unit.
private constant integer DUMSPL = 039;A003039;
//The ID for the dummy units spell.
private constant integer BASENUM = 4
//This is how many BASE units this spell will create. Meaning, at level 2 it will be 8.
private constant real RANGE = 500
//This is the BASE range in which we will grab a unit. Meaning, at level 2 it will be 1000.
private constant string AUTOID = "selfdestructon"
//The orderstring so the units autoexplodes.
private constant string MOVE = "attackonce"
//Makes the unit move.
private constant string FX = "Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeTarget.mdl"
//The effects attached to the unit.
private constant string ATCHPNT = "origin"
//Where the effect attaches to.
endglobals
// NoTe
// Open up the object editor and find "Dummy Unit (Homing)", its ID is n002.
// The tracking unit is called "Dummy Unit (Tracker)" and its ID is n000.
// Created units last for 10 seconds, this is changable VIA the object editor.
// They have 10 HP with a -1 regen.
// The fields are Hit Points Maximum Base and Hit Points Regneration Rate.
// The HP of the unit. The units HP regen.
// To edit damage, open up the object editor and find the ability "Homing Blowup (A003)"
// Edit the level damage as you wish, it's called Full Damage Amount and Partial Damage Amount.
// The missles have an immolation like spell.
// To edit that find "Homing Damage (A001)" and edit the field "Damage per Interval".
private constant function GetRange takes integer lvl returns real
return RANGE*lvl
//This function takes the above variable, RANGE, and multiplies it by the units spell level.
endfunction
private function GetNum takes integer lvl returns integer
return BASENUM*lvl
//This function takes the variable BASENUM, and multiplies it by the units spell level.
endfunction
//*************************************
// End Configuration Functions
// Do not edit further unless you know what you're doing.
//*************************************
globals
private group g = CreateGroup()
private unit caster
private unit dummy
private unit target
private player pq
private integer splvl
private real cx
private real cy
endglobals
private function FailSafe takes nothing returns boolean
return true
endfunction
private function HIsAlly takes nothing returns boolean
if IsUnitEnemy(GetFilterUnit(),pq) and GetWidgetLife(GetFilterUnit()) > 0.405 then
call DestroyEffect(AddSpecialEffectTarget(FX,caster,ATCHPNT))
set dummy = CreateUnit(pq,DUMID,cx,cy,0.00)
call SetUnitAbilityLevel(dummy,DUMSPL,splvl)
set target = GetFilterUnit()
call IssueImmediateOrder(dummy,AUTOID)
call IssueTargetOrder(dummy,MOVE,target)
set dummy = CreateUnit(pq,TRACK,GetUnitX(target),GetUnitY(target),0.00)
call IssueTargetOrder(dummy, "move", target)
endif
return false
endfunction
private function HMC takes nothing returns boolean
return GetSpellAbilityId() == ABID
endfunction
private function HMA takes nothing returns nothing
set caster = GetTriggerUnit()
set splvl = GetUnitAbilityLevel(caster,ABID)
set cx = GetUnitX(caster)
set cy = GetUnitY(caster)
set pq = GetOwningPlayer(caster)
call GroupEnumUnitsInRangeCounted(g,cx,cy,GetRange(splvl),Condition(function HIsAlly),GetNum(splvl))
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
exitwhen i > 11
call TriggerRegisterPlayerUnitEvent(t,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,Condition(function FailSafe))
set i = i + 1
endloop
call TriggerAddAction(t,function HMA)
call TriggerAddCondition(t,Condition(function HMC))
endfunction
endscope
Code:
Changelog:
1.0 - Released
1.4 - Leak cleaned, Integrated flame life into spell, Locust re-added to the dummy units, Code improved
1.5 - Code improved at Rinpun's suggestion
2.0 - Missiles Blow Up Correctly, Added a tracking unit so the missile won't lose sight of the enemy, Various other changes
2.4 - Code is now JESP
2.5 - Some useless code removed
2.7 - Various Changes
4.0 - Changed to 4.0 because of major update. Uses vJass now.
4.1 - Further code improvements.
4.2 - Further, minor improvements.
4.3 - ||
4.4 - ||
4.5 - Global blocks split