EVENT DISPLAYROOMS: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
m Reverted edits by 201.21.216.205 (Talk) to last version by Jblade
Line 6: Line 6:


One use for this event is to have it display from the point of view of a sprite other than the player.  In the following example, assume that the gamevar camerasprite is global and is set to the sprite ID of a special sprite when the camera is being used, and otherwise has a value of -1.  Also assume that the EXTRA member of the camera sprite is set to the desired horiz.  What follows is the code appropriate for the event in that case (additional actor code for the camera sprite would also be required).
One use for this event is to have it display from the point of view of a sprite other than the player.  In the following example, assume that the gamevar camerasprite is global and is set to the sprite ID of a special sprite when the camera is being used, and otherwise has a value of -1.  Also assume that the EXTRA member of the camera sprite is set to the desired horiz.  What follows is the code appropriate for the event in that case (additional actor code for the camera sprite would also be required).
It seems that [[cameradist]] only works with View Mode (F7) on.


   onevent EVENT_DISPLAYROOMS
   onevent EVENT_DISPLAYROOMS

Revision as of 18:52, 10 January 2009

This event can be used to move the game camera from its normal position at the player's head to a specified location. This is done by changing the value of several constantly updated gamevars which determine the camera's position. The gamevars are:

camerax, cameray, cameraz, cameraang, camerahoriz, and camerasect

The first three are the map coordinates of the camera, cameraang is the direction the camera is facing, camerahoriz is the up/down angle of the camera, and camerasect is its sector. Unless these variables are changed in this event, they will take the corresponding values of the player structure (e.g. camerahoriz defaults to the horiz member of the player structure).

One use for this event is to have it display from the point of view of a sprite other than the player. In the following example, assume that the gamevar camerasprite is global and is set to the sprite ID of a special sprite when the camera is being used, and otherwise has a value of -1. Also assume that the EXTRA member of the camera sprite is set to the desired horiz. What follows is the code appropriate for the event in that case (additional actor code for the camera sprite would also be required).

  onevent EVENT_DISPLAYROOMS
  ifvarn camerasprite -1
  {
    getactor[camerasprite].x camerax
    getactor[camerasprite].y cameray
    getactor[camerasprite].z cameraz
    getactor[camerasprite].ang cameraang
    getactor[camerasprite].extra camerahoriz
    getactor[camerasprite].sectnum camerasect
  }
  endevent