For those who can't grasp the concept of unit direction detection through Kenoli's method or scanning, I've found a method to detect unit direction/facing detection through EUDs.
There's one byte on the unitnode structure that has the unit's direction. The higher the value of the byte the more the direction is offsetted in a clock-wise direction. For example, 0 would mean it's facing up, 64 facing right, 128 facing down, 192 facing left.
First value in the memory condition AKA the extended player:
Code
First unit: 19043
Second unit: 161759
Third unit: 161675
Fourth unit: 161591
Subtract 84 from the player to get the next consecutive unit.
Second unit: 161759
Third unit: 161675
Fourth unit: 161591
Subtract 84 from the player to get the next consecutive unit.
The byte we want is offsetted in the fourth byte with the first three being non-zero values so we want to use two conditions with the same extended player but one being At Least and the second being At Most.
To get the At Least value you convert the direction value you want into hexadecimal, append six zeros after it, then convert it back to decimal:
40 00 00 00
1073741824
For the At Most value you do the same thing except append six F's after it:
40 FF FF FF
1090519039
Here is a list of 8 common directions:
Code
UP (Direction Value 0) - AtLeast 0, AtMost 16777215
UP RIGHT (Direction Value 32) - AtLeast 536870912, AtMost 553648127
RIGHT (Direction Value 64) - AtLeast 1073741824, AtMost 1090519039
DOWN RIGHT (Direction Value 96) - AtLeast 1610612736, AtMost 1627389951
DOWN (Direction Value 128) - AtLeast 2147483648, AtMost 2164260863
DOWN LEFT (Direction Value 160) - AtLeast 2684354560, AtMost 2701131775
LEFT (Direction Value 192) - AtLeast 3221225472, AtMost 3238002687
UP LEFT (Direction Value 224) - AtLeast 3758096384, AtMost 3774873599
*It gets a bit iffy with the diagonals, you should include multiple directional values for them.
UP RIGHT (Direction Value 32) - AtLeast 536870912, AtMost 553648127
RIGHT (Direction Value 64) - AtLeast 1073741824, AtMost 1090519039
DOWN RIGHT (Direction Value 96) - AtLeast 1610612736, AtMost 1627389951
DOWN (Direction Value 128) - AtLeast 2147483648, AtMost 2164260863
DOWN LEFT (Direction Value 160) - AtLeast 2684354560, AtMost 2701131775
LEFT (Direction Value 192) - AtLeast 3221225472, AtMost 3238002687
UP LEFT (Direction Value 224) - AtLeast 3758096384, AtMost 3774873599
*It gets a bit iffy with the diagonals, you should include multiple directional values for them.
Memory addresses in case anyone is interested:
Code
First unit: 59CCF3
Second unit: 6282E3
Third unit: 628193
Fourth unit: 628043
Subtract 0x150 for the next consecutive unit.
Second unit: 6282E3
Third unit: 628193
Fourth unit: 628043
Subtract 0x150 for the next consecutive unit.
Also, if you don't want to have triggers for all 256 directions you can use the AtLeast from a lower value and AtMost from another higher value.
Post has been edited 5 time(s), last time on Mar 23 2010, 8:11 pm by yoonkwun.
None.