Tutorial Ice Sliding

elmstfreddie

The Finglonger
Reaction score
203
I was looking for tutorials on ice sliding, but there was no new ones (and I was lazy to keep going), so I found out a great way on my own and decided to share it with all.

I'm aware I have ice sliding in my maze tutorial, but that was ugly sliding. I have made really smooth sliding that you have complete control on. For starters, here's the trigger, I'll explain after.
Code:
Sliding
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in AllUnits 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
                        (Terrain type at temppoint) Equal to Northrend - Rock
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level 03 Speeder <gen> contains (Picked unit)) Equal to True
                            Then - Actions
                                Custom script:   call RemoveLocation(udg_temppoint)
                                Set temppoint = (Position of (Picked unit))
                                Set temppoint2 = (temppoint offset by 8.00 towards (Facing of (Picked unit)) degrees)
                                Set temppoint3[(Player number of (Owner of (Picked unit)))] = (temppoint3[(Player number of (Owner of (Picked unit)))] offset by 500.00 towards (Angle from temppoint to temppoint3[(Player number of (Owner of (Picked unit)))]) degrees)
                                Unit - Move (Picked unit) instantly to temppoint2
                                Unit - Add Sliding (turning) to (Picked unit)
                                Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave temppoint3[(Player number of (Owner of (Picked unit)))]
                                Unit - Remove Sliding (turning) from (Picked unit)
                                Custom script:   call RemoveLocation(udg_temppoint)
                                Custom script:   call RemoveLocation(udg_temppoint2)
                                Custom script:   call RemoveLocation(udg_temppoint4[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))])
                            Else - Actions
                                Custom script:   call RemoveLocation(udg_temppoint)
                                Set temppoint = (Position of (Picked unit))
                                Set temppoint2 = (temppoint offset by 3.00 towards (Facing of (Picked unit)) degrees)
                                Set temppoint4[(Player number of (Owner of (Picked unit)))] = (temppoint3[(Player number of (Owner of (Picked unit)))] offset by 500.00 towards (Angle from temppoint to temppoint3[(Player number of (Owner of (Picked unit)))]) degrees)
                                Unit - Move (Picked unit) instantly to temppoint2
                                Unit - Add Sliding (turning) to (Picked unit)
                                Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave temppoint4[(Player number of (Owner of (Picked unit)))]
                                Unit - Remove Sliding (turning) from (Picked unit)
                                Custom script:   call RemoveLocation(udg_temppoint)
                                Custom script:   call RemoveLocation(udg_temppoint2)
                                Custom script:   call RemoveLocation(udg_temppoint4[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))])
                    Else - Actions
                        Do nothing
In this trigger: 4 variables, 1 ability
temppoint (point-type variable)
temppoint2 (point-type variable)
temppoint3 (point-type variable with an array of the amount of players)
AllUnits (a unit group-type variable containing all the player's units)
Sliding (turning) is a Shockwave based ability, with no stats except for 999999 casting range.

Now for the explanation:
The first If/Then/Else's, are all checking that terrain type at the units in AllUnits is ice, and that they're not in a speeder region (a region that if you are in you go a lot faster, very useful :))

A few variable setting so that we don't have memory leaks (necessary since the event is 0.01 seconds!)

Moves the unit instantly to an offset so that it slides

The next line here is the turning actions, so that you have control on the ice (normally you wouldn't be able to control since the game stops you every time you're moved instantly). Adds the shockwave ability, makes the unit use it, then removes it so you don't have to look at it.

Ok, people with sharp eyes will notice that temppoint3 won't allow them to turn! People who don't... Well, here's the next trigger that makes the ice controllable on.
Code:
Sliding Turning
    Events
        Unit - A unit Is issued an order targeting a point
    Conditions
        And - All (Conditions) are true
            Conditions
                (Owner of (Triggering unit)) Not equal to Player 12 (Brown)
                (Owner of (Triggering unit)) Not equal to Player 11 (Dark Green)
    Actions
        Custom script:   call RemoveLocation(udg_temppoint3[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
        Set temppoint3[(Player number of (Owner of (Triggering unit)))] = (Target point of issued order)
Ok, so everytime a unit is issued an order to somewhere (like movement), it removes the old temppoint3, and sets a new one. The reason for my condition is so the computers don't get their own temppoints, but not really necessary. Thus completing two triggers which will have REALLY smooth sliding, with the ability to turn on the ice.
 

LoveTD's

New Member
Reaction score
34
I didn't really read annything of it but good job +rep, I always give rep if some one makes an tutorial it's kinda a nice thing... :p I have an ice sliding trigger already but it's always nice to see people doing hard work for you so here's a +rep....
 
M

Mythic Fr0st

Guest
Wow, this is huge, and it shouldn't be lol

You need to tidy up your code quite a bit,

it leaks aswell...
Code:
Set temppoint = (Position of (Picked unit))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Terrain type at temppoint) Equal to Northrend - Rock
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level 03 Speeder <gen> contains (Picked unit)) Equal to True
                            Then - Actions
                                Set temppoint = (Position of (Picked unit))

