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.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top