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

📄 weapons.htm

📁 Quake 的 各 种 文 档 格 式 说 明
💻 HTM
📖 第 1 页 / 共 5 页
字号:
	else if(self.ammo_rockets >= 1 && (it & IT_GRENADE_LAUNCHER) )
		return IT_GRENADE_LAUNCHER;

*/</i>


	return IT_AXE;
};

<a href="qc-types.htm#float">float</a>() <b>W_CheckNoAmmo</b><a name="W_CheckNoAmmo">=</a>
{
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_currentammo">currentammo</a> &gt; 0)
		return TRUE;

	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_AXE">IT_AXE</a>)
		return TRUE;
	
	<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> ();
	
<i>// drop the weapon down</i>
	return FALSE;
};

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

An attack impulse can be triggered now
============
*/</i>

<a href="qc-types.htm#void">void</a>() <a href="player.htm#player_axe1">player_axe1</a>;
<a href="qc-types.htm#void">void</a>() <a href="player.htm#player_axeb1">player_axeb1</a>;
<a href="qc-types.htm#void">void</a>() <a href="player.htm#player_axec1">player_axec1</a>;
<a href="qc-types.htm#void">void</a>() <a href="player.htm#player_axed1">player_axed1</a>;
<a href="qc-types.htm#void">void</a>() <a href="player.htm#player_shot1">player_shot1</a>;
<a href="qc-types.htm#void">void</a>() <a href="player.htm#player_nail1">player_nail1</a>;
<a href="qc-types.htm#void">void</a>() <a href="player.htm#player_light1">player_light1</a>;
<a href="qc-types.htm#void">void</a>() <a href="player.htm#player_rocket1">player_rocket1</a>;

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

	<b>if</b> (!<a href="weapons.htm#W_CheckNoAmmo">W_CheckNoAmmo</a> ())
		<b>return</b>;

	<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>);			<i>// calculate forward angle for velocity</i>
	<a href="qc-glob.htm#self">self</a>.show_hostile = <a href="qc-glob.htm#time">time</a> + 1;	<i>// wake monsters up</i>

	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_AXE">IT_AXE</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/ax1.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
		r = <a href="qc-built.htm#random">random</a>();
		<b>if</b> (r &lt; 0.25)
			<a href="player.htm#player_axe1">player_axe1</a> ();
		<b>else</b> <b>if</b> (r&lt;0.5)
			<a href="player.htm#player_axeb1">player_axeb1</a> ();
		<b>else</b> <b>if</b> (r&lt;0.75)
			<a href="player.htm#player_axec1">player_axec1</a> ();
		<b>else</b>
			<a href="player.htm#player_axed1">player_axed1</a> ();
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_finished">attack_finished</a> = <a href="qc-glob.htm#time">time</a> + 0.5;
	}
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_SHOTGUN">IT_SHOTGUN</a>)
	{
		<a href="player.htm#player_shot1">player_shot1</a> ();
		<a href="weapons.htm#W_FireShotgun">W_FireShotgun</a> ();
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_finished">attack_finished</a> = <a href="qc-glob.htm#time">time</a> + 0.5;
	}
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_SUPER_SHOTGUN">IT_SUPER_SHOTGUN</a>)
	{
		<a href="player.htm#player_shot1">player_shot1</a> ();
		<a href="weapons.htm#W_FireSuperShotgun">W_FireSuperShotgun</a> ();
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_finished">attack_finished</a> = <a href="qc-glob.htm#time">time</a> + 0.7;
	}
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_NAILGUN">IT_NAILGUN</a>)
	{
		<a href="player.htm#player_nail1">player_nail1</a> ();
	}
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_SUPER_NAILGUN">IT_SUPER_NAILGUN</a>)
	{
		<a href="player.htm#player_nail1">player_nail1</a> ();
	}
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_GRENADE_LAUNCHER">IT_GRENADE_LAUNCHER</a>)
	{
		<a href="player.htm#player_rocket1">player_rocket1</a>();
		<a href="weapons.htm#W_FireGrenade">W_FireGrenade</a>();
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_finished">attack_finished</a> = <a href="qc-glob.htm#time">time</a> + 0.6;
	}
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_ROCKET_LAUNCHER">IT_ROCKET_LAUNCHER</a>)
	{
		<a href="player.htm#player_rocket1">player_rocket1</a>();
		<a href="weapons.htm#W_FireRocket">W_FireRocket</a>();
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_finished">attack_finished</a> = <a href="qc-glob.htm#time">time</a> + 0.8;
	}
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_LIGHTNING">IT_LIGHTNING</a>)
	{
		<a href="player.htm#player_light1">player_light1</a>();
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_finished">attack_finished</a> = <a href="qc-glob.htm#time">time</a> + 0.1;
		<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_AUTO">CHAN_AUTO</a>, <b>"weapons/lstart.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
	}
};

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

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

