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

📄 demon.htm

📁 Quake 的 各 种 文 档 格 式 说 明
💻 HTM
📖 第 1 页 / 共 2 页
字号:
	{
		<a href="qc-built.htm#remove">remove</a>(<a href="qc-glob.htm#self">self</a>);
		<b>return</b>;
	}
	<a href="qc-built.htm#precache_model">precache_model</a> (<b>"progs/demon.mdl"</b>);
	<a href="qc-built.htm#precache_model">precache_model</a> (<b>"progs/h_demon.mdl"</b>);

	<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"demon/ddeath.wav"</b>);
	<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"demon/dhit2.wav"</b>);
	<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"demon/djump.wav"</b>);
	<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"demon/dpain1.wav"</b>);
	<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"demon/idle1.wav"</b>);
	<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"demon/sight2.wav"</b>);

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_solid">solid</a> = <a href="qc-defs.htm#SOLID_SLIDEBOX">SOLID_SLIDEBOX</a>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_movetype">movetype</a> = <a href="qc-defs.htm#MOVETYPE_STEP">MOVETYPE_STEP</a>;

	<a href="qc-built.htm#setmodel">setmodel</a> (<a href="qc-glob.htm#self">self</a>, <b>"progs/demon.mdl"</b>);

	<a href="qc-built.htm#setsize">setsize</a> (<a href="qc-glob.htm#self">self</a>, <a href="defs.htm#VEC_HULL2_MIN">VEC_HULL2_MIN</a>, <a href="defs.htm#VEC_HULL2_MAX">VEC_HULL2_MAX</a>);
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_health">health</a> = 300;

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_th_stand">th_stand</a> = <a href="demon.htm#demon1_stand1">demon1_stand1</a>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_th_walk">th_walk</a> = <a href="demon.htm#demon1_walk1">demon1_walk1</a>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_th_run">th_run</a> = <a href="demon.htm#demon1_run1">demon1_run1</a>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_th_die">th_die</a> = <a href="demon.htm#demon_die">demon_die</a>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_th_melee">th_melee</a> = <a href="demon.htm#Demon_MeleeAttack">Demon_MeleeAttack</a>;		<i>// one of two attacks</i>
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_th_missile">th_missile</a> = <a href="demon.htm#demon1_jump1">demon1_jump1</a>;			<i>// jump attack</i>
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_th_pain">th_pain</a> = <a href="demon.htm#demon1_pain">demon1_pain</a>;
		
	<a href="monsters.htm#walkmonster_start">walkmonster_start</a>();
};


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

DEMON

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


<i>/*
==============
CheckDemonMelee

Returns TRUE if a melee attack would hit right now
==============
*/</i>

<a href="qc-types.htm#float">float</a>() <b>CheckDemonMelee</b><a name="CheckDemonMelee">=</a>
{
	<b>if</b> (enemy_range == <a href="defs.htm#RANGE_MELEE">RANGE_MELEE</a>)
	{	<i>// FIXME: check canreach</i>
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_state">attack_state</a> = <a href="defs.htm#AS_MELEE">AS_MELEE</a>;
		return TRUE;
	}
	return FALSE;
};

