⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qc-built.htm

📁 Quake 的 各 种 文 档 格 式 说 明
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<br>
Usually, <i>e</i> is a player, and the vector returned is
calculated by auto-aiming to the closest enemy entity.


<h4>Function: <a name="particle">particle</a></h4>
<pre>
void <b>particle</b>(vector <i>origin</i>, vector <i>dir</i>, float <i>color</i>, float <i>count</i>)
    <i>origin</i> = initial position
    <i>dir</i> = initial direction
    <i>color</i> = color index (73,75, 
    <i>count</i> = time to live, in seconds
</pre>
Create a particle effect (small dot that flies away).
<pre>
color = 0   for chunk
color = 75  for yellow
color = 73  for blood red
color = 225 for entity damage
</pre>

<h4>Function: <a name="checkclient">checkclient</a></h4>
<pre>
entity <b>checkclient</a>()
</pre>
Returns  client (or object that has a client enemy) that 
would be a valid target.
<br>
If there are more than one valid options, they are cycled 
each frame.
<br>
If (self.<a href="qc-enty.htm#dot_origin" target="content">origin</a> + self.<a href="qc-enty.htm#dot_view_ofs" target="content">viewofs</a>)
 is not in the PVS of the target, 0 (false) is returned.


<hr>


<h3>Collision checking</h3>

<h4>Function: <a name="traceline">traceline</a></h4>
<pre>
traceline (vector <i>v1</i>, vector <i>v2</i>, float <i>nomonsters</i>, entity <i>forent</i>)
  <i>v1</i>= start of line
  <i>v2</i>= end of line
  <i>nomonster</i>= if TRUE, then see through other monsters, else FALSE.
  <i>forent</i>= ignore this entity, it's owner, and it's owned entities.
    if <i>forent</i> = <a href="qc-glob.htm#world" target="content">world</a>, then ignore no entity.
</pre>
Trace a line of sight, possibly ignoring monsters, and possibly ignoring the
entity <i>forent</i> (usually, <i>forent</i> = <a href="qc-glob.htm#self" target="content">self</a>).
<br>
This function is used very often, tracing and shot targeting.<br>
Traces  are blocked by bounding boxes and exact bsp entities.
<br>
Returns the results in the global variables:
<pre>
float <a name="trace_allsolid">trace_allsolid</a>;
  // never used
float <a name="trace_startsolid">trace_startsolid</a>;
  // never used
float <a name="trace_fraction">trace_fraction</a>;
  // fraction (percent) of the line that was traced, before
  // an obstacle was hit. Equal to 1 if no obstacle were found.
vector <a name="trace_endpos">trace_endpos</a>; 
  // point where line ended or met an obstacle.
vector <a name="trace_plane_normal">trace_plane_normal</a>;
  // direction vector of trace (?)
float  <a name="trace_plane_dist">trace_plane_dist</a>;  
  // distance to impact along direction vector (?)
entity <a name="trace_ent">trace_ent</a>;      
  // entity hit by the line
float  <a name="trace_inopen">trace_inopen</a>;
  // boolean, true if line went through non-water area.
float  <a name="trace_inwater">trace_inwater</a>;
  // boolean, true if line went through water area.
</pre>



<h4>Function: <a name="checkpos">checkpos</a></h4>
<b>CURRENTLY DISABLED. DO NOT USE.</b>
<pre>
scalar <b>checkpos</b> (entity <i>e</i>, vector <i>position</i>)
</pre>
Returns true if the given entity can move to the given position from it's
current position by walking or rolling.


<h4>Function: <a name="checkbottom">checkbottom</a></h4>
<pre>
float <b>checkbottom</b>(entity <i>e</i>)
       <i>e</i> = entity that is to be checked
       return TRUE or FALSE
</pre>
Returns TRUE if on the ground.
<br>
Used only for jumping monster, that need to jump randomly
not to get hung up (or whatever it actually means).


<h4>Function: <a name="pointcontents">pointcontents</a></h4>
<pre>
float <b>pointcontents</b>(vector <i>pos</i>) 
</pre>
Returns the <a href="qc-defs.htm#d_contents" target="content">contents</a> of the area 
situated at position <i>pos</i>.
<br>
Used to know if an area is in water, in slime or in lava.
<br>
Makes use of the BSP tree, and is supposed to be very fast.

<hr>

<h3>Server related functions</h3>


<h4>Function: <a name="changelevel">changelevel</a></h4>
<pre>
void <b>changelevel</b> (string <i>mapname</i>)
</pre>
Warp to the game map named <i>mapname</i>.
Actually executes the console command "changelevel" + <i>mapname</i>,
so if you want to alias it...

<h4>Function: <a name="setspawnparms">setspawnparms</a></h4>
<pre>
void <b>setspawnparms</b> (entity <i>client</i>)
</pre>
Restore the original spawn parameters of a client entity.
<br>
Doesn't work if <i>client</i> is not a player.


<h4>Function: <a name="stuffcmd">stuffcmd</a></h4>
<pre>
stuffcmd (entity <i>client</i>, string <i>text</i>)
       <i>client</i> = player that is to receive the command
       <i>text</i> = text of the command, ended by <b>\n</b> (newline).
</pre>
Send a command to a given player, as if it had been typed
on the player's console.<br>
<p>Don't forget the <b>\n</b> (newline) at the end, otherwise your command
will not be executed, and will stand still on the console window.</p>
<p>Examples:
<pre>
   stuffcmd(self, "bf\n");         // create a flash of light on the screen
   stuffcmd(self, "name Buddy\n"); // name the player Buddy
</pre>
</p>

<p>Mostly used to send the command <b>bf</b>, that creates a flash
of light on the client's screen.</p>


<hr>

<h3>Print messages</h3>

<h4>Function: <a name="bprint">bprint</a></h4>
<pre>
void <b>bprint</b> (string <i>text</i>)
	<i>text</i> = text of the message
</pre>
Broadcast a message to all players on the current server.

<h4>Function: <a name="centerprint"></a>centerprint</h4>
<a name="cprint"></a>
<pre>
void <b>centerprint</b>( entity <i>client</i>, string <i>text</i>)
	<i>client</i> = player that is to receive the message
	<i>text</i> = text of the message
</pre>
Sends a message to a specific player, and print it centered.

<h4>Function: <a name="sprint">sprint</a></h4>

<pre>
void <b>sprint</b> (entity <i>client</i>, string <i>text</i>)
        <i>client</i> = player that is to receive the message
	<i>text</i> = text of the message
</pre>
Sends a message to a player.


<hr>
<h3>Console </h3>

<h4>Function: <a name="localcmd">localcmd</a></h4>
<pre>
void localcmd (string text)
       <i>text</i> = text of the command, ended by <b>\n</b> (newline).
</pre>
Execute a command on the server, as if it had been typed on
the server's console.
<p>Examples:
<pre>
   localcmd("restart\n");      // restart the level
   localcmd("teamplay 1\n");   // set deathmatch mode to teamplay
   localcmd("killserver\n");   // poor server...
</pre>
</p>


<h4>Function: <a name="dprint">dprint</a></h4>
<pre>
void <b>dprint</b> (string <i>text</i>)
	<i>text</i> = text of the message
</pre>
Prints a message to the server console.

<h4>Function: <a name="cvar">cvar</a></h4>
<pre>
float <b>cvar</b> (string <i>variable</i>)
      <i>variable</i> = see <a href="qc-vars.htm#d_consolev" target="content">console variables</a>
</pre>
returns the value of a console variable.

<h4>Function: <a name="cvar_set">cvar_set</a></h4>
<pre>
float <b>cvar_set</b> (string <i>variable</i>, string <i>value</i>)
      <i>variable</i> = see <a href="qc-vars.htm#d_consolev" target="content">console variables</a>
</pre>
sets the value of a console variable.


<hr>

<h3>Debugging</h3>

<h4>Function: <a name="eprint">eprint</a></h4>
<pre>
void <b>eprint</b> (entity <i>e</i>)
	<i>e</i> = entity to print
</pre>
Print details about a given entity (for debug purposes).


<h4>Function: <a name="coredump">coredump</a></h4>
<pre>
void coredump()
</pre>
Print all entities

<h4>Function: <a name="traceon">traceon</a></h4>
<pre>
void traceon()
</pre>
Start tracing functions, end them with <a href="qc-built.htm#traceoff" target="content">traceoff()</a>

<h4>Function: <a name="traceoff"></a>traceoff</h4>
<pre>
void traceoff()
</pre>
End traces started by <a href="qc-built.htm#traceon" target="content">traceon()</a>

<h4>Function: <a name="break">break</a></h4>
<pre>
void break()
</pre>
Exit the programs. Never used?

<h4>Function: <a name="error"></a>error</h4>
<pre>
void error (string <i>text</i>)
</pre>
Print an error message.

<h4>Function: <a name="objerror">objerror</a></h4>
<pre>
void objerror (string <i>text</i>)
</pre>
Print an error message related to object <a href="qc-glob.htm#self" target="content">self</a>.

<hr>
<h3>Precaching files</h3>

<p>Those functions are used to declare models, sounds 
and stuff, <b>before</b> the PAK file is built.</p>

<p>Just <b>follow this rule</b>: whenever one of your functions makes use of
a file that's not defined in Quake, <b>precache</b> this file in
a function that will be called by <b>worldspawn()</b>.</p>
<p>Then, the QCC compiler can automatically include in the PAK file
all the files that you really need to run your programs.</p>
<p>And when the level starts running, those precache orders will
be executed, so as to attribute a fixed table index to all those
files.</p>

<p><b>DO NOT USE</b> those functions in code that will be called after
<b>worldspawn()</b> was called. As a matter of fact, that could bomb
Quake (restarting the level, without crashing the game).</p>

<p>Files can only be precached in spawn functions.</p>

<h4>Function: <a name="precache_file">precache_file</a></h4>
<pre>
void <b>precache_file</b>(string <i>file</i>)
  <i>file</i> = name of the file to include in PAK file.
</pre>
Does nothing during game play.
<br>
Use <a name="precache_file2">precache_file2</a> for registered Quake.

<h4>Function: <a name="precache_model">precache_model</a></h4>
<pre>
void <b>precache_model</b>(string <i>file</i>)
  <i>file</i> = name of the MDL or BSP file to include in PAK file.
</pre>
Does nothing during game play.<br>
Must be used in a model's <b>spawn function</b>, to declare the
model file.
<br>
Use <a name="precache_model2">precache_model2</a> for registered Quake.

<h4>Function: <a name="precache_sound">precache_sound</a></h4>
<pre>
void <b>precache_sound</b>(string <i>file</i>)
  <i>file</i> = name of the WAV file to include in PAK file.
</pre>
Does nothing during game play.<br>
Must be used in a model's <b>spawn function</b>, to declare the
sound files.
<br>
Use <a name="precache_sound2">precache_sound2</a> for registered Quake.

<hr>

</BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -