EngineRequestTXD: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Client function}} {{New feature/item|3.0160|1.6.0|22190|This function is used to register the next available TXD ID.}} ==Syntax== <syntaxhighlight lang="lua"> int engineRequestTXD ( string name ) </syntaxhighlight> ===Required Arguments=== *'''name''': TXD name string up to 24 characters. ===Returns=== {{New feature/item|3.0160|1.6.0|22190| Returns an ''integer'' of the TXD ID that was available to be assigned to game models, ''false'' if no free TXD ID avai...")
(No difference)

Revision as of 17:04, 3 September 2023

This function is used to register the next available TXD ID.

Syntax

int engineRequestTXD ( string name )

Required Arguments

  • name: TXD name string up to 24 characters.

Returns

Returns an integer of the TXD ID that was available to be assigned to game models, false if no free TXD ID available. Do not rely on the id numbers returned being consistent across multiple clients or multiple runs of resources. There is no guarantee for the order of the numbers.

Example

This example replaces textures for some Grove Street buildings.

-- Load IMG archive
local img = engineLoadIMG('worldmod.img')

-- Enable streaming from this IMG
engineAddImage(img)

-- Allocate a new TXD
local newTxdId = engineRequestTXD("WESTERNHOUSES01")

-- Link IMG files to TXD
engineImageLinkTXD(img, "western.txd", newTxdId)

-- Assign TXD to game models
engineSetModelTXTID(17697, newTxdId)
engineSetModelTXTID(17925, newTxdId)
engineSetModelTXTID(3646, newTxdId)

Requirements

Minimum server version n/a
Minimum client version 1.6.0-22190

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version client="1.6.0-22190" />

See Also