| View previous topic :: View next topic |
| Author |
Message |
Dereta How do I cheat?
Reputation: 0
Joined: 21 Aug 2016 Posts: 9
|
Posted: Thu Aug 24, 2017 2:19 pm Post subject: Set Enemy Position by Charakter Position and Rotation |
|
|
Hey Everyone i have a problem.. a made a "Moblock" hack with ASM.
(All mob x & y are set to player POS.)
But that gives me a big problem.
I can't attack them..
So i want to set there pos in front of my charakter.
But i don't know how.
I have my POS (X,Y) and my view angle. (0-360 float).
How can i calculate the position where the mobs have to be (see image)
Hope you unterstand..
Thanks for any help!
(Should be posible in ASM XD) |
|
| Back to top |
|
 |
FreeER Grandmaster Cheater Supreme
Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Thu Aug 24, 2017 3:48 pm Post subject: |
|
|
sounds like basic trig. cos angle = X, sin angle = Y based on a circle with a radius of 1, to make them further away you just multiply by whatever factor you want, since cos(45) = ~0.7 to get a distance of 3 you'd need to use a factor of 3/0.7=~4.3 eg. 4.3 * cos A = X, 4.3 * sin A = Y
If you can use library functions for cos / sin then that's simple enough (example I made up via googling (so may not be optimal/perfect but seemingly working), based on the tutorial: dropbox github), otherwise googling "x86 assembly cos sin" should get you some code
of course you could just arbitrarily subtract 3 from the x position which should place them 3 to the left of the player and just require you to turn left to kill them instead of always having them in front of wherever the player is looking. |
|
| Back to top |
|
 |
Dereta How do I cheat?
Reputation: 0
Joined: 21 Aug 2016 Posts: 9
|
Posted: Fri Aug 25, 2017 4:58 am Post subject: |
|
|
Thanks a lot! I was thinking that i need something like this..
But i was always scared of this (con, sin) because i thinking that there are to hard to learn.. (in the other hand math is my favorite subject area)
I'll try a little bit and watch how it works thx a lot!
Great |
|
| Back to top |
|
 |
|