Name | Type | is_array | initial_value |
Continues | real | No | 3.00 |
CurrentCheckpoint | location | No | |
Discription | string | Yes | |
H | group | No | |
Hero_Count | real | No | 10.00 |
Items | itemcode | Yes | |
Playing_Players | real | No | 10.00 |
Prowler1 | group | No | |
skill | abilcode | Yes | |
skills | abilcode | Yes | |
Slide | integer | No | |
Speed | real | No | |
TerrainKill | integer | No | |
Timer | timer | Yes | |
TimerWindow | timerdialog | Yes |
3ICE: Hello!
You: Hi, what do I do with this?
3ICE: First of all, you should press CTRL+F9 to test this map and see if it suits your needs.
3ICE: If it does, then use(import) it:
You should have two maps open: This and Your own map.
In the MAIN window of the World editor, navigate to: File ==> Preferences... ==> General
Find "Automatically create unknown variables while pasting trigger data"
It is not checked by default, but you might have already enabled it previously. Check it now.
(It creates all the variables my system will use (Slide, TerrainKill, Speed and H))
Switch back to the Trigger Editor and right click the category labeled "3ICE's Sliding System"
Select Copy
Switch to your map using Window ==> YourMap.w3m
Paste the category anywhere you want, I would place it on the top.
CONGRATULATIONS!
Additional things you might want to do:
You: I want to slide monkeys/cows/bunnies. Can I do that?
3ICE: Yes you can! Here's how it's done:
3ICE: Look at the trigger called Setup1
3ICE: Every unit that is added to the "H" unit group will slide on ice and die on snow.
3ICE: So if your heroes aren't Demon Hunters, you will have to change H:
3ICE: Set H = (Units of type Monkey/Cow/Bunny)
You: Sliding is too slow, can I make it go faster?
3ICE: You can. The default speed factor is 4.00
3ICE: Very slow: 1.50 Slow: 2.30 Normal: 4.00 Fast: 5.50 Very Fast: 6.50 Extreme: 8.00
3ICE: Additionally you can set Speed to 0.00 to freeze units on ice :)
You: Omg what is all that code in the Setup2 trigger?
3ICE: It is JASS, but you will have no trouble understanding it.
You: I doubt I will ever...
3ICE: Don't worry I'll help:
3ICE: If you have your map's tileset (Advanced ==> Modify Tileset...) set to Northrend
3ICE: And you used Ice for Sliding and Snow for killing...
3ICE: Then you don't even have to change anything in Setup2 because those are the default values!
3ICE: In case you have an other tileset, fear not!
3ICE: Let's say you have Lordaeron Summer Grass for killing:
3ICE: Customizing my system is as simple as changing:
3ICE: set udg_TerrainKill = 'Nsnw'
3ICE: to
3ICE: set udg_TerrainKill = 'Lgrs'
You: What's up with this Nsnw and Lgrs?
3ICE: Nsnw stands for Northrend Snow and Lgrs stands for Lordaeron Grass.
3ICE: You can find more codes in the Setup2 trigger's header comments.
You: What if the terrain I used isn't there?
3ICE: Further help is available at: http://www.3ice.hu/u/help (Make a new topic, stating your question)
You: Thanks.
3ICE: No problem, I am always happy to help.
FAQ:
Q: Why is Setup1 disabled?
A: It isn't. It just contains disabled actions.
Q: How can I turn on disabled actions?
A: Right click ==> Enable function
Q: What if I don't need the disabled actions?
A: Right click ==> Delete
Q: May I delete comments and this ReadMe?
A: Yes, but you must keep the credits unchanged. I'd also appreciate if I was credited on the loading screen:
Sliding triggers by 3ICE • http://www.3ice.hu/slide/
Q: Can you make me a personalized sliding system for my knockback spell, etc?
A: Yes, I might. Go to http://www.3ice.hu/u/help and make a new topic, stating your question
Q: I don't want terrainkill!
A: Remove the two marked lines from the "Slide" trigger. (Advanced users may also remove the TerrainKill variable)
Q: Can I force players to buy a pair of IceSkates before they could steer?
A: No, but let me know if you really need this feature and I'll make you a customized system.
Go to http://www.3ice.hu/u/help and create a new topic
Q: Can buildings slide?
A: Yes, changed their pathing map to none and add them to the "H" unit group.
Q: What will happen if I set the speed factor to 9999.99?
A: Nothing dangerous. Units will jump to the map corner they are facing
Q: Can I change the sliding speed during the game?
A: Yes, simply use "Set Speed = 4.00".
Q: Can I change the TerrainKill tile during the game?
A: Yes, use: "Custom script: set udg_TerrainKill = 'Nsnw'" You can change the Slide terrain too.
This will make your map require TFT, so if you are making a maze to RoC players convert your trigger to JASS:
Edit >> Convert to Custom Text
Q: Can't I use a regular GUI function for changing the TerrainKill tile?
A: No. You must use Custom Script or a trigger converted to JASS.
Q: How much better is your system than others?
A: I use precalculated constants instead of PolarProjectionBJ() (Point With Polar Projection).
The code is fully optimized. It doesn't create any memory leaks.
No processing power is wasted on Locations like in all other systems.
I work directly with the UnitX and UnitY values. This makes my system the best.
Q: How can I stress test this system?
A: Remove all snow except the edges, place 100 Demon Hunters all over the place and test the map. It won't lag.
Q: My computer is very bad. Can I do anything?
A: Yes, change the periodic timer in the "Slide" trigger from 0.01 to 0.03:
call TriggerRegisterTimerEvent(gg_trg_Slide,0.01,true)
to
call TriggerRegisterTimerEvent(gg_trg_Slide,0.03,true)
and triple the Speed factor: Set Speed = 4.00 to Set Speed = 12.00
Q: I heard there was a cool realistic mode you invented!
A: Yes, remove the line "call IssueImmediateOrder(u,"stop")" from the "Slide" trigger and let the result amuse you.
--3ICE
// List of all terrain type codes you can use:
// http://www.3ice.hu/blog/3ice-sliding-system-for-roc/#comment-109
function SetTerrainTypes takes nothing returns nothing
//Change 'Nice' to the terrain type code you want to slide heroes:
set udg_Slide = 'Nice'
//Change 'Nsnw' to the terrain type code you want to kill heroes:
set udg_TerrainKill = 'Nsnw'
endfunction
function InitTrig_Setup2 takes nothing returns nothing
set gg_trg_Setup2=CreateTrigger()
call TriggerAddAction(gg_trg_Setup2,function SetTerrainTypes)
endfunction
function S takes nothing returns nothing
local unit u=GetEnumUnit()
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local integer t=GetTerrainType(x,y)
if(t==udg_Slide)then
call SetUnitX(u,x+udg_Speed*Cos(0.017453278*GetUnitFacing(u)))
call SetUnitY(u,y+udg_Speed*Sin(0.017453278*GetUnitFacing(u)))
//Delete this line for the cool Realistic Sliding Mode (Between START1 and END1)
//START1
call IssueImmediateOrder(u,"stop")
//END1
//Delete these two lines to remove terrainkill (Between START2 and END2)
//START2
elseif(t==udg_TerrainKill)and(GetUnitState(u,UNIT_STATE_LIFE)>0)then
call KillUnit(u)
//END2
endif
set u=null
endfunction
function Slide takes nothing returns nothing
call ForGroup(udg_H,function S)
endfunction
function InitTrig_Slide takes nothing returns nothing
set gg_trg_Slide=CreateTrigger()
call TriggerRegisterTimerEvent(gg_trg_Slide,0.01,true)
call TriggerAddAction(gg_trg_Slide,function Slide)
endfunction
function Turn takes nothing returns nothing
local unit u=GetTriggerUnit()
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local location p=GetUnitLoc(GetOrderTargetUnit())
if(GetTerrainType(x,y)==udg_Slide)and(IsUnitInGroup(u,udg_H))then
call SetUnitFacing(u,57.295828*Atan2(GetLocationY(p)-y,GetLocationX(p)-x))
endif
call RemoveLocation(p)
set p=null
set u=null
endfunction
function Steer takes nothing returns nothing
local unit u=GetTriggerUnit()
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local real a=GetOrderPointX()
local real b=GetOrderPointY()
if(GetTerrainType(x,y)==udg_Slide)and(IsUnitInGroup(u,udg_H))then
call SetUnitFacing(u,57.295828*Atan2(b-y,a-x))
endif
set u=null
endfunction
function ReturnTrue takes nothing returns boolean
return true
endfunction
function InitTrig_Steer takes nothing returns nothing
local integer i=0
local filterfunc nullboolexpr=Filter(function ReturnTrue)
local trigger gg_trg_Turn=CreateTrigger()
set gg_trg_Steer=CreateTrigger()
call TriggerAddAction(gg_trg_Turn,function Turn)
call TriggerAddAction(gg_trg_Steer,function Steer)
loop
exitwhen i>12
call TriggerRegisterPlayerUnitEvent(gg_trg_Turn,Player(i),EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER,nullboolexpr)
call TriggerRegisterPlayerUnitEvent(gg_trg_Steer,Player(i),EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER,nullboolexpr)
set i=i+1
endloop
endfunction