Ok, I triggered up this script, but I'm not sure how I could make it MUI
Btw, the parabolic formula is based off of distance + height (the height is also based off the distance, so it's just distance)
If somebody could show me an example of how to make this MUI, that would be great
The things that I've picked up on so far to connect the handler func to the timer is:
-Attacheable Variables
-"Local Handle Variables" (not sure the difference)
-Game Cache
I plan to use global variables, I just want to get an integer out of the expired timer (put the integer into the arrays)
Also, if somebody could show me how to properly do the "Damage Area" function, that would be great (it won't show up in my JassCraft for some reason)
Btw, the parabolic formula is based off of distance + height (the height is also based off the distance, so it's just distance)
JASS:
//Conditions
function StartThrow_Condit takes nothing returns boolean
if GetSpellAbilityId() == 'A001' then
return true
endif
return false
endfunction
//Functions
function Movement takes nothing returns nothing
local real oldx = GetUnitX(udg_Ball)
local real oldy = GetUnitY(udg_Ball)
local effect bang
local real newheight = 0.0
set udg_PolarX = udg_PolarX + udg_MoveInterval
call SetUnitPosition(udg_Ball, oldx + udg_Cos * udg_MoveInterval, oldy + udg_Sin * udg_MoveInterval)
set newheight = (udg_A * udg_PolarX * udg_PolarX) - (udg_B * udg_PolarX)
call SetUnitFlyHeight(udg_Ball, newheight, 10000)
if newheight < 0.0 then
call ShowUnit(udg_Ball, false)
set bang = AddSpecialEffect("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl",GetUnitX(udg_Ball),GetUnitY(udg_Ball))
call DestroyEffect(bang)
call KillUnit(udg_Ball)
set udg_Ball = null
set bang = null
set udg_A = 0.0
set udg_B = 0.0
set udg_Cos = 0.0
set udg_Sin = 0.0
set udg_PolarX = 0.0
set udg_MoveInterval = 0.0
set udg_MaxHeight = 0.0
set udg_Distance = 0.0
endif
endfunction
function StartThrow takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x1 = GetUnitX(u)
local real y1 = GetUnitY(u)
local location loc = GetSpellTargetLoc()
local real x2 = GetLocationX(loc)
local real y2 = GetLocationY(loc)
local timer t = CreateTimer()
local real radians = Atan2(y2 - y1 , x2 - x1)
set udg_Distance = SquareRoot((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1))
set udg_Cos = Cos(radians)
set udg_Sin = Sin(radians)
set udg_MoveInterval = 10 + udg_Distance/75
set udg_PolarX = 0
set udg_MaxHeight = udg_Distance * .666 + 300
set udg_A = (-4 * udg_MaxHeight) / (udg_Distance * udg_Distance)
set udg_B = udg_Distance * udg_A
set udg_Ball = CreateUnit(GetOwningPlayer(u), 'h000', x1, y1, bj_RADTODEG * radians)
call RemoveLocation(loc)
set loc = null
call TimerStart(t, .035, true, function Movement)
call TriggerSleepAction(udg_Distance/udg_MoveInterval * .035)
call DestroyTimer(t)
set u = null
set t = null
endfunction
function InitTrig_Football_Throw takes nothing returns nothing
local integer i = -1
local trigger t = CreateTrigger()
//Add Actions
call TriggerAddAction(t, function StartThrow)
//Add Conditions
call TriggerAddCondition(t, Condition( function StartThrow_Condit))
//Loops
loop
set i=i+1
exitwhen i==12
//Events (Looped)
call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, null)
endloop
endfunction
If somebody could show me an example of how to make this MUI, that would be great
The things that I've picked up on so far to connect the handler func to the timer is:
-Attacheable Variables
-"Local Handle Variables" (not sure the difference)
-Game Cache
I plan to use global variables, I just want to get an integer out of the expired timer (put the integer into the arrays)
Also, if somebody could show me how to properly do the "Damage Area" function, that would be great (it won't show up in my JassCraft for some reason)