Difference between revisions of "0247"

From GTAMods Wiki
Jump to navigation Jump to search
m (Shorter format using aliases)
Line 2: Line 2:
 
| ini        = 0247=1,%1o%
 
| ini        = 0247=1,%1o%
 
| description = Loads a model into memory
 
| description = Loads a model into memory
| p1          = [[DFF]] model ID or name as defined at the beginning of the <code>main.scm</code>
+
| p1          = [[DFF]] model ID or name as defined at the beginning of the <code>[[main.scm]]</code>
| game        = GTA3, Vice City, San Andreas
+
| game        = [[GTA 3]], [[Vice City]], [[San Andreas]]
 
| native      = [[REQUEST_MODEL]]
 
| native      = [[REQUEST_MODEL]]
 
}}
 
}}
This opcode is almost always required when using opcodes that creates characters, vehicles, or objects. This is also used to speed up loading certain map objects that you want to load quickly. [[0248]] checks if the model is loaded and [[0249]] marks the model as no longer needed.
+
This opcode is almost always required when using opcodes that creates [[Spawn a ped|characters]], vehicles, or objects. This is also used to speed up loading certain map objects that you want to load quickly. [[0248]] checks if the model is loaded and [[0249]] marks the model as no longer needed.
 +
 
 +
==Note==
 +
In [[Sanny Builder]], this opcode is equivalent to the command '''Model.Load'''.
 +
Example: <source lang="scm">Model.Load(#BFORI)</source>
  
 
==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===
Line 80: Line 84:
 
==Keywords==
 
==Keywords==
 
load, request, model
 
load, request, model
 +
 +
__NOTOC__

Revision as of 03:27, 15 January 2010

{{{games}}}


Description
Loads a model into memory
Syntax
{{{syntax1}}}
Parameter
Native analog
REQUEST_MODEL

This opcode is almost always required when using opcodes that creates characters, vehicles, or objects. This is also used to speed up loading certain map objects that you want to load quickly. 0248 checks if the model is loaded and 0249 marks the model as no longer needed.

Note

In Sanny Builder, this opcode is equivalent to the command Model.Load.

Example:

Model.Load(#BFORI)

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

Recommended 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

Rockstar's 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

Rockstar's 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

Keywords

load, request, model