It leaks twice, as it gets set, and also every 0.03 seconds is better than 0.01

Code:
Sliding Turning
    Events
        Unit - A unit Is issued an order targeting a point
    Conditions
        And - All (Conditions) are true
            Conditions
                (Owner of (Triggering unit)) Not equal to Player 12 (Brown)
                (Owner of (Triggering unit)) Not equal to Player 11 (Dark Green)
    Actions
        Custom script:   call RemoveLocation(udg_temppoint3[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
        Set temppoint3[(Player number of (Owner of (Triggering unit)))] = (Target point of issued order)

Target point of issued order does not leak, just add
- Make triggering unit face target point of issued order
 

elmstfreddie

The Finglonger
Reaction score
203
How does that leak... It doesn't because it removes them both.

Or should I remove the old temppoint before it sets it again inside the loop?
 
M

Mythic Fr0st

Guest
Actually, No it doesnt, it gets set again, before it can remove itself
Or should I remove the old temppoint before it sets it again inside the loop?

No, I recommend using a new variable
Below is the error
Code:
Sliding
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in AllUnits and do (Actions)
            Loop - Actions
                [COLOR="Red"]Set temppoint = (Position of (Picked unit))[/COLOR]
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Terrain type at temppoint) Equal to Northrend - Rock
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level 03 Speeder <gen> contains (Picked unit)) Equal to True
                            Then - Actions
                                [COLOR="Red"]Set temppoint = (Position of (Picked unit))[/COLOR]
                                [B]Set temppoint2 = (temppoint offset by 8.00 towards (Facing of (Picked unit)) degrees)
                                Set temppoint3[(Player number of (Owner of (Picked unit)))] = (temppoint3[(Player number of (Owner of (Picked unit)))] offset by 500.00 towards (Angle from temppoint to temppoint3[(Player number of (Owner of (Picked unit)))]) degrees)
                                Unit - Move (Picked unit) instantly to temppoint2
                                Unit - Add Sliding (turning) to (Picked unit)
                                Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave temppoint3[(Player number of (Owner of (Picked unit)))]
                                Unit - Remove Sliding (turning) from (Picked unit)
                                Custom script:   call RemoveLocation(udg_temppoint)
                                Custom script:   call RemoveLocation(udg_temppoint2)
                                Custom script:   call RemoveLocation(udg_temppoint3[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))])
                            Else - Actions
                                Set temppoint = (Position of (Picked unit))
                                Set temppoint2 = (temppoint offset by 3.00 towards (Facing of (Picked unit)) degrees)
                                Set temppoint3[(Player number of (Owner of (Picked unit)))] = (temppoint3[(Player number of (Owner of (Picked unit)))] offset by 500.00 towards (Angle from temppoint to temppoint3[(Player number of (Owner of (Picked unit)))]) degrees)
                                Unit - Move (Picked unit) instantly to temppoint2
                                Unit - Add Sliding (turning) to (Picked unit)
                                Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave temppoint3[(Player number of (Owner of (Picked unit)))]
                                Unit - Remove Sliding (turning) from (Picked unit)
                                Custom script:   call RemoveLocation(udg_temppoint)
                                Custom script:   call RemoveLocation(udg_temppoint2)
                                Custom script:   call RemoveLocation(udg_temppoint3[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))])[/B]
                    Else - Actions
                        Do nothing
[I]                Custom script:   call RemoveLocation(udg_temppoint)[/I]

The first temp point is set, then it gets set again (leaking, as the other was not removed first)
Then the code in Bold is done
then the part in italic is done last

>>What it could be
Honestly I am against all unit group slides, but this is more efficient
(I prefer Integer A/B Statements)
Variables,
Loc, point, array 1
Speed, integer, array 1
P_N, integer, array 1
Code:
Sliding
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in AllUnits and do (Actions)
            Loop - Actions
                Set Loc[0] = position of picked unit
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Terrain type at Loc[0] Equal to Northrend - Rock
                    Then - Actions
                        Set P_N[0] = Player number of owner of picked unit
                        Set Loc[1] = Loc[0] offset by Speed[P_N] towards facing of picked unit
                        Unit - Move instantly picked unit to Loc[1]
                        Custom script:   call RemoveLocation(udg_Loc[1])
                Custom script:   call RemoveLocation(udg_Loc[0])

Code:
    Events
        Unit - A unit enters Speeder <gen>
    Conditions
    Actions
        Set P_N = Player number of owner of triggering unit
        Set Speed[P_N] = 8
