HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

A few questions concerning Crushing Wave

10-25-2006, 08:44 PM#1
darkwulfv
Ok, title is a little confusing...

I have a spell using Crushing Wave as it's base. I'm going to make a trigger that, after the first wave is done, it is sent back to the caster. However, I have no clue how to do a few things.

1. Find the time it takes for the wave to finish (when the effect dissipates)

2. Creating a unit EXACTLY at the end point, then make it cast EXACTLY back. The caster will be paused during this time, so no moving is possible. So casting back isn't too hard. The spell also *SHOULD* go 900 distance, so creating the unit at the right distance isnt hard either. However, I don't know how to determine the exact point at which the wave ends at, so that it can be sent back. (the X and Y of the casting unit, idk what to add onto it so that it lines up with where the wave was.)

Any help is greatly appreciated! In the mean time I'll try to figure some of this out myself...

EDIT: Since the caster will be paused, and also since he changes his angle when he casts, I should just have to change the X/Y value to... *thinking*
EDIT2: X+0, Y+900.
EDIT3: The wave ALWAYS goes 900, I don't know why it would stop before that. I think I've got all my problems except finding time of missle fixed.
10-25-2006, 09:07 PM#2
Taur
Use polar offsets, create the unit at a polar offset from the centre of the unit, with a direction of 900 using the angle between the two points (point of caster, target point of ability cast).
10-25-2006, 09:15 PM#3
darkwulfv
Quote:
Use polar offsets, create the unit at a polar offset from the centre of the unit, with a direction of 900 using the angle between the two points (point of caster, target point of ability cast).
Ok, I'm really sorry to ask this, but I haven't the slightest clue how to do that. Do you know of a tutorial that can show me the script needed? Or would you be willing to help? Thanks though, at least I know its polar projection.
EDIT: It can't be polar projection, because it wants target point. Alot of times, the ability is cast on a unit, or a point below 900, so the wave continues on beyond that point. (unless the wave stops at that point no matter what, which I so highly doubt.)
10-25-2006, 09:54 PM#4
Captain Griffen
You get the radians between casting unit and target, then you project along that. Obvious you could use angles, but since the functions use radians, that would be rather silly, wouldn't it?
10-25-2006, 10:29 PM#5
darkwulfv
Quote:
radians
radians...? Using anythin beyond X/Y is completely new to me, and I only just started learning 9th grade math (we just finished algrebra) so I'm not accustomed to most mathematical terms involving anything above basic geometry...

Still looking for how to calculate the time it takes for the wave to reach its end... Actually, nvm. I'm going to add a wait in there from the when the spell starts. That way, the units have a chance to run (yeah right) out of the line of fire (water ^^) before the surge comes back. I actually think it would look better that way...
10-26-2006, 03:27 AM#6
[VDM]Amn
Look...

Abilities like Crushing Wave have this value named Data - Distance, it's where the effect and ability's damage ends.

