Cassandra Posted March 12, 2013 Share Posted March 12, 2013 How can you tell if a ped is facing another ped and that ped can see the other ped? Link to comment
Castillo Posted March 12, 2013 Share Posted March 12, 2013 I guess that you could use rotation to check if he's facing another ped. Link to comment
Cassandra Posted March 12, 2013 Author Share Posted March 12, 2013 I guess that you could use rotation to check if he's facing another ped. You can but the rotation has to be accurate in that case it's very unlikely the ped will see the other ped script-wise. Link to comment
Anderl Posted March 12, 2013 Share Posted March 12, 2013 Take a look at these functions: getElementRotation, findRotation, getPlayersInPhotograph / isElementInPhotograph. Link to comment
Cassandra Posted March 12, 2013 Author Share Posted March 12, 2013 Take a look at these functions: getElementRotation, findRotation, getPlayersInPhotograph / isElementInPhotograph. How can I make use of isElementInPhotograph to check if the ped is facing and can see the other ped? Link to comment
Anderl Posted March 12, 2013 Share Posted March 12, 2013 To check if the ped is facing another you need to find the rotation, to check if the ped can see the other you have to check if the client player is some element so that the function doesn't get called for all because the function uses the local player. So, you would do this: if ( thePlayerElement == localPlayer ) then if ( isElementInPhotograph ( otherElement ) ) then --do something end end Be sure to copy the function to your file, it's not a built-in one. Link to comment
Cassandra Posted March 12, 2013 Author Share Posted March 12, 2013 To check if the ped is facing another you need to find the rotation, to check if the ped can see the other you have to check if the client player is some element so that the function doesn't get called for all because the function uses the local player.So, you would do this: if ( thePlayerElement == localPlayer ) then if ( isElementInPhotograph ( otherElement ) ) then --do something end end Be sure to copy the function to your file, it's not a built-in one. I got the seeing part but not the rotation part. For example if the ped crouch sideways but still behind another ped, the ped sees it. Edit: IsElementOnScreen doesn't work for peds only players. Link to comment
Anderl Posted March 12, 2013 Share Posted March 12, 2013 Ah, well.. You're really talking about peds and not players.. Then I don't know how would you see if a ped can see some element, peds aren't user-controlable and so I don't think you can check if the ped is seeing another element. But you should not rely on my words, because I may be wrong. Link to comment
qaisjp Posted March 12, 2013 Share Posted March 12, 2013 um you could check the rotation, then check all element in a certain angle range from his position as an origin depending on a distance. Link to comment
Cassandra Posted March 12, 2013 Author Share Posted March 12, 2013 um you could check the rotation, then check all element in a certain angle range from his position as an origin depending on a distance. Yeah, I thought about that. But, there's no function to complete the logic behind it. Link to comment
qaisjp Posted March 12, 2013 Share Posted March 12, 2013 write a function Assuming you want to check until 200units start off with this: Get all the peds in a 200 unit radius Link to comment
Cassandra Posted March 12, 2013 Author Share Posted March 12, 2013 write a functionAssuming you want to check until 200units start off with this: Get all the peds in a 200 unit radius I did checked the distance. I only need to check the rotation if the ped facing the other ped. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now