Canseespr: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 5: Line 5:
canseespr sets <returnvar> to 1 if the sprite with ID <spriteID1> has a line of sight with the sprite with ID <spriteID2>, otherwise <returnvar> is set to 0.
canseespr sets <returnvar> to 1 if the sprite with ID <spriteID1> has a line of sight with the sprite with ID <spriteID2>, otherwise <returnvar> is set to 0.


<pre>
[[Category:EDuke32 specific commands]]
// Example of actor code that sets the actor to attack a nearby PIGCOP if it is visible
[[Category:Gamevar manipulation]]
// gamevars must be declared elsewhere, and the state "attackthepig" presumably aims and fires
 
findnearactor PIGCOP 8192 target
 
ifvarn target -1
      {
      canseespr THISACTOR target TEMP
      ifvare TEMP 1 state attackthepig
      }
</pre>

Revision as of 15:28, 29 May 2006

canseespr <spriteID1> <spriteID2> <returnvar>

The three parameters are gamevars.

canseespr sets <returnvar> to 1 if the sprite with ID <spriteID1> has a line of sight with the sprite with ID <spriteID2>, otherwise <returnvar> is set to 0.