Difference between revisions of "0247"

From GTAMods Wiki
Jump to navigation Jump to search
Line 1: Line 1:
{{Icon|trilogy}}
+
{{Icon|trilogy}} '''REQUEST_MODEL'''
 
<hr />
 
<hr />
 
'''Description'''
 
'''Description'''
Line 12: Line 12:
 
: [[REQUEST_MODEL]]
 
: [[REQUEST_MODEL]]
  
This opcode requests the model. It is almost always required when using opcodes that spawns [[Spawn a ped|characters]], [[Spawn a vehicle|vehicles]], or objects. This is also used to speed up loading certain map objects that you want to load quickly. Opcode [[0248]] checks if the model has been loaded, opcode [[038B]] streams all streamable data (including models), and opcode [[0249]] marks the model as no longer needed.
+
This opcode requests the model to be loaded into the game. It is almost always required when using opcodes that spawns [[Spawn a ped|characters]], [[Spawn a vehicle|vehicles]], objects, or [[weapon]]s. This is also used to speed up loading certain map objects that you want to load quickly. Opcode [[0248]] checks if the model has been loaded, opcode [[038B]] loads all models without the need for 0248, and opcode [[0249]] marks the model as no longer needed.
  
==Example==
+
== Example ==
 
These examples will show you the ways of loading a model, with a ped model as an example. These will be only shown as examples and should not be copied verbatim. There can be several ways of doing this not shown here. The following codes uses the Sanny Builder.
 
These examples will show you the ways of loading a model, with a ped model as an example. These will be only shown as examples and should not be copied verbatim. There can be several ways of doing this not shown here. The following codes uses the Sanny Builder.
  
===Shorter format using aliases===
+
=== Shorter format using aliases ===
 
<source lang="scm">
 
<source lang="scm">
 
#BFORI.Load()
 
#BFORI.Load()
Line 35: Line 35:
 
</source>
 
</source>
  
===Recommended format===
+
=== Common format ===
<source lang="scm">
+
<syntaxhighlight lang="scm">
:LoadModel
+
:LoadModel
0247: load_model #BFORI
+
0247: load_model #BFORI
+
 
:CheckModel
+
:CheckModel
0001: wait 0 ms
+
00D6: if 0
00D6: if 0
+
8248not model #BFORI available
0248:  model #BFORI available
+
004D: jump_if_false @CreateModel
004D: jump_if_false @CheckModel
+
0001: wait 0 ms
009A: 0@ = create_actor_pedtype 5 model #BFORI at 0.0 0.0 0.0
+
0002: jump @CheckModel
0249: release_model #BFORI
+
 
004E: end_thread
+
:CreateModel
</source>
+
009A: 0@ = create_actor_pedtype 5 model #BFORI at 0.0 0.0 0.0
 +
0249: release_model #BFORI
 +
004E: end_thread
 +
</syntaxhighlight>
 +
 
 +
=== Less common format ===
 +
<syntaxhighlight lang="scm">
 +
:LoadModel
 +
00D6: if 0
 +
8248:  not model #BFORI available
 +
004D: jump_if_false @CreateModel
 +
0247: load_model #BFORI
 +
0001: wait 0 ms
 +
0002: jump @LoadModel
  
===Rockstar's common format===
+
:CreateModel
<source lang="scm">
+
009A: 0@ = create_actor_pedtype 5 model #BFORI at 0.0 0.0 0.0
:LoadModel
+
0249: release_model #BFORI
0247: load_model #BFORI
+
004E: end_thread
+
</syntaxhighlight>
:CheckModel
 
00D6: if 0
 
8248:  not model #BFORI available
 
004D: jump_if_false @CreateModel
 
0001: wait 0 ms
 
0002: jump @CheckModel
 
 
:CreateModel
 
009A: 0@ = create_actor_pedtype 5 model #BFORI at 0.0 0.0 0.0
 
0249: release_model #BFORI
 
004E: end_thread
 
</source>
 
  
===Rockstar's less common format:===
+
=== Shorthand format ===
<source lang="scm">
+
<syntaxhighlight lang="scm">
 
:LoadModel
 
:LoadModel
00D6: if 0
+
0247: load_model #BFORI
8248:  not model #BFORI available
+
 
004D: jump_if_false @CreateModel
+
:CheckModel
0247: load_model #BFORI
+
0001: wait 0 ms
0001: wait 0 ms
+
00D6: if 0
0002: jump @LoadModel
+
0248:  model #BFORI available
+
004D: jump_if_false @CheckModel
:CreateModel
+
009A: 0@ = create_actor_pedtype 5 model #BFORI at 0.0 0.0 0.0
009A: 0@ = create_actor_pedtype 5 model #BFORI at 0.0 0.0 0.0
+
0249: release_model #BFORI
0249: release_model #BFORI
+
004E: end_thread
004E: end_thread
+
</syntaxhighlight>
</source>
 
  
==Keywords==
+
== Keywords ==
 
load, request, model
 
load, request, model
  
 
__NOTOC__
 
__NOTOC__
 
[[Category:OpCodes]]
 
[[Category:OpCodes]]

Revision as of 00:05, 13 January 2015

GTA III Vice City San Andreas REQUEST_MODEL


Description

Request the model

Syntax

0247: request_model [int]
Model.Load( [int] )

Parameter

[int]
Valid object model ID number as defined in the IDE file; also acceptable is model's DFF name identified by a hash character

Native analog

REQUEST_MODEL

This opcode requests the model to be loaded into the game. It is almost always required when using opcodes that spawns characters, vehicles, objects, or weapons. This is also used to speed up loading certain map objects that you want to load quickly. Opcode 0248 checks if the model has been loaded, opcode 038B loads all models without the need for 0248, and opcode 0249 marks the model as no longer needed.

Example

These examples will show you the ways of loading a model, with a ped model as an example. These will be only shown as examples and should not be copied verbatim. There can be several ways of doing this not shown here. The following codes uses the Sanny Builder.

Shorter format using aliases

#BFORI.Load()

repeat
    wait 0
    if
        #BFORI.Available()
    then
        break
    end
until false

Actor.Create(0@, 5, #BFORI, 0.0, 0.0, 0.0)
#BFORI.Destroy()
end_thread

Common format

:LoadModel
0247: load_model #BFORI

:CheckModel
00D6: if 0
8248:   not model #BFORI available
004D: jump_if_false @CreateModel
0001: wait 0 ms
0002: jump @CheckModel

:CreateModel
009A: 0@ = create_actor_pedtype 5 model #BFORI at 0.0 0.0 0.0
0249: release_model #BFORI
004E: end_thread

Less common format

:LoadModel
00D6: if 0
8248:   not model #BFORI available
004D: jump_if_false @CreateModel
0247: load_model #BFORI
0001: wait 0 ms
0002: jump @LoadModel

:CreateModel
009A: 0@ = create_actor_pedtype 5 model #BFORI at 0.0 0.0 0.0
0249: release_model #BFORI
004E: end_thread

Shorthand format

:LoadModel
0247: load_model #BFORI

:CheckModel
0001: wait 0 ms
00D6: if 0
0248:   model #BFORI available
004D: jump_if_false @CheckModel
009A: 0@ = create_actor_pedtype 5 model #BFORI at 0.0 0.0 0.0
0249: release_model #BFORI
004E: end_thread

Keywords

load, request, model