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

📄 weapons.htm

📁 Quake 的 各 种 文 档 格 式 说 明
💻 HTM
📖 第 1 页 / 共 5 页
字号:
=================
LightningDamage
=================
*/</i>

<a href="qc-types.htm#void">void</a>(<a href="qc-types.htm#vector">vector</a> p1, <a href="qc-types.htm#vector">vector</a> p2, <a href="qc-types.htm#entity">entity</a> from, <a href="qc-types.htm#float">float</a> damage) <b>LightningDamage</b><a name="LightningDamage">=</a>
{
	<b>local</b> <a href="qc-types.htm#entity">entity</a>		e1, e2;
	<b>local</b> <a href="qc-types.htm#vector">vector</a>		f;
	
	f = p2 - p1;
	<a href="qc-built.htm#normalize">normalize</a> (f);
	f_x = 0 - f_y;
	f_y = f_x;
	f_z = 0;
	f = f*16;

	e1 = e2 = <a href="qc-glob.htm#world">world</a>;

	<a href="qc-built.htm#traceline">traceline</a> (p1, p2, <a href="defs.htm#FALSE">FALSE</a>, <a href="qc-glob.htm#self">self</a>);
	<b>if</b> (<a href="qc-built.htm#trace_ent">trace_ent</a>.<a href="qc-enty.htm#dot_takedamage">takedamage</a>)
	{
		<a href="qc-built.htm#particle">particle</a> (<a href="qc-built.htm#trace_endpos">trace_endpos</a>, '0 0 100', 225, damage*4);
		<a href="combat.htm#T_Damage">T_Damage</a> (<a href="qc-built.htm#trace_ent">trace_ent</a>, from, from, damage);
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_classname">classname</a> == <b>"player"</b>)
		{
			<b>if</b> (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_classname">classname</a> == <b>"player"</b>)
				<a href="qc-built.htm#trace_ent">trace_ent</a>.velocity_z = <a href="qc-built.htm#trace_ent">trace_ent</a>.velocity_z + 400;
		}
	}
	e1 = <a href="qc-built.htm#trace_ent">trace_ent</a>;

	<a href="qc-built.htm#traceline">traceline</a> (p1 + f, p2 + f, <a href="defs.htm#FALSE">FALSE</a>, <a href="qc-glob.htm#self">self</a>);
	<b>if</b> (<a href="qc-built.htm#trace_ent">trace_ent</a> != e1 &amp;&amp; <a href="qc-built.htm#trace_ent">trace_ent</a>.<a href="qc-enty.htm#dot_takedamage">takedamage</a>)
	{
		<a href="qc-built.htm#particle">particle</a> (<a href="qc-built.htm#trace_endpos">trace_endpos</a>, '0 0 100', 225, damage*4);
		<a href="combat.htm#T_Damage">T_Damage</a> (<a href="qc-built.htm#trace_ent">trace_ent</a>, from, from, damage);
	}
	e2 = <a href="qc-built.htm#trace_ent">trace_ent</a>;

	<a href="qc-built.htm#traceline">traceline</a> (p1 - f, p2 - f, <a href="defs.htm#FALSE">FALSE</a>, <a href="qc-glob.htm#self">self</a>);
	<b>if</b> (<a href="qc-built.htm#trace_ent">trace_ent</a> != e1 &amp;&amp; <a href="qc-built.htm#trace_ent">trace_ent</a> != e2 &amp;&amp; <a href="qc-built.htm#trace_ent">trace_ent</a>.<a href="qc-enty.htm#dot_takedamage">takedamage</a>)
	{
		<a href="qc-built.htm#particle">particle</a> (<a href="qc-built.htm#trace_endpos">trace_endpos</a>, '0 0 100', 225, damage*4);
		<a href="combat.htm#T_Damage">T_Damage</a> (<a href="qc-built.htm#trace_ent">trace_ent</a>, from, from, damage);
	}
};


<a href="qc-types.htm#void">void</a>() <b>W_FireLightning</b><a name="W_FireLightning">=</a>
{
	<b>local</b>	<a href="qc-types.htm#vector">vector</a>		org;

	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_cells">ammo_cells</a> &lt; 1)
	{
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> = <a href="weapons.htm#W_BestWeapon">W_BestWeapon</a> ();
		<a href="weapons.htm#W_SetCurrentAmmo">W_SetCurrentAmmo</a> ();
		<b>return</b>;
	}

<i>// explode if under water</i>
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_waterlevel">waterlevel</a> &gt; 1)
	{
		<a href="combat.htm#T_RadiusDamage">T_RadiusDamage</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-glob.htm#self">self</a>, 35*<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_cells">ammo_cells</a>, <a href="qc-glob.htm#world">world</a>);
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_cells">ammo_cells</a> = 0;
		<a href="weapons.htm#W_SetCurrentAmmo">W_SetCurrentAmmo</a> ();
		<b>return</b>;
	}

	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_t_width">t_width</a> &lt; <a href="qc-glob.htm#time">time</a>)
	{
		<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>"weapons/lhit.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_t_width">t_width</a> = <a href="qc-glob.htm#time">time</a> + 0.6;
	}
	<a href="qc-glob.htm#self">self</a>.punchangle_x = -2;

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_currentammo">currentammo</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_cells">ammo_cells</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_cells">ammo_cells</a> - 1;

	org = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a> + '0 0 16';
	
	<a href="qc-built.htm#traceline">traceline</a> (org, org + <a href="qc-built.htm#v_forward">v_forward</a>*600, <a href="defs.htm#TRUE">TRUE</a>, <a href="qc-glob.htm#self">self</a>);

	<a href="qc-netf.htm#WriteByte">WriteByte</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="qc-net.htm#SVC_TEMPENTITY">SVC_TEMPENTITY</a>);
	<a href="qc-netf.htm#WriteByte">WriteByte</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="defs.htm#TE_LIGHTNING2">TE_LIGHTNING2</a>);
	<a href="qc-netf.htm#WriteEntity">WriteEntity</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="qc-glob.htm#self">self</a>);
	<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, org_x);
	<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, org_y);
	<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, org_z);
	<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, trace_endpos_x);
	<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, trace_endpos_y);
	<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, trace_endpos_z);

	<a href="weapons.htm#LightningDamage">LightningDamage</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a>, <a href="qc-built.htm#trace_endpos">trace_endpos</a> + <a href="qc-built.htm#v_forward">v_forward</a>*4, <a href="qc-glob.htm#self">self</a>, 30);
};


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


