• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Spell] Remade impale

Status
Not open for further replies.
Level 17
Joined
Nov 13, 2006
Messages
1,814
i posted here coz since i made it for fun (not really for spell section since for that this need timer for more accurated timeing)
i posted here coz i am curios to suggestion about ability, also maybe somebody else made trigger abilities what is similiar than original (chain lightning, forked lightning, etc) so its a bit lets talk about immitating the base skills :p

i attached the test map (its really just test map where i test the effects and what i think), there it is with dwarven hero/muradin skill

how u make frontal aoe spells? with make a region with offset between target and caster and pick everybody on that region?

JASS:
function Impale_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A00C'
endfunction

function Trig_Impale_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit ut = GetSpellTargetUnit()
local unit pu
local unit array ua
local real array spd
local effect array f
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real xt = GetUnitX(ut)
local real yt = GetUnitY(ut)
local real xd =  x + 150 * Cos(Atan2(yt - y, xt - x))
local real yd = y + 150 * Sin(Atan2(yt - y, xt - x))
local real xc = (xt - xd)
local real yc = (yt - yd)
local real xe 
local real ye 
local real ang = 180.0/3.14159 * Atan2(yt - y, xt - x)
local real dist = SquareRoot(xc  * xc + yc * yc)
local real dmg = GetHeroLevel(u) * 10 + GetUnitAbilityLevel(u, 'A00C')*10
local player p = GetTriggerPlayer()
local integer i = 150
local integer d 
local string s = "Abilities\\Spells\\Undead\\Impale\\ImpaleMissTarget.mdl"
local string s1 = "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl"
local string s2 = "Abilities\\Spells\\Undead\\Impale\\ImpaleHitTarget.mdl"
local string s3 = "Abilities\\Spells\\Human\\Thunderclap\\ThunderclapTarget.mdl"
local group g = bj_lastCreatedGroup
if dist > 150 then
loop
exitwhen (i-85>dist)
   set x = GetUnitX(u)
   set y = GetUnitY(u)
   set xt = GetUnitX(ut)
   set yt = GetUnitY(ut)
   set ang=Atan2(yt - y, xt - x)
   set xd = x + i * Cos(ang)
   set yd = y + i * Sin(ang)
   set xe = x + (i - 50) * Cos(ang)
   set ye = y + (i - 50) * Sin(ang)
   call DestroyEffect (AddSpecialEffect (s, xd,yd))
   call DestroyEffect (AddSpecialEffect (s1, xe,ye))
set i = i + 85
call TriggerSleepAction(.1)
endloop
endif

   call DestroyEffect (AddSpecialEffect (s, xt,yt))
   call DestroyEffect (AddSpecialEffect (s1, xt,yt))
   set xd = xt + 50 * Cos(ang)
   set yd = yt + 50 * Sin(ang)
   set xe = xt - 50 * Cos(ang)
   set ye = yt - 50 * Sin(ang)
   set bj_lastCreatedTerrainDeformation = TerrainDeformWave(xd, yd, (xe-xd)/100, (ye-yd)/100, 100, 200, 200, -100, 0, 1)
   call GroupEnumUnitsInRange(g,xt,yt,250.00,null)
   set i = 0

loop
 set pu = FirstOfGroup(g)
 exitwhen (pu==null)
 if (IsUnitEnemy(pu, p) and (GetWidgetLife(pu) > 0)) then
       set xe = GetUnitX(pu)
       set ye = GetUnitY(pu)
       call DestroyEffect (AddSpecialEffect (s2, xe,ye))
       call UnitDamageTarget(u, pu, dmg, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
       set ua[i] = pu

       if GetWidgetLife(pu) > 0 then
          set f[i] = AddSpecialEffectTarget(s3, pu, "overhead")
          call SetUnitInvulnerable( pu, true )
          call PauseUnit( pu, true )
       endif

       set i = i + 1
          call UnitAddAbility( pu, 'Amrf')
          call UnitRemoveAbility( pu, 'Amrf' )
          call SetUnitFlyHeight( pu, 500.00, 750.00 )

 endif
call GroupRemoveUnit(g, pu)
endloop
call TriggerSleepAction(.3)
set d = i
set i = 0
loop
exitwhen i > d 
    call SetUnitFlyHeight( ua[i], 0.00, 750.00 )
set i = i + 1
endloop
call TriggerSleepAction(1)
set i = 0
loop
exitwhen i > d 
 if GetWidgetLife(ua[i]) > 0 then
    call PauseUnit( ua[i], false )
    call SetUnitInvulnerable( ua[i], false )
    call DestroyEffect(f[i])
    set f[i]=null
 endif
    set ua[i]=null
set i = i + 1
endloop

set g = null
set u = null
set ut = null
set pu = null
set p = null
set s = null
set s1 = null
set s2 = null
set s3 = null
endfunction

//===========================================================================
function InitTrig_Impale_1 takes nothing returns nothing
    set gg_trg_Impale_1 = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Impale_1, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Impale_1, Condition( function Impale_Conditions ) )
    call TriggerAddAction( gg_trg_Impale_1, function Trig_Impale_Actions )
endfunction
 

Attachments

  • impale.jpg
    impale.jpg
    132.2 KB · Views: 1,733
  • pack2_1.w3x
    924.9 KB · Views: 87
Last edited:
Level 17
Joined
Nov 13, 2006
Messages
1,814
Pick every unit in range and then make calculations regarding the caster's facing and the angle between the caster and the enum unit.

but why pick every unit around the caster if somebody need only damage in line, not better then make x group enum in group ? (x=distance between spell max distance/the frontal aoe radius)

like
d=distance between caster & max point (max point = x+spell length*cos(ang*180/pi),y+spell length*sin(ang*180/pi))
loop
exitwhen i>dist
//do action
set i = i + the aoe spell radius (example the if frontal aoe is 100 radius then 100)
endloop

or pick all unit better and compare distance like if (distance between enumedunit position from caster unit) - (distance between point with polaroffset where angle=caster unit angle and distance is same than distance between enumed unit and caster)>spell radius then blabla endif?

or how u mean?
 
If you constantly use some things like that special effect strings etc declare them as globals, even in regular jass you can have basic setup function and call it at melee initialization where will you do:

JASS:
function shit takes nothing returns nothing
     //Impale spell
     udg_SFX1 = "Abilities\\Spells\\Undead\\Impale\\ImpaleMissTarget.mdl"
     ...
endfunction
then just add them to locals or use them like that.
Btw you don't need to null globals, so it can shorten your code.
 
Status
Not open for further replies.
Top