Warcraft III resources & community, 2003–2006 · archived

Melee spell request....

2 posts
#1

Melee spell request....

Well i'm looking for a simple melee spell and since i'm terrible at spell making i guess i'll put in a request.


Caled great strike or something where the hero attacks and charges forward slashing everything in an area and moving....

Please reply or PM me if you thinking of doing this favor. Also if you need further explanations.
#2
This is a prerelease. ^^
The burning after being hit is not yet implemented, but will follow.
(additionally damaging the target would be not much more work, so you may rethink this...)
Just in case you want something to be changed:

function Trig_Foescythe_Unitfilter takes nothing returns boolean
  return GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE) > 0 and IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()),GetOwningPlayer(GetFilterUnit()))
endfunction

function Trig_Foescythe_Actions takes nothing returns nothing
  local effect fireStart
  local effect fireHit1
  local effect fireHit2
  local group targets
  local filterfunc unitfilter
  local integer strikes
  local integer strikesMax
  local lightning bolt
  local real modificator
  local real scytherX
  local real scytherY
  local real targetX
  local real targetY
  local timer iLoopOverride
  local unit scyther
  local unit target
  if GetSpellAbilityId() == <Name of Ability> then
    set targets = CreateGroup()
    set unitfilter = Filter(function Trig_Foescythe_Unitfilter)
    set scyther = GetTriggerUnit()
    set strikes = 0
    set strikesMax = GetUnitAbilityLevel(scyther, <Name of Ability> )
    set iLoopOverride = CreateTimer()
    set target = null
    loop
      set scytherX = GetUnitX(scyther)
      set scytherY = GetUnitY(scyther)
      call GroupEnumUnitsInRange(targets,scytherX,scytherY,600,unitfilter)
      call TimerStart(iLoopOverride,1,false,null)
      loop
        call TriggerSleepAction(0.003)
        exitwhen FirstOfGroup(targets) != null or TimerGetRemaining(iLoopOverride) <= 0
      endloop
      call GroupRemoveUnit(targets,target)
      if FirstOfGroup(targets) != null then
        set bj_groupRandomConsidered = 0
        set target = bj_groupRandomCurrentPick
        call ForGroup(targets,function GroupPickRandomUnitEnum)
        call TimerStart(iLoopOverride,0.5,false,null)
        loop
          call TriggerSleepAction(0.003)
          exitwhen bj_groupRandomCurrentPick != target or TimerGetRemaining(iLoopOverride) <= 0
        endloop
        set target = bj_groupRandomCurrentPick
        call GroupClear(targets)
        set targetX = GetUnitX(target)
        set targetY = GetUnitY(target)
        set fireStart = AddSpecialEffect("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl",scytherX,scytherY)
        set bolt = AddLightning("AFOD",true,scytherX,scytherY,targetX,targetY)
        set modificator = (targetX + targetY - 50) / (targetX + targetY)
        call SetUnitFacing(scyther,180 * Atan2(targetY - scytherY,targetX - scytherX) / 3.14159)
        call SetUnitPosition(scyther,targetX * modificator,targetY * modificator)
        call SetUnitAnimation(scyther,"attack")
        call UnitDamageTarget(scyther,target,GetHeroAgi(scyther,true) + 0.5 * GetHeroAgi(scyther,true) * GetUnitAbilityLevel(scyther,'A002'),true,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_FIRE,WEAPON_TYPE_METAL_HEAVY_SLICE)
        set fireHit1 = AddSpecialEffect("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl",targetX,targetY)
        set fireHit2 = AddSpecialEffect("Objects\\Spawnmodels\\Human\\SmallFlameSpawn\\SmallFlameSpawn.mdl",targetX,targetY)
        set strikes = strikes + 1
        call TriggerSleepAction(0.01)
        call DestroyEffect(fireStart)
        call DestroyEffect(fireHit1)
        call DestroyEffect(fireHit2)
        call DestroyLightning(bolt)
      else
        set strikes = strikesMax
      endif
      exitwhen strikes >= strikesMax
    endloop
    call DestroyGroup(targets)
    call DestroyFilter(unitfilter)
    call DestroyTimer(iLoopOverride)
  endif
  set targets = null
  set unitfilter = null
  set iLoopOverride = null
  set scyther = null
  set target = null
endfunction

function InitTrig_Foescythe takes nothing returns nothing
  set gg_trg_Foescythe = CreateTrigger()
  call TriggerRegisterPlayerUnitEvent(gg_trg_Foescythe,Player(0),EVENT_PLAYER_UNIT_SPELL_CAST,null)
  call TriggerAddAction(gg_trg_Foescythe,function Trig_Foescythe_Actions)
endfunction


Just create a new trigger, call it "Foescythe", convert it into custom script and copy this stuff into.
Then you need a hero ability, which does not need a specified target (I used a modified 'Aroa') and a hero to cast it of course.