<i>/*
==============
CheckDemonJump

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

<a href="qc-types.htm#float">float</a>() <b>CheckDemonJump</b><a name="CheckDemonJump">=</a>
{
	<b>local</b>	<a href="qc-types.htm#vector">vector</a>	dist;
	<b>local</b>	<a href="qc-types.htm#float">float</a>	d;

	<b>if</b> (<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>.mins_z &gt; <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</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_enemy">enemy</a>.mins_z
	+ 0.75 * <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</a>.<a href="qc-enty.htm#dot_size_z">size_z</a>)
		return FALSE;
		
	<b>if</b> (<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>.maxs_z &lt; <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</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_enemy">enemy</a>.mins_z
	+ 0.25 * <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</a>.<a href="qc-enty.htm#dot_size_z">size_z</a>)
		return FALSE;
		
	dist = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</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>;
	dist_z = 0;
	
	d = <a href="qc-built.htm#vlen">vlen</a>(dist);
	
	<b>if</b> (d &lt; 100)
		return FALSE;
		
	<b>if</b> (d &gt; 200)
	{
		<b>if</b> (<a href="qc-built.htm#random">random</a>() &lt; 0.9)
			return FALSE;
	}
		
	return TRUE;
};

<a href="qc-types.htm#float">float</a>() <b>DemonCheckAttack</b><a name="DemonCheckAttack">=</a>
{
	<b>local</b>	<a href="qc-types.htm#vector">vector</a>	vec;
	
<i>// if close enough for slashing, go for it</i>
	<b>if</b> (<a href="demon.htm#CheckDemonMelee">CheckDemonMelee</a> ())
	{
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_state">attack_state</a> = <a href="defs.htm#AS_MELEE">AS_MELEE</a>;
		return TRUE;
	}
	
	<b>if</b> (<a href="demon.htm#CheckDemonJump">CheckDemonJump</a> ())
	{
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_state">attack_state</a> = <a href="defs.htm#AS_MISSILE">AS_MISSILE</a>;
        <a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_VOICE">CHAN_VOICE</a>, <b>"demon/djump.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
		return TRUE;
	}
	
	return FALSE;
};


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

<a href="qc-types.htm#void">void</a>(<a href="qc-types.htm#float">float</a> side) <b>Demon_Melee</b><a name="Demon_Melee">=</a>
{
	<b>local</b>	<a href="qc-types.htm#float">float</a>	ldmg;
	<b>local</b> <a href="qc-types.htm#vector">vector</a>	delta;
	
	<a href="fight.htm#ai_face">ai_face</a> ();
	<a href="qc-built.htm#walkmove">walkmove</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ideal_yaw">ideal_yaw</a>, 12);	<i>// allow a little closing</i>

	delta = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</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-built.htm#vlen">vlen</a>(delta) &gt; 100)
		<b>return</b>;
	<b>if</b> (!<a href="combat.htm#CanDamage">CanDamage</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</a>, <a href="qc-glob.htm#self">self</a>))
		<b>return</b>;
		
    <a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_WEAPON">CHAN_WEAPON</a>, <b>"demon/dhit2.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
	ldmg = 10 + 5*<a href="qc-built.htm#random">random</a>();
	<a href="combat.htm#T_Damage">T_Damage</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</a>, <a href="qc-glob.htm#self">self</a>, <a href="qc-glob.htm#self">self</a>, ldmg);	

	<a href="qc-built.htm#makevectors">makevectors</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_angles">angles</a>);
	<a href="weapons.htm#SpawnMeatSpray">SpawnMeatSpray</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a> + <a href="qc-built.htm#v_forward">v_forward</a>*16, side * <a href="qc-built.htm#v_right">v_right</a>);
};


<a href="qc-types.htm#void">void</a>() <b>Demon_JumpTouch</b><a name="Demon_JumpTouch">=</a>
{
	<b>local</b>	<a href="qc-types.htm#float">float</a>	ldmg;

	<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="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_takedamage">takedamage</a>)
	{
		<b>if</b> ( <a href="qc-built.htm#vlen">vlen</a>(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_velocity">velocity</a>) &gt; 400 )
		{
			ldmg = 40 + 10*<a href="qc-built.htm#random">random</a>();
			<a href="combat.htm#T_Damage">T_Damage</a> (<a href="qc-glob.htm#other">other</a>, <a href="qc-glob.htm#self">self</a>, <a href="qc-glob.htm#self">self</a>, ldmg);	
		}
	}

	<b>if</b> (!<a href="qc-built.htm#checkbottom">checkbottom</a>(<a href="qc-glob.htm#self">self</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_ONGROUND">FL_ONGROUND</a>)
		{	<i>// jump randomly to not get hung up</i>
<i>//dprint ("popjump\n");</i>
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_touch">touch</a> = <a href="subs.htm#SUB_Null">SUB_Null</a>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="demon.htm#demon1_jump1">demon1_jump1</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;

<i>//			self.velocity_x = (random() - 0.5) * 600;</i>
<i>//			self.velocity_y = (random() - 0.5) * 600;</i>
<i>//			self.velocity_z = 200;</i>
<i>//			self.flags = self.flags - FL_ONGROUND;</i>
		}
		<b>return</b>;	<i>// not on ground yet</i>
	}

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_touch">touch</a> = <a href="subs.htm#SUB_Null">SUB_Null</a>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="demon.htm#demon1_jump11">demon1_jump11</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;
};


</pre></body></html>

⌨️ 快捷键说明

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