Register for your free account! | Forgot your password?

Go Back   elitepvpers > Aion > Aion Hacks, Bots, Cheats & Exploits
You last visited: Today at 12:30

  • Please register to post and access all features, it's quick, easy and FREE!

 

[Code Snippet]Facing Character to X , Y

Reply
 
Old   #1
 
elite*gold: 240
Join Date: Dec 2006
Posts: 1,580
Received Thanks: 1,609
[Code Snippet]Facing Character to X , Y

Hey community,

i want to share some code snippets to you because NCsoft changed a little bit in Aion and now i want to share a new Facting to X Y method.

Thanks to PharmerPhale for some help.

C# Code

Code:
        private double RotNeeded(float X, float Y)
        {

            double faceAngle = Math.Atan2(Y - Player.GetPlayerY(), X - Player.GetPlayerX());
            faceAngle = faceAngle * 180 / Math.PI;
            faceAngle -= 90;

            if (faceAngle > 180)
            {
                faceAngle -= 360;
            }

            faceAngle -= 180;

            if (faceAngle < -180 && faceAngle > -360)
            {
                faceAngle += 360;
            }

            return faceAngle;

        }
This method gives you the Player Rotation back which the character needs for the new X and Y coordinate. If you want to use it you need to insert your own GetPlayerRotation and your own GetPlayerX and Y. If you dont know how to use the math namespace, try looking at msdn.

C++ Code

Code:
double aPlayer::rotationNeed(float X, float Y)
{
	double faceAngle = atan2(Y - pCoordY(), X - pCoordX());
	faceAngle = faceAngle * 180 / 3.14159265;
	faceAngle -= 90;

	if (faceAngle > 180)
		faceAngle -= 360;

	faceAngle -= 180;

	if (faceAngle < -180 && faceAngle > -360)
		faceAngle += 360;

	return faceAngle;
}
And thats my C++ version of this. You have to include <math.h> and you have to replace my pCoordX() pCoordY() and pRotation() then it should work for you.

I hope I can help some coders.

So long,

Unknw0n0x



Bl@ze! is offline  
Thanks
3 Users
Old   #2
 
elite*gold: 0
Join Date: Jul 2006
Posts: 5
Received Thanks: 0
Frage

Kann es sein dass der Ausdruck:
Code:
 if (faceAngle < -180 && faceAngle > -360)
Nicht Wahr werden kann ?

Quote:
Logisches UND &&

Das Ergebnis des Ausdrucks ist 1, wenn beide Operanden ungleich 0 sind, andernfalls 0. Im Unterschied zum & wird der Ausdruck streng von links nach rechts ausgewertet. Wenn der erste Operand bereits 0 ergibt, wird der zweite Operand nicht mehr ausgewertet und der Ausdruck liefert in jedem Fall den Wert 0. Nur wenn der erste Operand 1 ergibt, wird der zweite Operand ausgewertet. Der && Operator ist ein Sequenzpunkt: Alle Nebenwirkungen des linken Operanden mssen bewertet worden sein, bevor die Nebenwirkungen des rechten Operanden ausgewertet werden.

Das Resultat des Ausdrucks ist vom Typ int .
faceAngle < -180 && faceAngle > -360

So wie ich das verstehe kann der Winkel doch nicht kleiner -180 UND grer -360 sein oder ?


mel andru is offline  
Old   #3
 
elite*gold: 57
Join Date: Jun 2007
Posts: 10,721
Received Thanks: 5,092
Quote:
Originally Posted by mel andru View Post
Kann es sein dass der Ausdruck:
Code:
 if (faceAngle < -180 && faceAngle > -360)
Nicht Wahr werden kann ?



faceAngle < -180 && faceAngle > -360

So wie ich das verstehe kann der Winkel doch nicht kleiner -180 UND grer -360 sein oder ?
ynot?
angle is just between -180 and -360
_revo is offline  
Old   #4
 
elite*gold: 0
Join Date: Jul 2006
Posts: 5
Received Thanks: 0
Well thanks for Info.
Another Question (Sorry for Bothering yours)

He wrote that i need "pRotation()" well i got this function but cant find it in his code something missing ?

I consoled out the function and getRot() but i dont get it.

Im really confused about this strange Compass in Aion having -90 N / -135 NE
/ -180 E / 135 SE / 90 S / 45 SW / 0 W / -45 NW ....

I used to write functions for Waypoint Navigation for Lotro so the Basics with Arctan, rad, degree and relation between the degree Value of Arctan isnt unknown but i cant handle it in Aion this Compass is really confusing me.

Im trying now since almoast a week to get this facetarget working im almoast running mad.

Any Help would be appriciated, like do i have to and how change the Compass to E = 0 or N = 0

thanks in Advance


mel andru is offline  
Old   #5
 
elite*gold: 240
Join Date: Dec 2006
Posts: 1,580
Received Thanks: 1,609
pRotation = a function which returns your rotation in a double value you have to replace it with your own function


Bl@ze! is offline  
Reply



« Previous Thread | Next Thread »

Similar Threads
[New] Alba Kingz Album Snippet!! [Rap]!!
Hallo Leute, http://img576.imageshack.us/img576/6324/henwdseu1.jpg Ich wollte euch mal Alba Kingz vorstellen!! Alba Kingz ist eine...
3 Replies - Main
can u plz help me .. iam facing a problem in hacking dragonica
please help me .. iam facing a problem in hacking dragonica... very important ...
7 Replies - Dragonica
autoit code fr correct facing
ich suche ein autoit source code beispiel fr "ausrichtung des spielers zum gegner (drehen)" danke
3 Replies - WoW Ask the Experts
alt code in character name
helloo. . anyone know how to create character wiht alt codes in its name. . ? i saw some player have that kind of name. . ex.: XXXX i...
8 Replies - Dekaron
Code Character Stats (str, agi, etc) in a CO Private Server
.
0 Replies - CO2 Main - Discussions / Questions



All times are GMT +2. The time now is 12:30.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2017 elitepvpers All Rights Reserved.