Spell [Spell] Isley's Death Arrows -- Claymore

NetherHawk

New Member
Reaction score
26
Jass/MUI
Leakless: not too sure.. hopefully

Description: The hero channels for 2 seconds and fires a volley of arrows to the sky. These arrows then auto acquire their target and impales them at lightning speed, stunning damage, dealing lots of damage and knocking them back from the force of the impact. The arrows may hit similar targets.

From the manga claymore: this is the Dweller of the Deep Isley's ability. I found it cool so i decided to make it. =D Claymore rocks.. recomend u guys to read it @ onemanga.com

Tried to make it look as nice as possible =D

uses local handle variables
JASS:
function Death_Arrows_Jass_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction

function DeathArrows_Filter takes nothing returns boolean
   local boolean b1 = IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit())) == true
   local boolean b2 = IsUnitType(GetFilterUnit(),UNIT_TYPE_MAGIC_IMMUNE) == false
   local boolean b3 = IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false
   return b1 and b2 and b3    
endfunction

function Skid takes nothing returns nothing
   local timer ty = GetExpiredTimer()
   local unit p = GetHandleUnit(ty,"target")
   local real r = GetHandleReal(ty,"dist")
   local real ax = GetHandleReal(ty,"angleofpush")
   local integer c = GetHandleInt(ty,"counter")
   local location pl = GetUnitLoc(p)
   local location pnl = PolarProjectionBJ(pl,r,ax)


   if c < 25 then // setting it to a higher number will increase knockback distance
       set c = c + 1
       call SetUnitPosition(p,GetLocationX(pnl),GetLocationY(pnl))
       call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl",p,"origin"))
       call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl",p,"chest"))
       call SetHandleHandle(ty,"target",p)
       call SetHandleReal(ty,"angleofpush",ax)
       call SetHandleInt(ty,"counter",c)
       call SetHandleReal(ty,"dist",r*.95)// to slow down rate of knockback
   else
       call PauseTimer(ty)
       call FlushHandleLocals(ty)
       call DestroyTimer(ty)
       set ty = null
   endif
   set p = null
   call RemoveLocation(pl)
   call RemoveLocation(pnl)
   set pl = null   
   set pnl = null 
endfunction   

function Damage takes nothing returns nothing
   local timer tx = GetExpiredTimer()
   local unit p = GetHandleUnit(tx,"target")
   local unit u = GetHandleUnit(tx,"caster")
   local integer i = GetUnitAbilityLevel(u,'A000')
   local unit q
   local real r = 20 // u can adjust knockback speed with this
   local integer c = 0
   local timer ty = CreateTimer()
   local real ax = GetHandleReal(tx,"angleofpush")
   
   if GetUnitAbilityLevel(p,'B000') > 0 then//determines when to create the purple, blood effects and the start of knockback
      call PauseTimer(tx)
      call SetHandleReal(ty,"angleofpush",ax)
      call SetHandleHandle(ty,"target",p) 
      call SetHandleReal(ty,"dist",r)
      call SetHandleInt(ty,"counter",c)
      call TimerStart(ty,.04,true,function Skid)
      call UnitDamageTarget(u,p,1,true,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_METAL_HEAVY_SLICE)// just for the sound effects
      set q = CreateUnit(GetOwningPlayer(u),'h003',GetUnitX(p),GetUnitY(p),bj_UNIT_FACING)// this is the dummy unit that provides the purple effect
      call UnitApplyTimedLife(q,'BTLF',0.04) 
      
      call DestroyTimer(tx)
      call FlushHandleLocals(tx)
      
      set u = null
      set p = null
      set q = null
   endif
   call SetHandleHandle(tx,"target",p)
   call SetHandleHandle(tx,"caster",u)
   
   set u = null
   set p = null
endfunction

