KvickaN
TH.net Regular
- Reaction score
- 24
Ok guys I just want to tell you that I do not know ANY JASS AT ALL!
That out of the way, couple of questions!
1. What do I change here to make the hook go THRUE trees?
2.
+rep for helpers!
That out of the way, couple of questions!
1. What do I change here to make the hook go THRUE trees?
Code:
scope MeatHook
globals
private constant integer MH_ID = 'A000' //Raw code of the Meat Hook ability
private constant integer Hook_Part_ID = 'h001' //Raw code of the Hook Part unit
private constant string Eyecandy = "Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodFootman.mdl" //SFX created on target
private constant real Range_Base_Value = 700 //Formula for hook range = level * Max_Range_Increment + Range_Base_Value
private constant real Max_Range_Increment = 600
private constant real Max_Range = 1000 //A limit for the range of the hook - it will NOT go above this range. Don't want a limit? Then set this value to something... big.
private constant real Dmg_Base = 300 //Formula for hook damage = level * Dmg_Base
private constant real Speed = 30 //The distance between 2 Hook_Part_ID units/how fast the hook goes, however, speed should generally be modified through Timer_Interval
private constant real AoE = 80 //How close a target needs to be to be snagged (remember this adds to the total range of the hook)
private constant real Timer_Interval = 0.03
endglobals
private struct dat
unit u
unit array D[500]
real ang
integer lvl
real rng
real OX
real OY
integer i
unit p
endstruct
private function Cond takes nothing returns boolean
return IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) != true and IsUnitType(GetFilterUnit(), UNIT_TYPE_FOOT) == true and GetWidgetLife(GetFilterUnit()) > 0.405 and GetFilterUnit() != bj_ghoul[1]
endfunction
private function Uncreate takes nothing returns nothing
local timer T = GetExpiredTimer()
local dat dd = dat(GetHandleInt(T, "dd"))
local real PX = dd.OX + dd.rng * Cos(dd.ang)
local real PY = dd.OY + dd.rng * Sin(dd.ang)
set dd.rng = dd.rng - Speed
call RemoveUnit(dd.D[dd.i])
set dd.i = dd.i - 1
call SetUnitX(dd.p, PX)
call SetUnitY(dd.p, PY)
if dd.i == 0 then
call SetUnitPathing(dd.p, true)
call PauseUnit(dd.p, false)
set dd.p = null
set dd.u = null
call dd.destroy()
call FlushHandleLocals(T)
call PauseTimer(T)
call DestroyTimer(T)
endif
set T = null
endfunction
private function Create takes nothing returns nothing
local timer t = GetExpiredTimer()
local dat d = dat(GetHandleInt(t, "d"))
local real PX = d.OX + d.rng * Cos(d.ang)
local real PY = d.OY + d.rng * Sin(d.ang)
local real r = d.lvl * Max_Range_Increment + Range_Base_Value
local group g
local boolexpr b
local timer T
set d.rng = d.rng + Speed
if d.rng < r and d.rng < Max_Range and d.p == null then
set g = CreateGroup()
set bj_ghoul[1] = d.u
set b = Condition(function Cond)
call GroupEnumUnitsInRange(g, PX, PY, AoE, b)
set d.p = FirstOfGroup(g)
if d.p != null then
call UnitDamageTarget(d.u, d.p, d.lvl * Dmg_Base, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
call DestroyEffect(AddSpecialEffectTarget(Eyecandy, d.p, "origin"))
call SetUnitPathing(d.p, false)
call PauseUnit(d.p, true)
call SetUnitX(d.p, PX)
call SetUnitY(d.p, PY)
return
endif
set d.D[d.i] = CreateUnit(GetOwningPlayer(d.u), Hook_Part_ID, PX, PY, d.ang * bj_RADTODEG)
set d.i = d.i + 1
call DestroyGroup(g)
call DestroyBoolExpr(b)
set g = null
set b = null
else
set T = CreateTimer()
set d.rng = d.rng - Speed
call SetHandleInt(T, "dd", d)
call TimerStart(T, Timer_Interval, true, function Uncreate)
call FlushHandleLocals(t)
call PauseTimer(t)
call DestroyTimer(t)
set T = null
endif
set t = null
endfunction
private function Cast takes nothing returns nothing
local timer t = CreateTimer()
local location l = GetSpellTargetLoc()
local dat d = dat.create()
set d.u = GetTriggerUnit()
set d.ang = Atan2(GetLocationY(l)-GetUnitY(d.u), GetLocationX(l)-GetUnitX(d.u))
set d.lvl = GetUnitAbilityLevel(d.u, MH_ID)
set d.rng = Speed
set d.OX = GetUnitX(d.u)
set d.OY = GetUnitY(d.u)
set d.i = 1
call SetHandleInt(t, "d", d)
call TimerStart(t, Timer_Interval, true, function Create)
call RemoveLocation(l)
set t = null
set l = null
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == MH_ID
endfunction
function InitTrig_Meat_Hook takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, Condition( function Conditions ) )
call TriggerAddAction( t, function Cast )
set t = null
endfunction
endscope
2.
Code:
IsUnitType(GetFilterUnit(), UNIT_TYPE_WHAT_SHALL_STAND_HERE_IF_I_WANT_MOVEMENT_TYPE_FOOT?)
+rep for helpers!