<a href="qc-types.htm#void">void</a>() <b>GrenadeExplode</b><a name="GrenadeExplode">=</a>
{
	<a href="combat.htm#T_RadiusDamage">T_RadiusDamage</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_owner">owner</a>, 120, <a href="qc-glob.htm#world">world</a>);

	<a href="qc-netf.htm#WriteByte">WriteByte</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="qc-net.htm#SVC_TEMPENTITY">SVC_TEMPENTITY</a>);
	<a href="qc-netf.htm#WriteByte">WriteByte</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="defs.htm#TE_EXPLOSION">TE_EXPLOSION</a>);
	<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin_x">origin_x</a>);
	<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin_y">origin_y</a>);
	<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin_z">origin_z</a>);

	<a href="weapons.htm#BecomeExplosion">BecomeExplosion</a> ();
};

<a href="qc-types.htm#void">void</a>() <b>GrenadeTouch</b><a name="GrenadeTouch">=</a>
{
	<b>if</b> (<a href="qc-glob.htm#other">other</a> == <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_owner">owner</a>)
		<b>return</b>;		<i>// don't explode on owner</i>
	<b>if</b> (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_takedamage">takedamage</a> == <a href="qc-defs.htm#DAMAGE_AIM">DAMAGE_AIM</a>)
	{
		<a href="weapons.htm#GrenadeExplode">GrenadeExplode</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>"weapons/bounce.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);	<i>// bounce sound</i>
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_velocity">velocity</a> == '0 0 0')
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_avelocity">avelocity</a> = '0 0 0';
};

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

<a href="qc-types.htm#void">void</a>() <b>W_FireGrenade</b><a name="W_FireGrenade">=</a>
{
	<b>local</b>	<a href="qc-types.htm#entity">entity</a> missile, mpuff;
	
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_currentammo">currentammo</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_rockets">ammo_rockets</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_rockets">ammo_rockets</a> - 1;
	
	<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>"weapons/grenade.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);

	<a href="qc-glob.htm#self">self</a>.punchangle_x = -2;

	missile = <a href="qc-built.htm#spawn">spawn</a> ();
	missile.<a href="qc-enty.htm#dot_owner">owner</a> = <a href="qc-glob.htm#self">self</a>;
	missile.<a href="qc-enty.htm#dot_movetype">movetype</a> = <a href="qc-defs.htm#MOVETYPE_BOUNCE">MOVETYPE_BOUNCE</a>;
	missile.<a href="qc-enty.htm#dot_solid">solid</a> = <a href="qc-defs.htm#SOLID_BBOX">SOLID_BBOX</a>;
	missile.<a href="qc-enty.htm#dot_classname">classname</a> = <b>"grenade"</b>;
		
<i>// set missile speed	</i>

	<a href="qc-built.htm#makevectors">makevectors</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_v_angle">v_angle</a>);

	<b>if</b> (<a href="qc-glob.htm#self">self</a>.v_angle_x)
		missile.<a href="qc-enty.htm#dot_velocity">velocity</a> = <a href="qc-built.htm#v_forward">v_forward</a>*600 + <a href="qc-built.htm#v_up">v_up</a> * 200 + <a href="weapons.htm#crandom">crandom</a>()*<a href="qc-built.htm#v_right">v_right</a>*10 + <a href="weapons.htm#crandom">crandom</a>()*<a href="qc-built.htm#v_up">v_up</a>*10;
	<b>else</b>
	{
		missile.<a href="qc-enty.htm#dot_velocity">velocity</a> = <a href="qc-built.htm#aim">aim</a>(<a href="qc-glob.htm#self">self</a>, 10000);
		missile.<a href="qc-enty.htm#dot_velocity">velocity</a> = missile.<a href="qc-enty.htm#dot_velocity">velocity</a> * 600;
		missile.velocity_z = 200;
	}

	missile.<a href="qc-enty.htm#dot_avelocity">avelocity</a> = '300 300 300';

	missile.<a href="qc-enty.htm#dot_angles">angles</a> = <a href="qc-built.htm#vectoangles">vectoangles</a>(missile.<a href="qc-enty.htm#dot_velocity">velocity</a>);
	
	missile.<a href="qc-enty.htm#dot_touch">touch</a> = <a href="weapons.htm#GrenadeTouch">GrenadeTouch</a>;
	
<i>// set missile duration</i>
	missile.<a href="qc-enty.htm#dot_nextthink">nextthink</a> = <a href="qc-glob.htm#time">time</a> + 2.5;
	missile.<a href="qc-enty.htm#dot_think">think</a> = <a href="weapons.htm#GrenadeExplode">GrenadeExplode</a>;

	<a href="qc-built.htm#setmodel">setmodel</a> (missile, <b>"progs/grenade.mdl"</b>);
	<a href="qc-built.htm#setsize">setsize</a> (missile, '0 0 0', '0 0 0');		
	<a href="qc-built.htm#setorigin">setorigin</a> (missile, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a>);
};


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

<a href="qc-types.htm#void">void</a>() <a href="weapons.htm#spike_touch">spike_touch</a>;
<a href="qc-types.htm#void">void</a>() <a href="weapons.htm#superspike_touch">superspike_touch</a>;


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

Used for both the player and the ogre
===============
*/</i>

<a href="qc-types.htm#void">void</a>(<a href="qc-types.htm#vector">vector</a> org, <a href="qc-types.htm#vector">vector</a> dir) <b>launch_spike</b><a name="launch_spike">=</a>
{
	<a href="defs.htm#newmis">newmis</a> = <a href="qc-built.htm#spawn">spawn</a> ();
	<a href="defs.htm#newmis">newmis</a>.<a href="qc-enty.htm#dot_owner">owner</a> = <a href="qc-glob.htm#self">self</a>;
	<a href="defs.htm#newmis">newmis</a>.<a href="qc-enty.htm#dot_movetype">movetype</a> = <a href="qc-defs.htm#MOVETYPE_FLYMISSILE">MOVETYPE_FLYMISSILE</a>;
	<a href="defs.htm#newmis">newmis</a>.<a href="qc-enty.htm#dot_solid">solid</a> = <a href="qc-defs.htm#SOLID_BBOX">SOLID_BBOX</a>;

	<a href="defs.htm#newmis">newmis</a>.<a href="qc-enty.htm#dot_angles">angles</a> = <a href="qc-built.htm#vectoangles">vectoangles</a>(dir);
	
	<a href="defs.htm#newmis">newmis</a>.<a href="qc-enty.htm#dot_touch">touch</a> = <a href="weapons.htm#spike_touch">spike_touch</a>;
	<a href="defs.htm#newmis">newmis</a>.<a href="qc-enty.htm#dot_classname">classname</a> = <b>"spike"</b>;
	<a href="defs.htm#newmis">newmis</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="subs.htm#SUB_Remove">SUB_Remove</a>;
	<a href="defs.htm#newmis">newmis</a>.<a href="qc-enty.htm#dot_nextthink">nextthink</a> = <a href="qc-glob.htm#time">time</a> + 6;
	<a href="qc-built.htm#setmodel">setmodel</a> (<a href="defs.htm#newmis">newmis</a>, <b>"progs/spike.mdl"</b>);
	<a href="qc-built.htm#setsize">setsize</a> (<a href="defs.htm#newmis">newmis</a>, <a href="defs.htm#VEC_ORIGIN">VEC_ORIGIN</a>, <a href="defs.htm#VEC_ORIGIN">VEC_ORIGIN</a>);		
	<a href="qc-built.htm#setorigin">setorigin</a> (<a href="defs.htm#newmis">newmis</a>, org);

	<a href="defs.htm#newmis">newmis</a>.<a href="qc-enty.htm#dot_velocity">velocity</a> = dir * 1000;
};

<a href="qc-types.htm#void">void</a>() <b>W_FireSuperSpikes</b><a name="W_FireSuperSpikes">=</a>
{
	<b>local</b> <a href="qc-types.htm#vector">vector</a>	dir;
	<b>local</b> <a href="qc-types.htm#entity">entity</a>	old;
	

⌨️ 快捷键说明

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