| 11-20-2005, 03:14 PM | #1 |
Could anyone tell me how to make a trigger(s) that would allow me to move my hero with the arrow keys? |
| 11-20-2005, 05:17 PM | #2 |
I have that kind of trigger somewhere.. I could look it up if you want. |
| 11-20-2005, 06:28 PM | #3 |
You have to have four triggers, each with the event that checks the keyboard, I forgot the exact name but it's pretty obvious. Anyways, when they press "down" on the up key you will want to order the unit to move to a point all the way across the map, directly forward from them, when they release it you tell them to stop. If you want people to be able to walk in reverse it gets very complicated, so I recommend not bothering with that. For the turning it's a little more complicated, I would recommend making a trigger that is periodic, maybe 5 times a second or so it changes orientation +1 degree, you need a second trigger for -1 degree (left turn). Set both to be initially off. Then make 4 triggers, two that when the key is pressed the trigger turns on the periodic event (and also turns slightly right away otherwise you get a "delay" on turning) and two more that turn both periodic triggers off. Hopefully that made sense. |
| 11-20-2005, 07:05 PM | #4 |
I think I got it. Thanks. |
| 12-19-2005, 12:59 PM | #5 |
Last time i checked, there was no trigger that captured key releases. But then again, last time i checked it was quite some years ago :) |
| 12-19-2005, 02:05 PM | #7 |
Last time i tinkered with this i ran into this problem: U is unit. | is wall _ is empty space suppose its like this: U___| You tell the unit to move right, and he does so: _U_| And then so: __U| But when he comes up against a wall he suddenly has to path around it, so it becomes something like this: __U_ ___| I couldn't find where this problem is adressed in that code you posted |
| 12-19-2005, 02:48 PM | #8 |
Hopefulle he isn't ordered to go over the center of the object. He stays on his side of wall. |
| 12-19-2005, 02:56 PM | #9 |
Well, then you would have to constantly re-issue movement orders, because you would be giving them over relatively small distances. As a result, the unit's movement animation becomes incredibly twitchy, constantly replaying a "movement start" part over and over again. Well, at least it was like this back in 2004 when i tinkered with it :) Also, there are some very thin walls out there. e.g. fences. |
| 12-19-2005, 02:57 PM | #10 |
hmm, ordering is bad for this. SetUnitX/Y works like a charm with custom pathing checks |
| 12-19-2005, 03:02 PM | #11 |
I really worked hard on this you know :P |
| 12-19-2005, 03:17 PM | #12 |
Yeah, I worked on it for days back there, and still couldn't find any solution. Well, actually i did. That solution is in 3 steps: 1) making the player-controlled unit ignore normal wc3 pathing 2) issue movement orders to the edges of the map, not to 100 units forward 3) draw up "restricted regions" and forcing hero to stop moving every time he attempts entering those This will still work sucky when you want your hero to be able to move in 360 degrees. But i expect this to work fine when hero is moving in 8 directions only :/ I never implemented it though, since its simply too much work over an imperfect system. wc3 was never meant for keyboard control :( |
| 12-19-2005, 03:42 PM | #13 |
Actually, you can make quite nice systems, the problem is the lag. The netwok code just wasn't meant for action games. Even games that are played with a mouse, but require manual weapon aiming or stuff like that, are hard to play when you're not host. |
| 04-06-2006, 12:38 AM | #14 |
Zoxc what is Movement [1], [2], [3] comeing from? It can't be a variable because it doesn't alow me to insert "[" or "]". If you would know where the movement stuff is comeing from it could help. |
| 04-06-2006, 05:01 PM | #15 |
It is an array And this thread is quite old |
