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
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
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
- Events
Actions
Setting up
Now we've gotten to the actions
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))
- Events
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
- Conditions
- Or - Any (Conditions) are true
- Then - Actions
- Set TempPoint2 = (TempPoint offset by 10.00 towards (Facing of (Picked unit)) degrees)
- If - Conditions
- Loop - Actions
- Events
Hope it does for you
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
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 )
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
- Conditions
- Or - Any (Conditions) are true
- 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
- If - Conditions
- Custom script: call RemoveLocation(udg_TempPoint)
- Loop - Actions
- Custom script: call DestroyGroup(udg_Temp_Group)
- Events
And you're done
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