| 08-26-2005, 09:11 PM | #1 |
Has anyone come up with a way to test if a unit is stationary or not? I have a critical hit system that depends on whether a unit is in motion or not. I used poision spears in conjunction with unit takes damage trigger to catch the event that a unit is hit with a physical attack. I made a physical attack buff that is given to a unit when he is hit with physical attack ability (posion spears). If the unit has that buff in the takes damage trigger, you know he was hit by a physical attack. Then i remove the buff in the trigger to make sure no more damage is dealt when he has that buff. I then do a bunch of tests to determine if a critical hit happens. With missile attacks im making it happen more often when the unit is stationary, or if he has low move speed (so you can net them and shoot arrows for lots of critical hits) or if they are sleeping its automatic critical hit. |
| 08-26-2005, 09:50 PM | #2 |
Comparing last position with current one. Another way is checking the unit's current order, but that is not issue proof |
| 08-26-2005, 10:10 PM | #3 |
I guess the problem is that there is no last position. I have the position when the unit is hit. I guess I could go with position when unit is attacked, but then i need a way to pass it to the takes damage trigger. I was thinking of storing a location in the attacking units custom value, but the problem there is they could start a second attack before the first hits if they are very fast. Maybe I need to use a cache that stores a queue of attacks, or just go without the movement part, and go with facing. I was tring to get effect of an ambush of archer with shadowmeld, but i guess they can get same effect by waitng for target to turn its back,. |
| 08-27-2005, 09:14 PM | #4 |
Trigger 1: Every 0.1 seconds of game time, set [pointVariable] = position of [unit] Trigger 2: Every 0.5 seconds of game time, if region centered at position of [unit] with size 2x2 contains [pointVariable] = false then set [inmotion] = true else set [inmotion]= false. or something like that |
