📄 boss.htm
字号:
};
<i>/*QUAKED monster_boss (1 0 0) (-128 -128 -24) (128 128 256)
*/</i>
<a href="qc-types.htm#void">void</a>() <b>monster_boss</b><a name="monster_boss">=</a>
{
<b>if</b> (<a href="qc-glob.htm#deathmatch">deathmatch</a>)
{
<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/boss.mdl"</b>);
<a href="qc-built.htm#precache_model">precache_model</a> (<b>"progs/lavaball.mdl"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"weapons/rocket1i.wav"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"boss1/out1.wav"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"boss1/sight1.wav"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"misc/power.wav"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"boss1/throw.wav"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"boss1/pain.wav"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"boss1/death.wav"</b>);
<a href="qc-glob.htm#total_monsters">total_monsters</a> = <a href="qc-glob.htm#total_monsters">total_monsters</a> + 1;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_use">use</a> = <a href="boss.htm#boss_awake">boss_awake</a>;
};
<i>//===========================================================================</i>
<a href="qc-types.htm#entity">entity</a> le1, le2;
<a href="qc-types.htm#float">float</a> <b><a name="lightning_end">lightning_end</a></b>;
<a href="qc-types.htm#void">void</a>() <b>lightning_fire</b><a name="lightning_fire">=</a>
{
<b>local</b> <a href="qc-types.htm#vector">vector</a> p1, p2;
<b>if</b> (<a href="qc-glob.htm#time">time</a> >= <a href="boss.htm#lightning_end">lightning_end</a>)
{ <i>// done here, put the terminals back up</i>
<a href="qc-glob.htm#self">self</a> = le1;
<a href="doors.htm#door_go_down">door_go_down</a> ();
<a href="qc-glob.htm#self">self</a> = le2;
<a href="doors.htm#door_go_down">door_go_down</a> ();
<b>return</b>;
}
p1 = (le1.<a href="qc-enty.htm#dot_mins">mins</a> + le1.<a href="qc-enty.htm#dot_maxs">maxs</a>) * 0.5;
p1_z = le1.absmin_z - 16;
p2 = (le2.<a href="qc-enty.htm#dot_mins">mins</a> + le2.<a href="qc-enty.htm#dot_maxs">maxs</a>) * 0.5;
p2_z = le2.absmin_z - 16;
<i>// compensate for length of bolt</i>
p2 = p2 - <a href="qc-built.htm#normalize">normalize</a>(p2-p1)*100;
<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="boss.htm#lightning_fire">lightning_fire</a>;
<a href="qc-netf.htm#WriteByte">WriteByte</a> (<a href="qc-net.htm#MSG_ALL">MSG_ALL</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_ALL">MSG_ALL</a>, <a href="defs.htm#TE_LIGHTNING3">TE_LIGHTNING3</a>);
<a href="qc-netf.htm#WriteEntity">WriteEntity</a> (<a href="qc-net.htm#MSG_ALL">MSG_ALL</a>, <a href="qc-glob.htm#world">world</a>);
<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_ALL">MSG_ALL</a>, p1_x);
<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_ALL">MSG_ALL</a>, p1_y);
<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_ALL">MSG_ALL</a>, p1_z);
<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_ALL">MSG_ALL</a>, p2_x);
<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_ALL">MSG_ALL</a>, p2_y);
<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_ALL">MSG_ALL</a>, p2_z);
};
<a href="qc-types.htm#void">void</a>() <b>lightning_use</b><a name="lightning_use">=</a>
{
<b>if</b> (<a href="boss.htm#lightning_end">lightning_end</a> >= <a href="qc-glob.htm#time">time</a> + 1)
<b>return</b>;
le1 = <a href="qc-built.htm#find">find</a>( <a href="qc-glob.htm#world">world</a>, target, <b>"lightning"</b>);
le2 = <a href="qc-built.htm#find">find</a>( le1, target, <b>"lightning"</b>);
<b>if</b> (!le1 || !le2)
{
<a href="qc-built.htm#dprint">dprint</a> (<b>"missing lightning targets\n"</b>);
<b>return</b>;
}
<b>if</b> (
(le1.<a href="qc-enty.htm#dot_state">state</a> != <a href="defs.htm#STATE_TOP">STATE_TOP</a> && le1.<a href="qc-enty.htm#dot_state">state</a> != <a href="defs.htm#STATE_BOTTOM">STATE_BOTTOM</a>)
|| (le2.<a href="qc-enty.htm#dot_state">state</a> != <a href="defs.htm#STATE_TOP">STATE_TOP</a> && le2.<a href="qc-enty.htm#dot_state">state</a> != <a href="defs.htm#STATE_BOTTOM">STATE_BOTTOM</a>)
|| (le1.<a href="qc-enty.htm#dot_state">state</a> != le2.<a href="qc-enty.htm#dot_state">state</a>) )
{
<i>// dprint ("not aligned\n");</i>
<b>return</b>;
}
<i>// don't let the electrodes go back up until the bolt is done</i>
le1.<a href="qc-enty.htm#dot_nextthink">nextthink</a> = -1;
le2.<a href="qc-enty.htm#dot_nextthink">nextthink</a> = -1;
<a href="boss.htm#lightning_end">lightning_end</a> = <a href="qc-glob.htm#time">time</a> + 1;
<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>"misc/power.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
<a href="boss.htm#lightning_fire">lightning_fire</a> ();
<i>// advance the boss pain if down</i>
<a href="qc-glob.htm#self">self</a> = <a href="qc-built.htm#find">find</a> (<a href="qc-glob.htm#world">world</a>, classname, <b>"monster_boss"</b>);
<b>if</b> (!<a href="qc-glob.htm#self">self</a>)
<b>return</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</a> = <a href="defs.htm#activator">activator</a>;
<b>if</b> (le1.<a href="qc-enty.htm#dot_state">state</a> == <a href="defs.htm#STATE_TOP">STATE_TOP</a> && <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_health">health</a> > 0)
{
<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>"boss1/pain.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_health">health</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_health">health</a> - 1;
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_health">health</a> >= 2)
<a href="boss.htm#boss_shocka1">boss_shocka1</a>();
<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_health">health</a> == 1)
<a href="boss.htm#boss_shockb1">boss_shockb1</a>();
<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_health">health</a> == 0)
<a href="boss.htm#boss_shockc1">boss_shockc1</a>();
}
};
<i>/*QUAKED event_lightning (0 1 1) (-16 -16 -16) (16 16 16)
Just for boss level.
*/</i>
<a href="qc-types.htm#void">void</a>() <b>event_lightning</b><a name="event_lightning">=</a>
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_use">use</a> = <a href="boss.htm#lightning_use">lightning_use</a>;
};
</pre></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -