Tutorial Sliding on Ice

Komaqtion

You can change this now in User CP.
Reaction score
469
Sliding on Ice


Ok, so I wrote this for someone on the forum, but it became so long, that I thought I'd post it here XD

Ok, well first open op you Trigger Editor :D

Variables

Unit-Group

Then we're gonna make the variables as a first step...
So press Ctrl + B and a small window will pop up.
Now press Ctrl + N and another smaller window will pop up.
Now we're creating a variable, so first type in the name of it... It's easier if you write exactly what I wrote, Temp_Group.
Then, in the drop down below the name, select Unit-Group and click ok, and you've created a Unit-Group variable ;)

Point

Now press Ctrl + N again and instead type TempPoint and in the drop down select Point.
Then do the same again, but type TempPoint2 instead as the name, and select Point again :D

So now we're done with the variables, and gonna start with the trigger.
So first create a new trigger (Ctrl + T), and name it something... Mine is named "Slide on Ice" ;)

Event

Then Ctrl + E to create an event for this, and select the event, Time - Periodic Event.
Then change the blue word to 0.03 and click ok.

It should look like this now:
Trigger:
  • Slide on Ice
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions


Actions

Setting up

Now we've gotten to the actions :D

So press Ctrl + R to create a new action, and in the drop down select "Set Variable".

Here change the red word "Variable" to your newly created Unit-Group variable, Temp_Group.
Then change the (now) red word "Value" to "Units In Region Matching Condition".


Now click the red "Condition", and the there should be a drop down saying Boolean Comparison...
Click the first blue part "(Triggering unit) is A structure", and change (Triggering unit) to (Matching unit).
Click "Ok", and now change "True" to "False", and click "Ok" till you get back to the Trigger Editor.
Now it should look like this:

Trigger:
  • Slide on Ice
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Group = (Units in (Playable map area) matching (((Matching unit) is A structure) Equal to False))


Unit-Group

Now we're going to make a Unit-Group loop from this unit group which was just set.
So create a new action, and select:

Unit Group - Pick Every Unit In Unit Group And Do Multiple Actions

Now change the blue part here, to your newly created Unit Group variable, Temp_Group.
Click "Ok", and now Right-Click this:
Code:
Unit Group - Pick every unit in Temp_Group and do (Actions)
    [COLOR="Red"]Loop - Actions[/COLOR]

And select "New Action" and select "Set Variable"... Now we're going to set the "TempPoint" variable. So select that one where it says "Variable" (in red).

Now click the drop down menu, and select "Position of Unit", and change the blue "Triggering unit" to "Picked unit".
Click "Ok", and now we need to check if the unit we picked is actually on ice, so we're going to use the action called:
"If / Then / Else, Multiple Functions"

If / Then / Else

Click "Ok" and now Right-Click where it says "If - Conditions":

Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    [COLOR="Red"]If - Conditions[/COLOR]
    Then - Actions
    Else - Actions

Now select the condition, "Or - Multiple Conditions"... This is only needed if you want units to be able to slide on different kinds of terrain.
Now Right-Click where it says "Conditions" and create a new condition and change it to (In the drop down menu) Terrain-Type comparison.

It should look something like this.
(Terrain-type at (Center of (Playable map area))) Equal to Lordaeron Summer - Dirt

Here you should change (Center of (Playable map area)) to the newly set variable, TempPoint, and also Lordaeron Summer - Dirt to Icecrown Glacier - Ice.
Now do the same again, (If you want multiple terrain-types) but just change the "Lordaeron Summer - Dirt" to something else, like maybe Icecrown Glacier - Dark Ice.
If you don't want multiple terrain-types, just skip the "Or" condition and just create the condition itself ;)


Now you should Right-Click where it says "Then - Actions" create another one of the "Set Variable" action.
Here, you're going to set TempPoint2 as the (In red) "Variable", and the (Now also red) "Value" to the thing called "Point With Polar Offset".

Now change (Center of (Playable map area)) to TempPoint, and change 256.00 to 10.
Now click the 0.00, and beside where it says "Function", click the drop down menu.
Go down to Unit - Facing Angle, and change this to Facing of (Picked unit)
Click ok till you come back to the Trigger Editor.

Now it should look like this:
Trigger:
  • Slide on Ice
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Group = (Units in (Playable map area) matching (((Matching unit) is A structure) Equal to False))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Set TempPoint = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Terrain type at TempPoint) Equal to Icecrown Glacier - Ice
                  • (Terrain type at TempPoint) Equal to Icecrown Glacier - Dark Ice
            • Then - Actions
              • Set TempPoint2 = (TempPoint offset by 10.00 towards (Facing of (Picked unit)) degrees)



Hope it does for you :D

Custom Script

Now it's only 5 actions left, and all of them are called "Custom Script", and here you just write with your keyboard, so as long as you copy what I've written, you should be fine:D

So create a new action, and in the drop down, select Custom Script.
Now click the red ""Script Code" and copy this:

call SetUnitX(GetEnumUnit(),GetLocationX(udg_TempPoint2))

then create another one of this action, and copy this:

call SetUnitY(GetEnumUnit(),GetLocationY(udg_TempPoint2))


Leak Cleaning


call RemoveLocation(udg_TempPoint2)

And then you should Right-Click this line:

Code:
[COLOR="Red"]If (All Conditions are True) then do (Then Actions) else do (Else Actions)[/COLOR]
    If - Conditions
        Or - Any (Conditions) are true
            Conditions
                (Terrain type at TempPoint) Equal to Icecrown Glacier - Ice
                (Terrain type at TempPoint) Equal to Icecrown Glacier - Dark Ice
    Then - Actions
        Set TempPoint2 = (TempPoint offset by 10.00 towards (Facing of (Picked unit)) degrees)
        Custom script:   call SetUnitX(GetEnumUnit(),GetLocationX(udg_TempPoint2))
        Custom script:   call SetUnitY(GetEnumUnit(),GetLocationY(udg_TempPoint2))
        Custom script:   call RemoveLocation(udg_TempPoint2)
    Else - Actions

And then create this Custom Script:

call RemoveLocation(udg_TempPoint)

(This was because we needed this line to end up below then "If / Then / Else" action :D)

Now you're going to Right-Click this:

Code:
[COLOR="Red"]Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)[/COLOR]
    Loop - Actions

And create another "Custom Script" action, and copy this:

call DestroyGroup(udg_Temp_Group)

And now it should look like this:

Trigger:
  • Slide on Ice
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Group = (Units in (Playable map area) matching (((Matching unit) is A structure) Equal to False))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Set TempPoint = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Terrain type at TempPoint) Equal to Icecrown Glacier - Ice
                  • (Terrain type at TempPoint) Equal to Icecrown Glacier - Dark Ice
            • Then - Actions
              • Set TempPoint2 = (TempPoint offset by 10.00 towards (Facing of (Picked unit)) degrees)
              • Custom script: call SetUnitX(GetEnumUnit(),GetLocationX(udg_TempPoint2))
              • Custom script: call SetUnitY(GetEnumUnit(),GetLocationY(udg_TempPoint2))
              • Custom script: call RemoveLocation(udg_TempPoint2)
            • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call DestroyGroup(udg_Temp_Group)


And you're done :D

Now you just need to put the terrain, Icecrown Glacier - Ice (Or if you used the "Or" condition, any of those terrains) somewhere on the map, and the units should slide ;)

Good luck :D
 

Attachments

  • Slide on Ice, by Komaqtion!.w3x
    14.3 KB · Views: 252

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
Set Temp_Group = (Units in (Playable map area) matching ((Terrain type at (Position of (Matching unit))) Equal to Icecrown Glacier - Ice))

that point leaks, also every 0.01s -> many point leak :rolleyes:, about 100 times number of units in map I guess :eek:

also I think 0.04 is good enough ;)
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Points in conditions don't leak, do they ??? :S

And since it's GUI, it's only 0.27 still right ??? :S
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
TriggerSleepAction is 0.27 second, but this is TriggerRegisterTimerEvent(..), like timer..

Using Jass will more easy to manipulate it...
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Oh, yeah sorry... Mixed them up XD

Changed to 0.03..

And I didn't do this in JASS, because JASS is just copy-paste, so then this would be a system in that case almost, right :p
 

Dinowc

don't expect anything, prepare for everything
Reaction score
223
you should also enable steering
it's easy

I already made that for someone long time ago

here I've found it

since it is in GUI, it's not perfect but :p (uses custom value)
 

Azlier

Old World Ghost
Reaction score
461
>What do you mean "steering" ??

While the unit is sliding, you tell him to move somewhere. He turns to face that direction.

>Points in conditions don't leak, do they ??? :S

They do. Which means this leaks insanely.

>Changed to 0.03..

...Where? I still see 0.01.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
You can change direction... Just Right-Click, and you change direction :D

Oh, haven't uploaded the new yet XD Sorry :( Will change the leak too then :D
 

D.V.D

Make a wish
Reaction score
73
There already is a tutorial made for sliding units in GUI and there already is a system for it too so this is basically just a repeat.
 

Romek

Super Moderator
Reaction score
964
You're not explaining anything that you're doing; only describing it.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top