Resource:Interior flood: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 5: Line 5:


This resource provides few convenient exported functions.
This resource provides few convenient exported functions.
Here you can download an example of how to use that: [http://www.solidfiles.com/d/73d0427849/ Download!]


==Exported functions==
==Exported functions==
Line 21: Line 22:


===Returns===
===Returns===
Returns a water element id if successful, ''false'' otherwise.
Returns water element if successful, ''false'' otherwise.
</section>
</section>
====createWaterInInteriorRadius====
====createWaterInInteriorRadius====
Line 28: Line 29:
<syntaxhighlight lang="lua">bool exports.interior_flood:createWaterInInteriorRadius( int x, int y, int z, float radius, int intID, [ int effectType = 0 ] )</syntaxhighlight>  
<syntaxhighlight lang="lua">bool exports.interior_flood:createWaterInInteriorRadius( int x, int y, int z, float radius, int intID, [ int effectType = 0 ] )</syntaxhighlight>  
===Required Arguments===
===Required Arguments===
*'''x, y, z:''' position of the central point.
*'''x, y, z:''' position of the top-central point.
*'''radius:''' define the radious of water box to be created.
*'''radius:''' define the radious of water box to be created.
*'''intID:''' interior in which the water is to be created.
*'''intID:''' interior in which the water is to be created.
Line 35: Line 36:


===Returns===
===Returns===
Returns a water element id if successful, ''false'' otherwise.
Returns water element if successful, ''false'' otherwise.
</section>
</section>
====destroyWaterInInterior====
====destroyWaterInInterior====
Line 52: Line 53:
<syntaxhighlight lang="lua">bool exports.interior_flood:attachMaterialToWaterInInterior( int x, int y,int z, float radius, int intID, [ int effectType = 0 ] )</syntaxhighlight>  
<syntaxhighlight lang="lua">bool exports.interior_flood:attachMaterialToWaterInInterior( int x, int y,int z, float radius, int intID, [ int effectType = 0 ] )</syntaxhighlight>  
===Required Arguments===
===Required Arguments===
*'''x, y, z:''' position of the central point. The 'z' position will be corrected by height of the existing water.
*'''x, y, z:''' position of the top-central point. The 'z' position will be corrected by height of the existing water.
*'''radius:''' define the radious of the effect.
*'''radius:''' define the radious of the effect.
*'''intID:''' interior in which the water is to be created.
*'''intID:''' interior in which the water is to be created.
Line 59: Line 60:


===Returns===
===Returns===
Returns a water element id if successful, ''false'' otherwise.
Returns water element if successful, ''false'' otherwise.
</section>
</section>
====detachMaterialFromWaterInInterior====
====detachMaterialFromWaterInInterior====
Line 87: Line 88:


==See Also==
==See Also==
[https://community.multitheftauto.com/]
[https://community.multitheftauto.com/index.php?p=resources&s=details&id=8234 Resource Download]

Latest revision as of 16:05, 13 November 2013

The resource makes it possible to render water in interiors, where normaly wouldn't be visible. It draws a line material and applies a shader effect that mimicks the gta water effect.

Overview

This resource provides few convenient exported functions. Here you can download an example of how to use that: Download!

Exported functions

createWaterInInterior

Click to collapse [-]
Client

This function creates water.

bool exports.interior_flood:createWaterInInterior( int x1, int y1, float z1, int x2, int y2, float z2, int x3, int y3, float z3, int x4, int y4, float z4, int intID, [ int effectType = 0 ] )

Required Arguments

  • x1, y1, z1: position of bottom left (south-west) corner.
  • x2, y2, z2: position of bottom right (south-east) corner.
  • x3, y3, z3: position of top left (north-west) corner.
  • x4, y4, z4: position of top right (north-east) corner.
  • intID: interior in which the water is to be created.

Optional Arguments

  • effectType: effect type (0 - classic water, 1- watershine)

Returns

Returns water element if successful, false otherwise.

createWaterInInteriorRadius

Click to collapse [-]
Client

This function creates water (using different data).

bool exports.interior_flood:createWaterInInteriorRadius( int x, int y, int z, float radius, int intID, [ int effectType = 0 ] )

Required Arguments

  • x, y, z: position of the top-central point.
  • radius: define the radious of water box to be created.
  • intID: interior in which the water is to be created.

Optional Arguments

  • effectType: effect type (0 - classic water, 1- watershine)

Returns

Returns water element if successful, false otherwise.

destroyWaterInInterior

Click to collapse [-]
Client

This function destroys previously created water.

bool exports.interior_flood:destroyWaterInInterior( element )

Required Arguments

  • element: Previously created waterInInterior element.

Returns

Returns 'true' if successful, false otherwise.

attachMaterialToWaterInInterior

Click to collapse [-]
Client

This function attaches water surface material to existing water in interior.

bool exports.interior_flood:attachMaterialToWaterInInterior( int x, int y,int z, float radius, int intID, [ int effectType = 0 ] )

Required Arguments

  • x, y, z: position of the top-central point. The 'z' position will be corrected by height of the existing water.
  • radius: define the radious of the effect.
  • intID: interior in which the water is to be created.

Optional Arguments

  • effectType: effect type (0 - classic water, 1- watershine)

Returns

Returns water element if successful, false otherwise.

detachMaterialFromWaterInInterior

Click to collapse [-]
Client

This function destroys the surface material created with attachMaterialToWaterInInterior.

bool exports.interior_flood:detachMaterialFromWaterInInterior( element )

Required Arguments

  • element: Previously created waterSurface element.

Returns

Returns 'true' if successful, false otherwise.

Examples

exports.interior_flood:createWaterInInteriorRadius(-28.628,-83.787,1003.5,15,18,1)

This creates visible water in interior 18.

exports.interior_flood:createWaterInInterior(-290,-290,40,290,-290,40, -290, 290, 40, 290, 290, 40,0,1 )

This creates visible water in interior 0.

local someWater = exports.interior_flood:createWaterInInterior(-290,-290,40,290,-290,40, -290, 290, 40, 290, 290, 40,0,1 )
exports.interior_flood:destroyWaterInInterior(someWater)

This creates and destroys visible water in interior 0.


Of course when you want to use theese functions in your resources you have to include the interior_flood resource in meta.

See Also

Resource Download