• 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.

Missile Problems

Status
Not open for further replies.
Level 5
Joined
Aug 23, 2007
Messages
141
I need some help. I'm pretty good when it comes to inventing spells (particularly spells that hit the same target or an area multiple times), but there're a few things I can't get right. How do you make a spell damage the target only when the missile hits? (eg. Storm Bolt) And I want to make a spell that creates a 500 AoE pathing blocker that pushes nearby units away from the caster for a limited time. Got any ideas?
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
so you say you want to lunch a missle to target with spell
and the missle damages target pushes nearby units to far and blocking them from coming near the target unit

Hmm I suggest you to forget the missle
Detecting a spell with missle when it hits a target is really hard to make
Just make a instant ability


This is my push and block function it works as you asked and created on your request
How to Use this:
Put the JASS code to your map header (<map name>.mdx in trigger editor)
And execute it with
  • Custom Script: call push(<target unit>,<area of effect>,<block duration>)
(<target unit> might be GetSpellTargetUnit() if you execute with "unit starts effect of an ability")

JASS:
function push takes unit target,real area,real duration returns nothing
local destructable array d
local real dir
local group g = CreateGroup()
local unit u
local real x = GetUnitX(target)
local real y = GetUnitY(target)
local integer a = 0
local integer b = 360
local real x2
local real y2
call GroupEnumUnitsInRange(g,x,y,area,Filter(null))
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        if GetWidgetLife(u) > 0 and ((u == target) == false) and not IsUnitType(u,UNIT_TYPE_STRUCTURE)) then
            set x2 = GetUnitX(u)
            set y2 = GetUnitY(u)
            if x2 == x  then
            set x2 = x2+1
            endif
            if y2 == y then
            set y2 = y2+1
            endif
            call SetUnitPosition(u,Cos(Atan((y2-y)/(x2-x)))*(area+50),Sin(Atan((y2-y)/(x2-x)))*(area+50))
        endif
        call GroupRemoveUnit(g,u)
   endloop
   loop
        exitwhen a == b
        set d[a] =  CreateDestructable('YTFC',Cos(a)*area,Sin(a)*area,0,1,1)
        set a = a+1
    endloop
    call TriggerSleepAction(duration)
       loop
        exitwhen a == b
        call RemoveDestructable(d[a])
        set a = a+1
    endloop
endfunction
Note: This function doesnt damage anyone PM me if you want a damaging one or add damage stuff yourself


---FUNCTION EDITED AGAIN---
 
Last edited:
Level 19
Joined
Aug 24, 2007
Messages
2,888
what do you mean works fine ?
It cant work fine its wrong I just came to internet cafe to fix that
Anyway its fixed now(edited) I guess

About the dummy missle you aksed
Well you can use something like that but it will have max of 522 speed anyway good idea

And you can change the destructable 'YTFC' to another one to make cool effects
Its Pathing Blocker (Both) (Large) in this

And +rep (
reputation.gif
)
please to make your "Thanks" more effective
 
Last edited:
Level 5
Joined
Aug 23, 2007
Messages
141
By works fine, it's coz I asked our school's Computer Professor to take a look before I placed it on my testmap. He told me something bout a "needing debugging," but I didn't understand it aside from the fact something was wrong. Then he changed a bit of the trig, and it works fine.
 
Status
Not open for further replies.
Top