| 10-03-2007, 04:03 AM | #1 |
I'm trying to make a trigger set that makes a unit rotate to the left or right only when the left or right key is pressed and stops when the key is released. After trying to figure this out for about 2 hours i've given up and i need help. This is the Left Press Trigger: This is what i thought should stop it: Trigger: I've tried many variation of this idea such as an if within the press trigger that if leftloop is 0 it does not let the rest occur. Also even if it were to work it isn't very smooth because the unit looks like it's jiggling as it rotates. Check it out: Movement Test.w3x Thanks for any help, this is critical for my map to work well. |
| 10-03-2007, 08:07 PM | #2 |
What's wrong (didn't check test map yet)? Just wondering, but what's the wait for? And what's the default for leftmax? If it's 0, and your turning doesn't work, maybe set it to something higher for your loop. |
| 10-03-2007, 08:50 PM | #3 | |
Quote:
Instead of what you're doing, I'd suggest having a global boolean variable set to true when the key is pressed and set to false when it's released. Then, you can have a separate periodic trigger that would run every .03 seconds or whatever suits your needs. This trigger would check to see if the boolean variable was true and if so, rotate the unit. Otherwise, it would just let things be. |
| 10-04-2007, 02:21 AM | #4 | |
Update: I fixed it with your idea and with one little fix to it, it works perfectly and smoothly. Thanks a lot. + rep! Original: Quote:
Well first i'll say i did fix the problems i had last night. For some reason i'm not as smart when i do map making at night but thanks for the suggestion as it might fix the various bugs my new system has. For no apparent reason when i constantly tap the left or right it starts to rotate non-stop until i press the key again. Here's the new code: Trigger: Trigger: I'm gonna try your separate trigger idea, it might just do the trick. The only problem i foresee is the lag that could happen when i have 8 of these running at once (8 players in full version). Any ideas? |
| 10-04-2007, 02:46 AM | #5 |
I think the wait is too short (in trigger 2) or because every time you press the left key it goes to leftmax = 1, meaning it keep turning if you tap it. |
| 10-04-2007, 03:31 AM | #6 | |
Quote:
Note: I said i fixed XD, but still, it would continue to rotate even if i didn't tap it. I think it was because i hit it before it could set check to 0 so it would never stop even though the key is not pressed. |
