Resource:Interiors: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=Introduction=
__NOTOC__
The interiors resource provides a generic system for use of the single player's interiors system.  This means placing warp points where when players hit the marker, they are set into the appropriate interior.
{{Resource page}}
The interiors resource provides a generic system for use of the single player's interiors system, which is included in the MTASA 1.0 server package onwards.  This means placing warp points where when players hit the marker, they are set into the appropriate interior.


=Loading interiors from the resource=
=Loading interiors from the resource=
By default, the interiors resource offers over 200 of single player's own interior locations.  Coupled with [[dimension|dimensions]], each and every warp point offers a unique location - with a total of over 450 locations.
By default, the interiors resource offers over 200 of single player's own interior locations.  Coupled with [[dimension]]s, each and every warp point offers a unique location - with a total of over 450 locations.


Loading these interiors is easy.  Starting the ''interiors'' resource will auto load all these preset warp points and will be ready to use out of the box.
Loading these interiors is easy.  Starting the ''interiors'' resource will auto load all these preset warp points and will be ready to use out of the box.
Line 10: Line 11:
The interiors resource supports a flexible .map based element system to add your own interiors. The syntax follows an ''entry'' and ''return'' system.  An ''interiorEntry'' element must have a unique id, and the ''interiorReturn'' element uses the "refid" attribute to link them together.
The interiors resource supports a flexible .map based element system to add your own interiors. The syntax follows an ''entry'' and ''return'' system.  An ''interiorEntry'' element must have a unique id, and the ''interiorReturn'' element uses the "refid" attribute to link them together.
<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
<interiorEntry id="" posX="" posY="" posZ="" rotation="" dimension="" interior="" />
<interiorEntry id="" posX="" posY="" posZ="" rotation="" dimension="" interior="" oneway=""  />
<interiorReturn refid="" posX="" posY="" posZ="" rotation="" dimension="" interior="" />
<interiorReturn refid="" posX="" posY="" posZ="" rotation="" dimension="" interior="" />
</syntaxhighlight>
</syntaxhighlight>
==Required Arguments==
==Required Arguments==
Line 20: Line 21:
* '''dimension''': An integer representing the dimension of the player when he '''reaches''' the interior warp in the specified element.  In other words, which dimension the warp point exists.
* '''dimension''': An integer representing the dimension of the player when he '''reaches''' the interior warp in the specified element.  In other words, which dimension the warp point exists.
* '''interior''': An integer representing the interior world of the player when he '''reaches''' the interior warp in the specified element.  In other words, which interior the warp point exists.
* '''interior''': An integer representing the interior world of the player when he '''reaches''' the interior warp in the specified element.  In other words, which interior the warp point exists.
==Optional Arguments==
* '''oneway''': If set to ''true'', a interiorReturn marker will not be created, and the warp point will be one-way - from the interiorEntry to the interiorReturn with no way back.


==Example==
==Example==
Line 34: Line 38:
==Exported functions==
==Exported functions==
Please remember that [[call]] must be used to call functions of another resource.
Please remember that [[call]] must be used to call functions of another resource.
----
===getInteriorName===
===getInteriorName===
This function retrieves the overall name of an interior.  This means it is the id or the overall refid.
This function retrieves the overall name of an interior.  This means it is the id or the overall refid.
Line 46: Line 51:
====Returns====
====Returns====
Returns a string of the interior name, or false if it could not be retrieved.
Returns a string of the interior name, or false if it could not be retrieved.
----


===getInteriorMarker===
===getInteriorMarker===
Line 51: Line 58:
====Syntax====
====Syntax====
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
marker getInteriorName ( element interiorEntry/InteriorReturn )
marker getInteriorMarker ( element interiorEntry/InteriorReturn )
</syntaxhighlight>
</syntaxhighlight>


