• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[JASS] Sliding Code - Need Help on Turning

Status
Not open for further replies.
I hope you don't mind if I help you with this one? (Instead of hindy?)

I had this problem myself a long time ago, it took me a while, but I figured it out!

BTW Bjs = bad.
Damn! I need to leave, I'll fix up your code and help you when I get back. SOrry!
 
Oh I totally forgot about this. Well here's how you should make a very basic sliding system:
The trigger's name must be "Slide" (without the quotes)
JASS:
function Trig_Slide_Filter takes nothing returns boolean
    return true //This is basically your conditions (which type of unit can slide etc...)
endfunction
function Trig_Slide_Loop takes nothing returns nothing
    local unit u=GetEnumUnit() // Here we get the picked unit.
    local real r=GetUnitFacing(u)*bj_DEGTORAD // Storing the facing in a local.
    call SetUnitX(u,GetUnitX(u)+5*Cos(r)) // 5 is basically the speed. Change it to whatever you want.
    call SetUnitY(u,GetUnitY(u)+5*Sin(r)) // 5 is basically the speed. Must be the same speed as in the previous line.
    set u=null // Nulling to prevent leaks.
endfunction
function Trig_Slide_Actions takes nothing returns nothing
    local group g=CreateGroup()
    call GroupEnumUnitsInRect(g,bj_mapInitialPlayableArea,Filter(function Trig_Slide_Filter)) // We get all units in bj_mapInitialPlayableArea, which is the whole map. Change this rect to whatever rect you want, for sliding.
    call ForGroup(g,function Trig_Slide_Loop) // Looping through the units in the group.
    call DestroyGroup(g) // Removing the group to prevent leaks.
    set g=null // Nulling to prevent leaks.
endfunction
//===========================================================================
function InitTrig_Slide takes nothing returns nothing
    set gg_trg_Slide = CreateTrigger(  )
    call TriggerRegisterTimerEvent(gg_trg_Slide,0.03,true) // This is a periodic event (every 0.03 seconds)
    call TriggerAddAction( gg_trg_Slide, function Trig_Slide_Actions )
endfunction

Have fun!
 
Damn you beat me....


Will actually, he already has code. I'm going to modify his code with comments, though I'm sure yours works fine.
Have you tested that? Without canceling orders, units tend to go in circles (Using SetUnitX SetUnitY)

He just needs some help cleaning his code and making them turn.
Working on it presently!

Take a look, I hope you like it!
 

Attachments

Last edited:
Status
Not open for further replies.
Back
Top