u just make the unit do all that spell u said and then add something like above;
(Please make an effort to understand this lines, it's not that hard)
Trigger:
Collapse events
Unit - Begins casting an ability
Collapse conditions
Ability being cast is equal to Crushing Wave < Your ability name.
Casting unit is a hero equal to True < to avoid any DummyUnit triggering.
Collapse actions
Unit - Create 1 DummyUnit for Triggering Player at (position of casting unit) offset by [Data - Distance] towards (angle between points(position of casting unit) and (target point of ability being cast) degrees) facing Default building facing degrees
Unit - Add ability Crushing Wave2 to last created unit
Unit - order last created unit to Neutral - Crushing Wave position of casting unit
Unit - Add a 3.00 seconds Generic expiration timer to (Last created unit)

Create a second crushing wave for the dummyunit and set it's Casting Time to a value that coordinates with the end of the first one.

This way u dont have to add waits, variants, sheeps(?).

i hope i was clear enough.
10-26-2006, 04:12 AM#7
Tiki
Make the wave have no art...
Then have a unit the model of the art with no collision...

When cast, create the unit and have it go to the point of cast and have it return.
10-26-2006, 11:14 AM#8
darkwulfv
I actually have a way (my original idea) that works perfect. Just create 2 variables, x (of caster) and y (ofcaster)+900. Then make the unit at x, y. This makes the unit at the right spot (+900 is the distance of the wave). Then tell the unit to use the spell at x, y-900, which is the point the caster is at. It requred no angles or anything.

EDIT: Nvm... ONly works when the spell is cast directly in front... Can somone put the GUI trigger in JASS for me? (I'm trying to make my map 100% JASS).
10-26-2006, 12:22 PM#9
Rising_Dusk
Quote:
x (of caster) and y (ofcaster)+900
That only works if you're firing the projectile at an angle of pi/2 radians (90 degrees).

Collapse JASS:
function BlahBlahOoooh takes nothing returns nothing
    local unit u = udg_YourHeroOrHoweverYouManageIt
    local real xi = GetUnitX(u)
    local real yi = GetUnitY(u)
    local location l = GetSpellTargetLoc()
    local real xf = GetLocationX(l)
    local real yf = GetLocationY(l)
    local real angle = 57.29582 * Atan2(yf - yi, xf - xi)
    local real distance = 900       //This is a constant value for the spell unless otherwise stated

    //********************************************************************************
    //**  If you wanted to find xf/yf experimentally you could do the following
    //**  (These numbers are arrived at via polar projections)
    set xf = xi + distance * Cos(angle * 0.01745)
    set yf = yi + distance * Sin(angle * 0.01745)

    //Do stuff
    
    call RemoveLocation(l)
    set l = null
    set u = null
endfunction
You can then moderate the projectile and see when it's distance reaches 900 (Or whatever) and then start one moving the other way.
To moderate the projectile you make a unit and either attach the Crushing Wave FX to it's origin or you make the FX the base model.
Then move the unit around as though it were an SFX.

Note, this function is an example.
It won't make the spell work, it's just here to show you HOW to use polar projections and such.
(And how to get the angle between points)
10-26-2006, 01:09 PM#10
The)TideHunter(
And ofc to get the time you have to wait, its Projectile Speed / distance.

You can get both of them on your spell.

Give me 10 mins, i'll get what you want completed.

EDIT: Ok im back.

You need to edit some stuff in it, because i dont know what stuff your spell is made from.

Ok here it is:

Collapse JASS:
function FireBack takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local string s = I2S(H2I(t))
    local unit u = I2Unit(GetStoredInteger(GC(), s, "Caster"))
    local unit d = CreateUnit(GetOwningPlayer(u), '####', GetStoredReal(GC(), s, "x"), GetStoredReal(GC(), s, "y"), GetStoredReal(GC(), s, "face"))
    call IssuePointOrder(d, "Order Sting of the wave", GetUnitX(u), GetUnitY(u))
    call UnitApplyTimedLife(d, 'BTLF', 5.)
    call FlushStoredMission(GC(), s)
    call DestroyTimer(t)
    set t = null
    set u = null
    set d = null
endfunction 

function WaveReverseThingy takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local location l = GetSpellTargetLoc()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real d = 900 // Distance
    local real s = 1000 // Speed, check your ability for Projectile Speed
    local real a = bj_RADTODEG * Atan2(GetLocationY(l)-y, GetLocationX(l)-x)
    local real t = d/s
    local timer c = CreateTimer()
    local real fx = x + d * Cos(a * bj_DEGTORAD)
    local real fy = y + d * Sin(a * bj_DEGTORAD)
    local string sa = I2S(H2I(c))
    call StoreInteger(GC(), sa, "caster", H2I(u))
    call StoreReal(GC(), sa, "x", fx)
    call StoreReal(GC(), sa, "y", fy)
    call StoreReal(GC(), sa, "face", a)
    call TimerStart(c, t, false, function FireBack)
    call RemoveLocation(l)
    set l = null
    set u = null
    set c = null
endfunction

Its pretty rushed, if i'v made mistakes then just point them out.
Ok, it should wait the right time then fire it back, just like you asked, i havent tested it, but gah.

Things need your imput:

'####' on the CreateUnit on the first function, a dummy unit with the spell.
"Order Sting of the wave" on the Cast bit, the order string.

You need a GC function, which i know you have, and I2Timer and H2I, which i think i gave you for another spell, if theyre named something different just edit this spell and rename them.
10-26-2006, 03:19 PM#11
blu_da_noob
Why do you guys convert radians to degrees and then back to radians?
10-26-2006, 05:48 PM#12
The)TideHunter(
Quote:
Originally Posted by blu_da_noob
Why do you guys convert radians to degrees and then back to radians?

Well, since i havent even done GCSE in maths, i have no idea what to do in some situations, so i just follow off bj functions.
10-26-2006, 07:24 PM#13
darkwulfv
Tide, I have H2I, but I don't think I have GC. I have a function called LocalVars, which involves a bunch of gamecahce stuff. I also don't have the I2Timer.

EDIT: Nope, I don't have GC, I don't have I2Unit, and I don't think I need I2Timer (its not in the trigger you gave me) But send it anyways so it can be used later.
10-26-2006, 09:45 PM#14
The)TideHunter(
Oh, sorry, i dident mean I2Timer, i meant I2Unit.
and for the GC function, LocalVars is exactly the same, use that.
and I2Unit:

Collapse JASS:
function I2Unit takes integer I returns unit
    return I
    return null
endfunction

All functions with I2~ have do exactly the same thing, but its just the name of the function and what it returns that change (just so i dont have to keep posting new ones xD)
10-26-2006, 10:00 PM#15
Rising_Dusk
Quote:
Why do you guys convert radians to degrees and then back to radians?
Because I like to.
Quite frankly, having the game do multiplication a couple times isn't the end of the world.
Oh, and degrees make more sense to me.