Line 75: Line 82:
====Cancel effect====
====Cancel effect====
If this event is [[Event system#Canceling|canceled]], the player will not be warped to his destination point.
If this event is [[Event system#Canceling|canceled]], the player will not be warped to his destination point.
----


===onInteriorWarped===
===onInteriorWarped===
Line 88: Line 97:
====Source====
====Source====
The [[event system#Event source|source]] of this event is the interior element which was warped '''to'''.
The [[event system#Event source|source]] of this event is the interior element which was warped '''to'''.
----


===onPlayerInteriorHit===
===onPlayerInteriorHit===
Line 93: Line 104:
====Parameters====
====Parameters====
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
player hitInterior
element hitInterior
</syntaxhighlight>  
</syntaxhighlight>  


Line 103: Line 114:
====Cancel effect====
====Cancel effect====
If this event is [[Event system#Canceling|canceled]], the player will not be warped to his destination point.
If this event is [[Event system#Canceling|canceled]], the player will not be warped to his destination point.
----


===onPlayerInteriorWarped===
===onPlayerInteriorWarped===
Line 109: Line 122:
====Parameters====
====Parameters====
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
player warpedInterior
element warpedInterior
</syntaxhighlight>  
</syntaxhighlight>  


Line 117: Line 130:
The [[event system#Event source|source]] of this event is the player who was warped to his destination point.
The [[event system#Event source|source]] of this event is the player who was warped to his destination point.


----
===Examples===
===Examples===
'''Coming soon'''
'''Coming soon'''
[[ru:Resource:Interiors]]

Latest revision as of 13:09, 3 September 2009

The interiors resource provides a generic system for use of the single player's interiors system, which is included in the MTASA 1.0 server package onwards. This means placing warp points where when players hit the marker, they are set into the appropriate interior.

Loading interiors from the resource

By default, the interiors resource offers over 200 of single player's own interior locations. Coupled with dimensions, each and every warp point offers a unique location - with a total of over 450 locations.

Loading these interiors is easy. Starting the interiors resource will auto load all these preset warp points and will be ready to use out of the box.

Adding your own interiors

The interiors resource supports a flexible .map based element system to add your own interiors. The syntax follows an entry and return system. An interiorEntry element must have a unique id, and the interiorReturn element uses the "refid" attribute to link them together.

<interiorEntry	id=""  posX=""  posY=""  posZ=""  rotation=""  dimension=""  interior="" oneway=""  />
<interiorReturn	 refid=""  posX=""  posY=""  posZ=""  rotation=""  dimension=""  interior=""  />

Required Arguments

  • posX: A float representing the X position of the interior warp.
  • posY: A float representing the Y position of the interior warp.
  • posZ: A float representing the Z position of the interior warp.
  • rotation: A float representing the rotation of the player when he reaches the marker in the specified element.
  • dimension: An integer representing the dimension of the player when he reaches the interior warp in the specified element. In other words, which dimension the warp point exists.
  • interior: An integer representing the interior world of the player when he reaches the interior warp in the specified element. In other words, which interior the warp point exists.

Optional Arguments

  • oneway: If set to true, a interiorReturn marker will not be created, and the warp point will be one-way - from the interiorEntry to the interiorReturn with no way back.

Example

<interiorEntry	id="AMMUN1"	posX="1368.35"	posY="-1279.06"	posZ="12.55"	rotation="-0.100006"	dimension="0"	interior="0"	/>
<interiorReturn	refid="AMMUN1"	posX="286.15"	posY="-41.54"	posZ="1000.57"	rotation="90"	interior="1"	dimension="0"	/>

The interiorEntry element here is located at 1368.35,-1279.06,12.55. When the player reaches this location, he will be warped to the attributes specified in the linked interiorReturn element - 286.15,-41.54,1000.57 with a rotation of 90 degrees, into the new interior world 1. When the player hits this marker again, the transverse will happen.

Interfacing your script with the interiors resource

The interiors resource offers a few events and functions which should allow customisability of interiors.

Exported functions

Please remember that call must be used to call functions of another resource.


getInteriorName

This function retrieves the overall name of an interior. This means it is the id or the overall refid.

Syntax

string getInteriorName ( element interiorEntry/InteriorReturn )

Required Arguments

  • interior: The interior you wish to get the name of. Can be of type interiorEntry or interiorReturn.

Returns

Returns a string of the interior name, or false if it could not be retrieved.



getInteriorMarker

This function retrieves the marker element associated to the interior. This will allow you to modify the visibility of interior markers using the setElementVisibleTo function.

Syntax

marker getInteriorMarker ( element interiorEntry/InteriorReturn )

Required Arguments

  • interior: The interior you wish to retrieve the associated marker of. Can be of type interiorEntry or interiorReturn.

Returns

Returns a marker element associated to the specified interior, or false if it could not be retrieved.

Events

onInteriorHit

This event is triggered when an interior warp point is hit, prior to when a player is warped to his/her destination.

Parameters

player hitPlayer
  • hitPlayer: The player that hit the interior warp point.

Source

The source of this event is the interior element which was hit.

Cancel effect

If this event is canceled, the player will not be warped to his destination point.



onInteriorWarped

This event is triggered when an interior destination has successfully been warped to.

Parameters

player warpedPlayer
  • warpedPlayer: The player that has warped to the destination interior.

Source

The source of this event is the interior element which was warped to.



onPlayerInteriorHit

This event is triggered when a player hits an interior warp point, prior to him reaching his destination

Parameters

element hitInterior
  • hitInterior: The interior element that was hit.

Source

The source of this event is the player who hit the interior element.

Cancel effect

If this event is canceled, the player will not be warped to his destination point.



onPlayerInteriorWarped

This event is triggered when a player successfully warps to his destination interior.

Parameters

element warpedInterior
  • warpedInterior: The interior that has been warped to.

Source

The source of this event is the player who was warped to his destination point.



Examples

Coming soon