function Prepare takes nothing returns nothing
   local trigger tr = GetTriggeringTrigger()// determines when the arrow has been shot to the sky
   local unit d = GetTriggerUnit()
   local location l = GetUnitLoc(d)    
   local unit u = GetHandleUnit(tr,"caster") 
   local real a = GetHandleReal(tr,"angle")   
   local integer i = GetUnitAbilityLevel(u,'A000')
   local real dx = GetUnitX(d)
   local real dy = GetUnitY(d)
   local integer kx = 1 + (2*i)
   local integer k = 0
   local unit x
   local group g
   local unit p     
   local group gx 
   local timer tx 
   local triggeraction ta = GetHandleTrigAct(tr,"action")
   local real ax

   call UnitAddAbility(d,'Aloc')   
   call PolledWait(1.5)
   call SetUnitVertexColorBJ(u,100,100,100,0 )// return caster to normal
                
   loop
   exitwhen k == kx // adjust kx value to a higher one so more arrows may be fired
       set gx = CreateGroup()
       set g = CreateGroup()
       set g = GetUnitsInRangeOfLocMatching(2500,l,Condition(function DeathArrows_Filter))  // pick units in range
       set gx =  GetRandomSubGroup(1,g) // pick unit to fire arrow at
       set x = CreateUnit(GetOwningPlayer(u),'h000',dx,dy,a)
       call SetUnitFlyHeight(x,600,6000)
       call SetUnitAbilityLevel(x,'A001',i)
       set p = FirstOfGroup(gx)
       call IssueTargetOrder(x,"thunderbolt",p)       
       call UnitApplyTimedLife(x,'BTLF',1)
       set ax = bj_RADTODEG*Atan2(GetUnitY(p)-GetUnitY(d),GetUnitX(p)-GetUnitX(d))
       set tx = CreateTimer()
       call SetHandleReal(tx,"angleofpush",ax)
       call SetHandleHandle(tx,"target",p)
       call SetHandleHandle(tx,"caster",u)
       call TimerStart(tx,.1,true,function Damage)
              
       set p = null
       set x = null
       call DestroyGroup(gx)  
       call DestroyGroup(g)  
       set k = k + 1
   endloop
   
   call RemoveUnit(d)
   call PolledWait(2.)
   set p = null
   set u = null
   set d = null
   call RemoveLocation(l)
   set l = null
   call DisableTrigger(tr)
   call TriggerRemoveAction(tr,ta)
   call DestroyTrigger(tr)
endfunction

function Fade takes nothing returns nothing
   local timer t1 = GetExpiredTimer()
   local integer f = GetHandleInt(t1,"fade")
   local unit u = GetHandleUnit(t1,"caster")   
   local integer c = GetHandleInt(t1,"counter")
        
   set f = f + 2 // to make the unit slowly fade
   if c < 50 then
       set c = c + 1
       call SetUnitVertexColorBJ(u,100,100,100,0 + f )
       call SetHandleInt(t1,"fade",f)
       call SetHandleInt(t1,"counter",c)
   else 
       call PauseTimer(t1)
       call FlushHandleLocals(t1)
       call DestroyTimer(t1)
       set t1 = null
   endif
   set u = null
endfunction     

