ProcessLineOfSight: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
{{Client function}}
{{Client function}}
__NOTOC__
__NOTOC__
This function checks if there is anything between 2 points in the world, and if there is, tells you where and with what.
This function checks if there is anything between 2 points in the world, and if there is, tells you where and with what.  The two positions must be within the local player's draw distance.


==Syntax==  
==Syntax==  
Line 9: Line 9:


===Required Arguments===  
===Required Arguments===  
<!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type -->
*'''startX:''' The start ''x'' position
*'''argumentName:''' description
*'''startY:''' The start ''y'' position
*'''startZ:''' The start ''z'' position
*'''endX:''' The end ''x'' position
*'''endY:''' The end ''y'' position
*'''endZ:''' The end ''z'' position


<!-- Only include this section below if there are optional arguments -->
===Optional Arguments===  
===Optional Arguments===  
{{OptionalArg}}  
{{OptionalArg}}  
*'''argumentName2:''' description
*'''checkBuildings:''' Allow the line of sight to be blocked by GTA's internally placed buildings, i.e. the world map.
*'''argumentName3:''' description
*'''checkVehicles:''' Allow the line of sight to be blocked by [[Vehicle|vehicles]].
*'''checkPeds:''' Allow the line of sight to be blocked by peds, i.e. [[Player|players]].
*'''checkObjects:''' Allow the line of sight to be blocked by [[Object|objects]].
*'''checkDummies:''' Allow the line of sight to be blocked by GTA's internal dummies.  These are not used in the current MTA version so this argument can be set to ''false''.
*'''seeThroughStuff:''' Allow the line of sight to be blocked by translucent game objects, e.g. glass.
*'''ignoreSomeObjectsForCamera:''' Allow the line of sight to be blocked by certain objects.
*'''shootThroughStuff:''' Allow the line of sight to be blocked by certain entities.
*'''ignoredElement:''' Allow the line of sight to pass through a certain specified element.


===Returns===
===Returns===
Line 23: Line 33:


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This page lacks an example.
This example does...
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
--add an example here.
blabhalbalhb --abababa
--This line does this...
mooo
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Client world functions}}
{{Client world functions}}
[[Category:Incomplete]] -- leave this unless you complete the function
[[Category:Needs_Example]]

Revision as of 20:30, 29 August 2007

This function checks if there is anything between 2 points in the world, and if there is, tells you where and with what. The two positions must be within the local player's draw distance.

Syntax

bool float float float element processLineOfSight ( float startX, float startY, float startZ, float endX, float endY, float endZ, [ bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool seeThroughStuff, bool ignoreSomeObjectsForCamera, bool shootThroughStuff, element ignoredElement ] )

Required Arguments

  • startX: The start x position
  • startY: The start y position
  • startZ: The start z position
  • endX: The end x position
  • endY: The end y position
  • endZ: The end z position

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • checkBuildings: Allow the line of sight to be blocked by GTA's internally placed buildings, i.e. the world map.
  • checkVehicles: Allow the line of sight to be blocked by vehicles.
  • checkPeds: Allow the line of sight to be blocked by peds, i.e. players.
  • checkObjects: Allow the line of sight to be blocked by objects.
  • checkDummies: Allow the line of sight to be blocked by GTA's internal dummies. These are not used in the current MTA version so this argument can be set to false.
  • seeThroughStuff: Allow the line of sight to be blocked by translucent game objects, e.g. glass.
  • ignoreSomeObjectsForCamera: Allow the line of sight to be blocked by certain objects.
  • shootThroughStuff: Allow the line of sight to be blocked by certain entities.
  • ignoredElement: Allow the line of sight to pass through a certain specified element.

Returns

If there's a collision, the function will return true and the collision position, if the collision is with a game entity, it will return that too, otherwise nil. If there is no collision the function will return false.

Example

This page lacks an example.

--add an example here.

See Also