Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

Difference between revisions of "precache model"

From Quake Wiki

(Created page with "====Syntax:==== <code>string precache_model(string s)</code> Precaches a model for use by the engine. Any model that you want to use MUST be precached. Precaching can only ...")
 
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
====Syntax:====
+
''string'' '''precache_model'''(''string'' modelPath)
<code>string precache_model(string s)</code>
 
  
Precaches a model for use by the engine. Any model that you want to use MUST be precached.  Precaching can only be done during map load, not afterwards. Doing so will cause the engine to crash.
+
== Usage ==
====Parameters:====
+
Precaches a model so it can be used by entities within the map. Precaching must be done at map load. Models cannot be used if they haven't been precached.
:<code>s</code> - The path to the model being precached
 
====Returns:====
 
:Returns a string (what string?).  This is usually ignored.
 
  
 +
=== Parameters ===
 +
*''modelPath''
 +
:The path to the model file to set. Can be a model (.mdl), sprite (.spr) or BSP (.bsp).
 +
 +
=== Return ===
 +
The passed model file path. Does nothing.
 +
 +
== Example ==
 +
// Precache a model in the monster's initialization function
 +
void monster_my_monster()
 +
{
 +
    precache_model("progs/mymonster.mdl");
 +
 +
    // ...
 +
}
  
 
[[Category:QuakeC Function]]
 
[[Category:QuakeC Function]]

Latest revision as of 15:19, 31 July 2023

string precache_model(string modelPath)

Usage[edit]

Precaches a model so it can be used by entities within the map. Precaching must be done at map load. Models cannot be used if they haven't been precached.

Parameters[edit]

  • modelPath
The path to the model file to set. Can be a model (.mdl), sprite (.spr) or BSP (.bsp).

Return[edit]

The passed model file path. Does nothing.

Example[edit]

// Precache a model in the monster's initialization function
void monster_my_monster()
{
    precache_model("progs/mymonster.mdl");

    // ...
}