• 🏆 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!

Moving a unit faster than 522

Status
Not open for further replies.
Level 15
Joined
Oct 29, 2007
Messages
101
Somebody help me please! I need to move a unit through map and keep it's animations playing. I need it to be able to make triggers that allow units to move much faster then it's possible by simply modifying it's movespeed. Somebody help please!
 
Level 15
Joined
Oct 29, 2007
Messages
101
yes. but it got to be a way to simulate movement. once a saw a map on wc3sear.ch in Spells section with type System. It used several triggers wich mooved units very fast. problem is that it worked only on straight line moovment and that map wasn't transferred to hiveworkshop.com after wc3sear.ch 's death.
 
Level 11
Joined
Aug 25, 2006
Messages
971
I've done it before, its kind of annoying though. For some reason, playing a units walk animation doesn't work. Instead you have to create a dummy structure with the same model, and order it to play the walk animation. Then you use SetUnitX and SetUnitY to move the unit around. Its rather complicated, I suggest you look for alternatives.
 
Level 7
Joined
Nov 13, 2006
Messages
243
hmmm i think i found something with jasscraft

JASS:
function UnitMoveToAsProjectile takes unit m, real arc, real x2, real y2, real z2 returns nothing
    call UnitMoveToAsProjectileGen(m, arc,x2,y2,null,z2)
endfunction

why not move the unit as a projectile which can have unlimited (or almost) speed.
 
Level 7
Joined
Nov 13, 2006
Messages
243
simple create a new trigger and then
Edit->Convert to custom text and now you can paste that there

but i found this
this function is better

JASS:
function UnitMoveToAsProjectileAnySpeed_Move takes gamecache H, unit m, string k returns boolean
 local boolean tounit = GetStoredBoolean(H,k,"unit")
 local unit tg
 local real x2
 local real y2
 local real z2
 local real x1=GetUnitX(m)
 local real y1=GetUnitY(m)
 local real z1=GetUnitFlyHeight(m)
 local real g
 local real d
 local real od
 local real v
 local real time
 local integer n
 local boolean done=false
    if tounit then
        set tg=UnitMoveToAsProjectileAnySpeed_Target(H,k,"tg")
        if (GetWidgetLife(tg)<=0.405) then
            set tounit=false
            call StoreBoolean(H,k,"unit",false)
        else
            set x2=GetUnitX(tg)
            set y2=GetUnitY(tg)
            set z2=GetUnitFlyHeight(tg)+GetStoredReal(H,k,"z2o")
            set n=GetStoredInteger(H,k,"N")
            set n=n+1
            if (n==0) then
                //I have the tilt writing on gamecache is slower than reading, in that case I prevent writting
                // these 3 reals, but use a counter so each second they are backuped.
                // They are needed because if the unit dies or is removed, they would otherwise go to the
                // center of the map, and that is not something nice.
                call StoreReal(H,k,"z2",z2)
                call StoreReal(H,k,"x2",x2) // Backup stuff just in case
                call StoreReal(H,k,"y2",y2)
            elseif (n==25) then
                set n=0
            endif
            call StoreInteger(H,k,"N",n)
        endif
        set tg=null
    endif
    if not(tounit) then
        set z2=GetStoredReal(H,k,"z2")
        set x2=GetStoredReal(H,k,"x2")
        set y2=GetStoredReal(H,k,"y2")
    endif

    set g=Atan2(y2-y1,x2-x1)
    call SetUnitFacing(m,g*bj_RADTODEG)
    set v=GetStoredReal(H,k,"speed")
    set d= v * CS_Cycle()
    
    set od=SquareRoot(Pow(x1-x2,2) +  Pow(y1-y2,2))
    if( od  <=d )then
        call CS_MoveUnit(m , x2, y2 )
        set done=true
    else
        call CS_MoveUnit(m , x1+d*Cos(g), y1+d*Sin(g) )
    endif
    set g=GetStoredReal(H,k,"acel")
    set time= od / v
    set v=(z2-z1+0.5*g*time*time)/time //z speed
    call SetUnitFlyHeight(m,z1+v*CS_Cycle(),0)
    set d=( Pow(GetUnitX(m)-x2,2) + Pow(GetUnitY(m)-y2,2) )
    if (done or (d<=400)) then //So the actual distance is less than or equal to 20
        set done=true
        call StoreBoolean(H,k,"done",true)
    endif
 return done
endfunction

after you paste it just replace the first function settings with what you want: arc,speed etc.

