EngineImageLinkDFF: Difference between revisions

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


{{New feature/item|4|1.6.0|21695|This function links DFF file with an IMG container.}}
{{New feature/item|4|1.6.0|21695|This function links DFF file with an IMG container. This function does not change a model immediately. You should use [[engineRestreamWorld]] to reload models.}}
{{Warning|This article is incomplete and may contain errors}}


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
img engineImageLinkDFF ( img img_file, string file_path, int modelID )
boolean engineImageLinkDFF ( img img_file, string file_path, int modelID )
</syntaxhighlight>
</syntaxhighlight>


{{OOP||[[DFF|EngineIMG]]}}
{{OOP||[[img]]:linkDFF}}
===Required Arguments===
===Required Arguments===
* '''img_file''': The [[IMG]] file you want to link.
* '''img_file''': The [[IMG]] file you want to link.
Line 19: Line 18:
Returns ''true'' if [[IMG]] file was successfully linked, ''false'' otherwise.
Returns ''true'' if [[IMG]] file was successfully linked, ''false'' otherwise.


<!-- TODO: Add examples
==Example==
==Examples==
 
You could use the following code:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- Load IMG
local img = engineLoadIMG( "file.img" )
-- Enable streaming from this IMG
engineAddImage( img )
-- Get model TXD id
local infernusModelID = 411
local infernusModelTxdID = engineGetModelTXDID( infernusModelID )
-- Link DFF and TXD to IMG files
engineImageLinkDFF( img, "infernus.dff", infernusModelID )
engineImageLinkTXD( img, "infernus.txd", infernusModelTxdID )
-- Reload game models
engineRestreamWorld()
</syntaxhighlight>
</syntaxhighlight>
-->


==See Also==
==See Also==
{{Engine_functions}}
{{Engine_functions}}

Latest revision as of 20:32, 21 July 2024

ADDED/UPDATED IN VERSION 1.6.0 r21695:
This function links DFF file with an IMG container. This function does not change a model immediately. You should use engineRestreamWorld to reload models.

Syntax

boolean engineImageLinkDFF ( img img_file, string file_path, int modelID )


OOP Syntax Help! I don't understand this!

Method: img:linkDFF(...)


Required Arguments

  • img_file: The IMG file you want to link.
  • file_path: Path to the DFF file you want to link.
  • modelID: ID of the model you want to link to.

Returns

Returns true if IMG file was successfully linked, false otherwise.

Example

You could use the following code:

-- Load IMG
local img = engineLoadIMG( "file.img" )

-- Enable streaming from this IMG
engineAddImage( img )

-- Get model TXD id
local infernusModelID = 411
local infernusModelTxdID = engineGetModelTXDID( infernusModelID )

-- Link DFF and TXD to IMG files
engineImageLinkDFF( img, "infernus.dff", infernusModelID )
engineImageLinkTXD( img, "infernus.txd", infernusModelTxdID )

-- Reload game models
engineRestreamWorld()

See Also