• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Leap-Jump, whatever you call it.

Status
Not open for further replies.
Level 3
Joined
Nov 23, 2005
Messages
32
EDIT: After some search, i've finally found it, but it's in JASS.
Anyone know how to implement a JASS into a map and make it work as a spell?
I've read the Jass Tutorial and i know what it is.
Convert trigger in WC3 Scripting Language.
The thing is, I still don't know how to implement it into the map, and to locate it in the spell editor to place it on the hero.
Any help will be greatly appreciated.


The code is

function JumpDamage takes nothing returns nothing
local unit u = GetHandleUnit(null,"jumpunit")
call SetHandleInteger(null,"jumpunit",0)
call SetUnitAnimation(u,"death")
call UnitDamageTargetBJ(u,u,120.0,ATTACK_TYPE_MELEE,DAMAGE_TYPE_NORMAL)
call UnitAddAbility(u,'A05S')
call ShiftMoveSpeed(u,-80.0)
call TriggerSleepAction(0)
call ResetUnitAnimation(u)
call PolledWait(2.5)
call ShiftMoveSpeed(u,30.0)
call PolledWait(2.5)
call UnitRemoveAbility(u,'A05S')
call ShiftMoveSpeed(u,50.0)
set u = null
endfunction

function InsideTower takes unit u returns boolean
local real x = GetUnitX(u)
local real y = GetUnitY(u)
return RectContainsCoords(gg_rct_Tower1,x,y) or RectContainsCoords(gg_rct_Tower2,x,y) or RectContainsCoords(gg_rct_Tower3,x,y) or RectContainsCoords(gg_rct_Tower4,x,y) or RectContainsCoords(gg_rct_Tower5,x,y) or RectContainsCoords(gg_rct_Tower6,x,y)
endfunction

function hiphop_callback_inner takes timer t returns nothing
local integer i = GetHandleInteger(t,"i")
local integer momentum = GetHandleInteger(t,"momentum")
local real x0 = GetHandleReal(t,"x0")
local real y0 = GetHandleReal(t,"y0")
local real x1 = GetHandleReal(t,"x1")
local real y1 = GetHandleReal(t,"y1")
local integer maxiter = R2I(SquareRoot((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0))/20)
local real s = i/(maxiter + 0.001)
local unit u = GetHandleUnit(t,"u")
if t==null then
call BJDebugMsg("Bunny hop timer in hell")
elseif u==null then
call FlushHandleLocals(t)
call DestroyTimer(t)
elseif i>maxiter then
call FlushHandleLocals(t)
call DestroyTimer(t)
call SetUnitFlyHeight(u,0.0,1000.0)
call SetUnitPathing(u,true)
if momentum==1 then
call UnitRemoveAbility(u,'A07O') //Footsteps animation
call UnitRemoveAbility(u,'A05O') //Jump failsafe
endif
if GetTerrainCliffLevel(x0,y0)-GetTerrainCliffLevel(x1,y1)>1 or GetUnitAbilityLevel(u,'Bslo')>0 or InsideTower(u) then
call SetHandleHandle(null,"jumpunit",u)
call ExecuteFunc("JumpDamage")
endif
else
call PauseUnit(u,true)
call SetUnitX(u,(1.0-s)*x0 + s*x1)
call SetUnitY(u,(1.0-s)*y0 + s*y1)
call PauseUnit(u,false)
call SetHandleInteger(t,"i",i+1)
endif
set u = null
endfunction

function hiphop_callback takes nothing returns nothing
call hiphop_callback_inner(GetExpiredTimer())
endfunction

