• 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.

[JASS] Sliding Code - Need Help on Turning

Status
Not open for further replies.
Level 11
Joined
Aug 25, 2006
Messages
971
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!
 
Level 20
Joined
Apr 22, 2007
Messages
1,960
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!
 
Level 11
Joined
Aug 25, 2006
Messages
971
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

  • Ice Arena.w3x
    40.2 KB · Views: 42
Last edited:
Status
Not open for further replies.
Top