Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   getangle questions (https://forums.graalonline.com/forums/showthread.php?t=65581)

wild8900 04-22-2006 06:39 PM

getangle questions
 
So, how would I use getangle? What type of number does it put out? Does it get an angle of 0-360? 0-3?
And, if I wanted to make an npc look in the direction of the player, how would I use this?

Tolnaftate2004 04-22-2006 08:10 PM

getangle() returns the radian angle (between 0 and 6.28318530...).

For an npc to face a player, use
NPC Code:
dir = getdir( playerx - x , playery - y );


ZeLpH_MyStiK 04-22-2006 09:39 PM

getangle(dx,dy), where
dx is the change in x coordinates points between the two points
dy is the change in y coordinates points between the two points

wild8900 04-23-2006 01:33 AM

oh, makes sense. I did
dir = getdir( playerx - x , playery - y );
but instead of getdir i used getangle and it didnt work.

Thanks this cleared up alot of questions :)

Ajira 04-23-2006 01:49 AM

Quote:

Originally Posted by wild8900
but instead of getdir i used getangle and it didnt work.

Yeah because getdir returns a direction (0-3) and getangle returns an angle(0-6.28).


All times are GMT +2. The time now is 02:21 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.