function hippityhoppity takes unit u, real x0, real y0, real x1, real y1, integer momentum returns nothing
local integer t = H2I(CreateTimer())
local integer current = udg_Second
if current-udg_JumpLimit!=0 then
call AttachSoundToUnit(gg_snd_Jump,u)
call SetSoundVolume(gg_snd_Jump,127)
call StartSound(gg_snd_Jump)
else
set udg_JumpLimit=current
endif
call UnitAddAbility(u,'A05O')
call UnitRemoveAbility(u,'A05O')
call SetUnitPathing(u,false)
call SetUnitFlyHeight(u,45.0,500.0)
call SetHandleHandle(I2T(t),"u",u)
call SetHandleReal(I2T(t),"x0",x0)
call SetHandleReal(I2T(t),"y0",y0)
call SetHandleReal(I2T(t),"x1",x1)
call SetHandleReal(I2T(t),"y1",y1)
call SetHandleInteger(I2T(t),"momentum",momentum)
call SetHandleInteger(I2T(t),"i",1)
call TimerStart(I2T(t),0.03,true,function hiphop_callback)
endfunction

function Jump takes nothing returns nothing
local unit u = GetTriggerUnit()
local location l = GetSpellTargetLoc()
local real x0
local real y0
local real x1 = GetLocationX(l)
local real y1 = GetLocationY(l)
local real dx
local real dy
local real xm = GetUnitX(u)
local real ym = GetUnitY(u)
local real distance
local real maxjump = 270.0
local integer currentlevel
local integer momentum = 0
call PolledWait(0.3)
set x0 = GetUnitX(u)
set y0 = GetUnitY(u)
set currentlevel = GetTerrainCliffLevel(x0,y0)
if SquareRoot(((xm-x0)*(xm-x0)+(ym-y0)*(ym-y0))+0.01)>25.0 then //achieved momentum
set momentum = 1
set maxjump=maxjump+65.0
endif
set dx = x0-x1
set dy = y0-y1
set distance = SquareRoot(((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1))+0.01)
if currentlevel==GetTerrainCliffLevel(x1,y1) then
set maxjump=maxjump-50.0
endif
if GetSpellAbilityId()=='A05N' then //pet jump bonus
set maxjump=maxjump+100.0
endif
if distance>maxjump then
set x1 = x0 - dx*maxjump/distance
set y1 = y0 - dy*maxjump/distance
endif
if currentlevel<GetTerrainCliffLevel>GetRectMaxX(bj_mapInitialPlayableArea) or x1<GetRectMinX>GetRectMaxY(bj_mapInitialPlayableArea) or y1<GetRectMinY(bj_mapInitialPlayableArea)) then //target point is too high or out of map
call IssueImmediateOrder(u,"holdposition")
else
if momentum==1 then
call UnitAddAbility(u,'A07O') //Footsteps animation
endif
call hippityhoppity(u,x0,y0,x1,y1,momentum)
endif
call RemoveLocation(l)
set l = null
set u = null
endfunction

function JumpConditions takes nothing returns boolean
local integer i = GetSpellAbilityId()
return (i=='A05P' or i=='A05N' or i=='A05X' or i=='A07X') and GetUnitAbilityLevel(GetTriggerUnit(),'B001')<1 and GetUnitAbilityLevel(GetTriggerUnit(),'Beng')<1 //no suppressive fire and nanosteel net
endfunction

function InitTrig_Jump takes nothing returns nothing
set gg_trg_Jump = CreateTrigger()
call TriggerAddCondition(gg_trg_Jump,Condition(function JumpConditions))
call TriggerAddAction(gg_trg_Jump,function Jump)
endfunction
 
Last edited:
Level 3
Joined
May 28, 2007
Messages
57
First of all do you have the handel Variables in your map second you need a Global variable called JumpLimit what checks to see if the unit has the ability is the JumpConditions which is checking to see if the unit has any of those 4 abilities and if it has the buff 'B001'
also to start the trigger you are missing call
TriggerRegisterAnyUnitEventBJ( gg_trg_Jump, EVENT_PLAYER_UNIT_SPELL_EFFECT ) put that after the set gg_trg_Jump = CreateTrigger().
 
Status
Not open for further replies.
Top