function Death_Arrows_Jass_Actions takes nothing returns nothing
   local unit u = GetTriggerUnit()
   local location ul = GetUnitLoc(u)
   local real ulx = GetLocationX(ul)
   local real uly = GetLocationY(ul)
   local real a = GetUnitFacing(u)
   local location l = PolarProjectionBJ(ul,800,a)
   local real lx = GetLocationX(l)
   local real ly = GetLocationY(l)
   local unit d = CreateUnit(GetOwningPlayer(u),'h001',lx,ly,a)
   local unit x = CreateUnit(GetOwningPlayer(u),'h002',ulx,uly,a)
   local integer i = GetUnitAbilityLevel(u,'A000')
   local timer t1 = CreateTimer()
   local group g = CreateGroup()
   local integer f = 0
   local integer c = 0
   local trigger tr = CreateTrigger()
   local triggeraction ta = TriggerAddAction(tr,function Prepare)
      
   call SetUnitFlyHeight(d,600,600) // how high up the arrow should be shot
   call SetUnitVertexColorBJ(d,100,100,100,100 )//making unit transparent
   call SetHandleHandle(t1,"caster",u)
   call SetHandleInt(t1,"fade",f)
   call SetHandleInt(t1,"counter",c)
   call TimerStart(t1,.04,true,function Fade)//starting the fading of the caster
   call PolledWait(2)
   call SetUnitAbilityLevel(x,'A001',4)
   call IssueTargetOrder(x,"attackonce",d)
  
   call UnitApplyTimedLife(x,'BTLF',1)
   call SetHandleHandle(tr,"caster",u)
   call SetHandleReal(tr,"angle",a)
   call SetHandleHandle(tr,"action",ta)
   call TriggerRegisterUnitEvent(tr,d,EVENT_UNIT_DAMAGED)

   set u = null
   call RemoveLocation(ul)
   call RemoveLocation(l)
   set d = null
   set x = null
   set ul =null
   set l = null   
endfunction

//===========================================================================
function InitTrig_Death_Arrows_Jass takes nothing returns nothing
    set gg_trg_Death_Arrows_Jass = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Death_Arrows_Jass, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Death_Arrows_Jass, Condition( function Death_Arrows_Jass_Conditions ) )
    call TriggerAddAction( gg_trg_Death_Arrows_Jass, function Death_Arrows_Jass_Actions )
endfunction
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
Screenie ^^ Btw Naruto is better :p
---
JASS:
call SetUnitVertexColorBJ(u,100,100,100,0)

=>
JASS:
call SetUnitVertexColor(u,100,100,100,0)

---
JASS:
call SetUnitVertexColorBJ(u,100,100,100,0 + f )

the same =>
JASS:
call SetUnitVertexColorBK(u,100,100,100,0 + f)

---
JASS:
call SetUnitVertexColorBJ(d,100,100,100,100

again :p =>
JASS:
call SetUnitVertexColor(d,100,100,100,100

---
As Andrewgosu said we should start using constant functions :p
JASS:
local integer i = GetUnitAbilityLevel(u,'A000')

=>
JASS:
constant function Claymore_AbilCode takes nothing returns integer
    return 'A000'   
endfunction

function actions takes nothing returns nothing
    local integer i = GetUnitAbilityLevel(u, Claymore_AbilCode)
endfunction

He said something like that, right? :s
 

0zaru

Learning vJASS ;)
Reaction score
60
Yes, but it's a lot better and makes the spell GUI-Friendly a little =P

And that's judge a lot you must know (At least i think that)

JASS:
   local location ul = GetUnitLoc(u)
   local real ulx = GetLocationX(ul)
   local real uly = GetLocationY(ul)

//Why don't just use
local real ulx=GetUnitX(ul)
local real uly=GetUnitY(ul)


Again here you are using a lots of bjs, wasting a little time in code
JASS:
   local location l = PolarProjectionBJ(ul,800,a) //Also 800 can be constant function/global so we can easily modificate that thinks.
   local real lx = GetLocationX(l)
   local real ly = GetLocationY(l)
set lx=ulx+800*Cos(a) // This works with radians, if you look inside the function PolarProjectionBJ it multiplies the angle * bj_DEGTORAD
set ly=uly+800*Sin(a) //same
//When creating:
local real lx=ulx+800*Cos(a)
local real ly=uly+800*Sin(a)


There are some others polarprojections in your code, I just looked to some functions.

WHY are you creating groups inside the loops!! At least i think that them don't destroy itselfts. then you can just remove and add the units again.
JASS:
   loop
   exitwhen k == kx // adjust kx value to a higher one so more arrows may be fired
       set gx = CreateGroup()
       set g = CreateGroup()

just create them outside and use them whenever you need. You must start using coordinates.

But anyway nice spell
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top