<a href="qc-types.htm#void">void</a>() <b>W_ChangeWeapon</b><a name="W_ChangeWeapon">=</a>
{
	<b>local</b>	<a href="qc-types.htm#float">float</a>	it, am, fl;
	
	it = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a>;
	am = 0;
	
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_impulse">impulse</a> == 1)
	{
		fl = <a href="qc-defs.htm#IT_AXE">IT_AXE</a>;
	}
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_impulse">impulse</a> == 2)
	{
		fl = <a href="qc-defs.htm#IT_SHOTGUN">IT_SHOTGUN</a>;
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_shells">ammo_shells</a> &lt; 1)
			am = 1;
	}
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_impulse">impulse</a> == 3)
	{
		fl = <a href="qc-defs.htm#IT_SUPER_SHOTGUN">IT_SUPER_SHOTGUN</a>;
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_shells">ammo_shells</a> &lt; 2)
			am = 1;
	}		
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_impulse">impulse</a> == 4)
	{
		fl = <a href="qc-defs.htm#IT_NAILGUN">IT_NAILGUN</a>;
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> &lt; 1)
			am = 1;
	}
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_impulse">impulse</a> == 5)
	{
		fl = <a href="qc-defs.htm#IT_SUPER_NAILGUN">IT_SUPER_NAILGUN</a>;
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> &lt; 2)
			am = 1;
	}
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_impulse">impulse</a> == 6)
	{
		fl = <a href="qc-defs.htm#IT_GRENADE_LAUNCHER">IT_GRENADE_LAUNCHER</a>;
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_rockets">ammo_rockets</a> &lt; 1)
			am = 1;
	}
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_impulse">impulse</a> == 7)
	{
		fl = <a href="qc-defs.htm#IT_ROCKET_LAUNCHER">IT_ROCKET_LAUNCHER</a>;
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_rockets">ammo_rockets</a> &lt; 1)
			am = 1;
	}
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_impulse">impulse</a> == 8)
	{
		fl = <a href="qc-defs.htm#IT_LIGHTNING">IT_LIGHTNING</a>;
		<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_cells">ammo_cells</a> &lt; 1)
			am = 1;
	}

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_impulse">impulse</a> = 0;
	
	<b>if</b> (!(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> &amp; fl))
	{	<i>// don't have the weapon or the ammo</i>
		<a href="qc-built.htm#sprint">sprint</a> (<a href="qc-glob.htm#self">self</a>, <b>"no weapon.\n"</b>);
		<b>return</b>;
	}
	
	<b>if</b> (am)
	{	<i>// don't have the ammo</i>
		<a href="qc-built.htm#sprint">sprint</a> (<a href="qc-glob.htm#self">self</a>, <b>"not enough ammo.\n"</b>);
		<b>return</b>;
	}

<i>//</i>
<i>// set weapon, set ammo</i>
<i>//</i>
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> = fl;		
	<a href="weapons.htm#W_SetCurrentAmmo">W_SetCurrentAmmo</a> ();
};

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

<a href="qc-types.htm#void">void</a>() <b>CheatCommand</b><a name="CheatCommand">=</a>
{
	<b>if</b> (<a href="qc-glob.htm#deathmatch">deathmatch</a> || <a href="qc-glob.htm#coop">coop</a>)
		<b>return</b>;

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_rockets">ammo_rockets</a> = 100;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> = 200;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_shells">ammo_shells</a> = 100;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> | 
		<a href="qc-defs.htm#IT_AXE">IT_AXE</a> |
		<a href="qc-defs.htm#IT_SHOTGUN">IT_SHOTGUN</a> |
		<a href="qc-defs.htm#IT_SUPER_SHOTGUN">IT_SUPER_SHOTGUN</a> |
		<a href="qc-defs.htm#IT_NAILGUN">IT_NAILGUN</a> |
		<a href="qc-defs.htm#IT_SUPER_NAILGUN">IT_SUPER_NAILGUN</a> |
		<a href="qc-defs.htm#IT_GRENADE_LAUNCHER">IT_GRENADE_LAUNCHER</a> |
		<a href="qc-defs.htm#IT_ROCKET_LAUNCHER">IT_ROCKET_LAUNCHER</a> |
		<a href="qc-defs.htm#IT_KEY1">IT_KEY1</a> | <a href="qc-defs.htm#IT_KEY2">IT_KEY2</a>;

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_cells">ammo_cells</a> = 200;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items"

⌨️ 快捷键说明

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