Code:
    Events
        Unit - A unit leaves Speeder <gen>
    Conditions
    Actions
        Set P_N = Player number of owner of triggering unit
        Set Speed[P_N] = 3

that would work better for speeders and its more easy on the eyes
 

elmstfreddie

The Finglonger
Reaction score
203
Yeaaah, that's what I thought when I thought for more than 1 second... Thanks for catching onto that (I always seem to miss SOMETHING don't I?)

Wait a minute, are you ALWAYS on when I post something (I posted this a few minutes ago lol)
 
M

Mythic Fr0st

Guest
I am on when ANYBODY posts ANYTHING lol...

I monitor TH all the time, while I write my ORPG
 

Turnip

New Member
Reaction score
18
Could you put it in a map for us to download? It would really be helpful to some one who needs the editor to learn.
 

elmstfreddie

The Finglonger
Reaction score
203
Oh right, I really should attatch a map... Well currently I took the triggers from my maze game, so I can't attatch that xD

K I will make a map to attatch in a sec (I gotta fix a boo boo I found lol)
 

Demi666

New Member
Reaction score
127
again long slide trigger.. i used this in my escape and it worked well and is very short no leaks or anything


Code:
RedSkate
    Events
        Time - Every 0.03 seconds of game time
    Conditions
        (Terrain type at (Position of RedHeroV)) Equal to Northrend - Ice
        (Player 1 (Red) controller) Equal to User
        (Player 1 (Red) slot status) Equal to Is playing
    Actions
        Unit - Move RedHeroV instantly to ((Position of RedHeroV) offset by 13.00 towards (Facing of RedHeroV) degrees)
that is main code to make slide this 1 is for movement


Code:
CombatGuySkateMove
    Events
        Unit - Combat Guy 0006 <gen> Is issued an order targeting a point
    Conditions
    Actions
        Unit - Move (Triggering unit) instantly to (Position of (Triggering unit)), facing (Target point of issued order)
        Unit - Make (Triggering unit) face (Target point of issued order) over 0.00 seconds
it works with pickes unit to btw if any is gonna rep me do MINUS REP so it goes red...
 
M

Mythic Fr0st

Guest
Jeeze, will people stop saying there codes DONT leak, as, the more i've seen people claim this, they leak anyway, and make real noobs think they dont...

Demi666, no offence, but its very inefficient way to do an ice slide, it leaks ALOT, and it requires alot of triggers

Leaks for ice slide, is 3 every 0.03 seconds
And, your turn leaks once...

Read a memory leak tutorial for more info
 

elmstfreddie

The Finglonger
Reaction score
203
LOL, but mine doesn't right?

And the reason it's huge is because I prefer to see everything, not like have pick every unit matching condition blah blah blah... I prefer to use If/Then/Elses so I can see it all and easily tweak things. I fully agree my triggers could be shrunken though :p
 

Oninuva

You can change this now in User CP.
Reaction score
221
Well I like mine:

Code:
Slideonice
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        Custom script:   local location udg_Slide_loc
        Set SlideGroup = (Units in (Playable map area) matching (((Matching unit) is A structure) Equal to False))
        Unit Group - Pick every unit in SlideGroup and do (Actions)
            Loop - Actions
                Set Slide_loc[1] = (Position of (Picked unit))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Terrain type at (Position of (Picked unit))) Equal to Icecrown Glacier - Ice
                    Then - Actions
                        Set Slide_loc[2] = (Slide_loc[1] offset by 10.00 towards (Facing of (Picked unit)) degrees)
                        Set Slide_loc[3] = Slide_loc[2]
                        Unit - Move (Picked unit) instantly to Slide_loc[3]
                    Else - Actions
        Custom script:   call DestroyGroup(udg_SlideGroup)

Code:
TurnonIce
    Events
        Unit - A unit Is issued an order targeting a point
    Conditions
        (Terrain type at (Position of (Triggering unit))) Equal to Icecrown Glacier - Ice
    Actions
        Set SlidePoint = (Target point of issued order)
        Unit - Make (Triggering unit) face SlidePoint over 0.00 seconds
        Custom script:   call RemoveLocation(udg_SlidePoint)

I don't think it has leaks... Not any major ones atleast. (Didn't care to look)

Btw, Why is your tutorial trigger so long. Shouldn't that be in Free Trigger Zone?
 

elmstfreddie

The Finglonger
Reaction score
203
Uhhh... Not really. It teaches. But if it should be in the free tutorial zone then so be it!

Some moderator move this if need be.
 

Tonks

New Member
Reaction score
160
This isn't a full-fledged tutorial, it's just a trigger. And a poorly coded one, at that.
You said that when you were searching, you could find no "new" sliding trigger tutorials. Why do they need to be new? Is there something wrong with the numerous older ones?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top