when you done then just create another trigger

  • Events -
    • Map Initialization
  • Conditions -
  • Actions -
    • Custom Script - call UnitMoveToAsProjectileAnySpeed_Move()
you can use what event and conditions you want and voila you are done
 
Level 11
Joined
Aug 25, 2006
Messages
971
simple create a new trigger and then
Edit->Convert to custom text and now you can paste that there

but i found this
this function is better

JASS:
function UnitMoveToAsProjectileAnySpeed_Move takes gamecache H, unit m, string k returns boolean
 local boolean tounit = GetStoredBoolean(H,k,"unit")
 local unit tg
 local real x2
 local real y2
 local real z2
 local real x1=GetUnitX(m)
 local real y1=GetUnitY(m)
 local real z1=GetUnitFlyHeight(m)
 local real g
 local real d
 local real od
 local real v
 local real time
 local integer n
 local boolean done=false
    if tounit then
        set tg=UnitMoveToAsProjectileAnySpeed_Target(H,k,"tg")
        if (GetWidgetLife(tg)<=0.405) then
            set tounit=false
            call StoreBoolean(H,k,"unit",false)
        else
            set x2=GetUnitX(tg)
            set y2=GetUnitY(tg)
            set z2=GetUnitFlyHeight(tg)+GetStoredReal(H,k,"z2o")
            set n=GetStoredInteger(H,k,"N")
            set n=n+1
            if (n==0) then
                //I have the tilt writing on gamecache is slower than reading, in that case I prevent writting
                // these 3 reals, but use a counter so each second they are backuped.
                // They are needed because if the unit dies or is removed, they would otherwise go to the
                // center of the map, and that is not something nice.
                call StoreReal(H,k,"z2",z2)
                call StoreReal(H,k,"x2",x2) // Backup stuff just in case
                call StoreReal(H,k,"y2",y2)
            elseif (n==25) then
                set n=0
            endif
            call StoreInteger(H,k,"N",n)
        endif
        set tg=null
    endif
    if not(tounit) then
        set z2=GetStoredReal(H,k,"z2")
        set x2=GetStoredReal(H,k,"x2")
        set y2=GetStoredReal(H,k,"y2")
    endif

    set g=Atan2(y2-y1,x2-x1)
    call SetUnitFacing(m,g*bj_RADTODEG)
    set v=GetStoredReal(H,k,"speed")
    set d= v * CS_Cycle()
    
    set od=SquareRoot(Pow(x1-x2,2) +  Pow(y1-y2,2))
    if( od  <=d )then
        call CS_MoveUnit(m , x2, y2 )
        set done=true
    else
        call CS_MoveUnit(m , x1+d*Cos(g), y1+d*Sin(g) )
    endif
    set g=GetStoredReal(H,k,"acel")
    set time= od / v
    set v=(z2-z1+0.5*g*time*time)/time //z speed
    call SetUnitFlyHeight(m,z1+v*CS_Cycle(),0)
    set d=( Pow(GetUnitX(m)-x2,2) + Pow(GetUnitY(m)-y2,2) )
    if (done or (d<=400)) then //So the actual distance is less than or equal to 20
        set done=true
        call StoreBoolean(H,k,"done",true)
    endif
 return done
endfunction

after you paste it just replace the first function settings with what you want: arc,speed etc.

when you done then just create another trigger

  • Events -
    • Map Initialization
  • Conditions -
  • Actions -
    • Custom Script - call UnitMoveToAsProjectileAnySpeed_Move()
you can use what event and conditions you want and voila you are done
I'm sorry, this isn't a solution to his problem at all. You said you found it with JassCraft, therein lies the problem. Jasscraft doesn't just list natives, it also lists functions of Vexorian's Caster System. So if you try to use that in-game without the caster system, it won't work.
Caster System:
http://www.wc3campaigns.net/showthread.php?t=80534
Open it up, look through the documentation. You should find the function your looking for (fully documented)
 
Level 7
Joined
Nov 13, 2006
Messages
243
I'm sorry, this isn't a solution to his problem at all. You said you found it with JassCraft, therein lies the problem. Jasscraft doesn't just list natives, it also lists functions of Vexorian's Caster System. So if you try to use that in-game without the caster system, it won't work.
Caster System:
http://www.wc3campaigns.net/showthread.php?t=80534
Open it up, look through the documentation. You should find the function your looking for (fully documented)

me be noob in jass :)
 
Status
Not open for further replies.
Top