| 08-29-2006, 02:50 AM | #1 |
Ok now im pretty good with the WE but I've never really been interested in the ice sliding trigger I've been seeing alot of. But then all of the sudden i got really curious about it and im wondering how does it work???? ive got a couple of ideas but i need a lil help |
| 08-29-2006, 03:16 AM | #2 |
"Ice Sliding" in and of itself is done by use of knockback functions on units over some form of ice. An example would be a JESP spell I submitted awhile back located here. If you mean knockback in general, you need to move a unit a constantly decreasing amount in some timer until it is being moved by 0, in which case you exit. These are the functions used by my map -- JASS://*************************************************************************************************************** //*This is the timer that updates a unit sliding and being 'knocked back' across the ground. //* function Knockback_Update takes nothing returns nothing local integer i = H2I(GetExpiredTimer()) local unit u = GetUnit(I2Timer(i), "u") local real speed = GetReal(I2Timer(i), "speed") local real angle = GetReal(I2Timer(i), "angle") local real dec = GetReal(I2Timer(i), "dec") local real x = GetUnitX(u) local real y = GetUnitY(u) set x = ProjectX(x, speed, angle) set y = ProjectY(y, speed, angle) call SetUnitPosition(u, x, y) call SetReal(I2Timer(i), "speed", speed - dec) if speed <= 0 then call FlushLocals(I2Timer(i)) call PauseTimer(I2Timer(i)) call DestroyTimer(I2Timer(i)) endif set u = null endfunction JASS://*************************************************************************************************************** //*This starts the knockback function to slide a unit across the ground. //* function Knockback takes unit u, real angle, real speed, real decrement returns nothing local integer i = H2I(CreateTimer()) call SetReal(I2Timer(i), "angle", angle) call SetReal(I2Timer(i), "speed", speed) call SetReal(I2Timer(i), "dec", decrement) call SetHandle(I2Timer(i), "u", u) call TimerStart(I2Timer(i), .033, true, function Knockback_Update) endfunction They use handles and timers to cause a unit to move in some set direction by a constantly decreasing amount until they no longer are moving, in which case it cleans up and stops moving them. There are other variations of the triggers, but that's basically how they work. Negative acceleration. :D |
| 08-29-2006, 08:48 AM | #3 |
Don't forget to check if terraintype is of type ice or whatever you may use. What Rising_Dusk gave you can be done in GUI too, but taking care of group and location leaks would be a biatch :D |
| 08-29-2006, 09:02 AM | #4 | |
Quote:
lol, i need to try that. Btw, i noticed you used I2Timer(i) quite often, which is kinda slow, did you do that to aviod timer set to null conspiracy?, so you dont have a timer in local? |
| 08-29-2006, 12:48 PM | #5 |
Local timers are fine, it's only a problem when you attach handles to them. And you can tell me it's as slow as you want, but if I run it 5000 times at once it doesn't move any slower than using local timers. (In game at least) So blah to you. :P And yeah, it avoids the timer to null bug entirely. |
| 08-29-2006, 12:52 PM | #6 |
Eww. Those functions have the same 'convert integer to handle which is then converted back to integer' thing as your Hurricane spell. The faster you start using the natives the better >.<. |
| 08-29-2006, 08:50 PM | #7 |
Ok now to tell ya the truth i really don't know nothing about at there Jass. But thanks any way Dusk_rising and da blue noob and the ohter people but could you show me a GUI version? If you could or kinna like I don't know teach me how to do the trigger in Jass. If any of this is possible it would be greatly appreachiated. |
| 08-29-2006, 09:52 PM | #9 | |
Check this thread also, although my ways suck:
edit: good you aren't using 1000s of regions :) |
| 08-30-2006, 08:41 AM | #11 |
(Just a note: Fireeye's trigger leaks one location per unit per expiration of the timer event) |
| 08-30-2006, 09:58 AM | #12 |
Yea Blu's right, you need to set the polar offset to a location then remove it later. |
| 08-30-2006, 01:30 PM | #14 |
I dont like that sort of knockback. As you have it, the unit gets knocked back by 10 every iteration no matter what. Also, it only knocks back at all if they're on ice -- So if they slide off of ice all of a sudden the knockback stops. That isn't realistic at all in terms of how it should happen. It should detect the ice at the start of the knockback, then cause them to slide along while accelerating in the opposing direction (Slowing the slide) until they reach a halt. |
| 08-30-2006, 04:13 PM | #15 |
But only very slight negative acceleration while on ice (low friction) and it should continue to slide when it gets off ice but with much higher negative acceleration. Although that probably wouldn't work for a maze map :P |
