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

📄 monsters.htm

📁 Quake 的 各 种 文 档 格 式 说 明
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<html><head><title>monsters.qc</title></head><body bgcolor="#C0F0D0">
<base target=examine>
<pre>
<i>/* ALL MONSTERS SHOULD BE 1 0 0 IN COLOR */</i>


<i>// name =[framenum,	nexttime, nextthink] {code}</i>
<i>// expands to:</i>
<i>// name ()</i>
<i>// {</i>
<i>//		self.frame=framenum;</i>
<i>//		self.nextthink = time + nexttime;</i>
<i>//		self.think = nextthink</i>
<i>//		<code></i>
<i>// };</i>


<i>/*
================
monster_use

Using a monster makes it angry at the current activator
================
*/</i>

<a href="qc-types.htm#void">void</a>() <b>monster_use</b><a name="monster_use">=</a>
{
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</a>)
		<b>return</b>;
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_health">health</a> &lt;= 0)
		<b>return</b>;
	<b>if</b> (<a href="defs.htm#activator">activator</a>.<a href="qc-enty.htm#dot_items">items</a> &amp; <a href="qc-defs.htm#IT_INVISIBILITY">IT_INVISIBILITY</a>)
		<b>return</b>;
	<b>if</b> (<a href="defs.htm#activator">activator</a>.<a href="qc-enty.htm#dot_flags">flags</a> &amp; <a href="defs.htm#FL_NOTARGET">FL_NOTARGET</a>)
		<b>return</b>;
	<b>if</b> (<a href="defs.htm#activator">activator</a>.<a href="qc-enty.htm#dot_classname">classname</a> != <b>"player"</b>)
		<b>return</b>;
	
<i>// delay reaction so if the monster is teleported, its sound is still</i>
<i>// heard</i>
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</a> = <a href="defs.htm#activator">activator</a>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_nextthink">nextthink</a> = <a href="qc-glob.htm#time">time</a> + 0.1;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="ai.htm#FoundTarget">FoundTarget</a>;
};

<i>/*
================
monster_death_use

When a mosnter dies, it fires all of its targets with the current
enemy as activator.
================
*/</i>

<a href="qc-types.htm#void">void</a>() <b>monster_death_use</b><a name="monster_death_use">=</a>
{
	<b>local</b> <a href="qc-types.htm#entity">entity</a> 	ent, otemp, stemp;

<i>// fall to ground</i>
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> &amp; <a href="defs.htm#FL_FLY">FL_FLY</a>)
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> - <a href="defs.htm#FL_FLY">FL_FLY</a>;
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> &amp; <a href="defs.htm#FL_SWIM">FL_SWIM</a>)
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> - <a href="defs.htm#FL_SWIM">FL_SWIM</a>;

	<b>if</b> (!<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_target">target</a>)
		<b>return</b>;

	<a href="defs.htm#activator">activator</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</a>;
	<a href="subs.htm#SUB_UseTargets">SUB_UseTargets</a> ();
};


<i>//============================================================================</i>

<a href="qc-types.htm#void">void</a>() <b>walkmonster_start_go</b><a name="walkmonster_start_go">=</a>
{
<b>local</b> <a href="qc-types.htm#string">string</a>	stemp;
<b>local</b> <a href="qc-types.htm#entity">entity</a>	etemp;

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin_z">origin_z</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin_z">origin_z</a> + 1;	<i>// raise off floor a bit</i>
	<a href="qc-built.htm#droptofloor">droptofloor</a>();
	
	<b>if</b> (!<a href="qc-built.htm#walkmove">walkmove</a>(0,0))
	{
		<a href="qc-built.htm#dprint">dprint</a> (<b>"walkmonster in wall at: "</b>);
		<a href="qc-built.htm#dprint">dprint</a> (vtos(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a>));
		<a href="qc-built.htm#dprint">dprint</a> (<b>"\n"</b>);
	}
	
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_takedamage">takedamage</a> = <a href="qc-defs.htm#DAMAGE_AIM">DAMAGE_AIM</a>;

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ideal_yaw">ideal_yaw</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_angles">angles</a> * '0 1 0';
	<b>if</b> (!<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_yaw_speed">yaw_speed</a>)
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_yaw_speed">yaw_speed</a> = 20;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_view_ofs">view_ofs</a> = '0 0 25';
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_use">use</a> = <a href="monsters.htm#monster_use">monster_use</a>;
	
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> | <a href="defs.htm#FL_MONSTER">FL_MONSTER</a>;
	
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_target">target</a>)
	{
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_goalentity">goalentity</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_movetarget">movetarget</a> = <a href="qc-built.htm#find">find</a>(<a href="qc-glob.htm#world">world</a>, targetname, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_target">target</a>);
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ideal_yaw">ideal_yaw</a> = <a href="qc-built.htm#vectoyaw">vectoyaw</a>(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_goalentity">goalentity</a>.<a href="qc-enty.htm#dot_origin">origin</a> - <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a>);
		<b>if</b> (!<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_movetarget">movetarget</a>)
		{
			<a href="qc-built.htm#dprint">dprint</a> (<b>"Monster can't find target at "</b>);
			<a href="qc-built.htm#dprint">dprint</a> (vtos(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a>));
			<a href="qc-built.htm#dprint">dprint</a> (<b>"\n"</b>);
		}
<i>// this used to be an objerror</i>
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_movetarget">movetarget</a>.<a href="qc-enty.htm#dot_classname">classname</a> == <b>"path_corner"</b>)
			<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_th_walk">th_walk</a> ();
		<b>else</b>
			<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_pausetime">pausetime</a> = 99999999;
			<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_th_stand">th_stand</a> ();
	}
	<b>else</b>
	{
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_pausetime">pausetime</a> = 99999999;
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_th_stand">th_stand</a> ();
	}

⌨️ 快捷键说明

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