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