Player weaponstrip (GoldSrc): Difference between revisions
Dr. Orange (talk | contribs) (Created page with "{{stub}} Player_weaponstrip will remove all the weapons the player have when triggered, but will not remove an item_suit. Used in the trash c...") |
m (Changed parameters of {{this is a}} to comply with the updated version. This action was performed by a bot.) |
||
(22 intermediate revisions by 10 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{tabs|player_weaponstrip|goldsrc=1|source=1|main=source}} | ||
{{this is a|point entity|name=player_weaponstrip|engine=GoldSrc|game=Half-Life|game1=Half-Life: Opposing Force|game2=Half-Life: Blue Shift|game3=Cry of Fear}} It will take away(strip) all of the player's weapons. The only times the player_weaponstrip entity is used in Half-Life is in the chapter Apprehension, and at the end of the chapter Nihilanth; in Opposing Force, at the very end after killing the final boss, and in Blue Shift, after entering the final teleporter to escape Black Mesa. The player_weaponstrip, as its name implies, only strips the player's weapons, any other items, primarily the player's [[item suit (GoldSource Engine)|HEV Suit]], will not be removed. | |||
==Ammo HUD Bug Fix== | |||
A small bug that occurs in the official game, as well as the expansions and many mods, is that the ammo information on your HUD does not get removed, only changing the ammo pool to 0 and leaving you with the number of bullets that were in your magazine before the strip. The following fix can be applied if you work on a GoldSrc modification using the Half-Life SDK provided by Valve on [https://github.com/ValveSoftware/halflife Github]. | |||
Open Ammo.cpp and find the following: | |||
<source lang="cpp">if ( iId < 1 ) | |||
{ | |||
SetCrosshair(0, nullrc, 0, 0, 0); | |||
return 0; | |||
}</source> | |||
Add the following line of code: | |||
<source lang="cpp">if ( iId < 1 ) | |||
{ | |||
SetCrosshair(0, nullrc, 0, 0, 0); | |||
m_pWeapon = NULL; //Remove Ammo HUD if weapons are removed | |||
return 0; | |||
}</source> | |||
Scroll a little lower and find this block of code: | |||
<source lang="cpp">if ( gHUD.m_iFOV >= 90 ) | |||
{ // normal crosshairs | |||
if (fOnTarget && m_pWeapon->hAutoaim) | |||
SetCrosshair(m_pWeapon->hAutoaim, m_pWeapon->rcAutoaim, 255, 255, 255); | |||
else | |||
SetCrosshair(m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255); | |||
} | |||
else | |||
{ // zoomed crosshairs | |||
if (fOnTarget && m_pWeapon->hZoomedAutoaim) | |||
SetCrosshair(m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255); | |||
else | |||
SetCrosshair(m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255); | |||
}</source> | |||
Replace that with the following: | |||
<source lang="cpp">if ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_CUSTOMCROSSHAIR )) | |||
{ | |||
WEAPON *ccWeapon = gWR.GetWeapon(7); | |||
SetCrosshair(ccWeapon->hCrosshair, ccWeapon->rcCrosshair, 255, 255, 255); | |||
} | |||
else if ( !(gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )) ) | |||
{ | |||
if ( gHUD.m_iFOV >= 90 ) | |||
{ // normal crosshairs | |||
if (fOnTarget && m_pWeapon->hAutoaim) | |||
SetCrosshair(m_pWeapon->hAutoaim, m_pWeapon->rcAutoaim, 255, 255, 255); | |||
else | |||
SetCrosshair(m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255); | |||
} | |||
else | |||
{ // zoomed crosshairs | |||
if (fOnTarget && m_pWeapon->hZoomedAutoaim) | |||
SetCrosshair(m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255); | |||
else | |||
SetCrosshair(m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255); | |||
} | |||
}</source> | |||
If you try to compile your code at this point, you will only see an error. That's because we added a new identifier called<code>HIDEHUD_CUSTOMCROSSHAIR</code>, but this is undefined! Open<code>cdll_dll.h</code> and add the following under<code>#define HIDEHUD_HEALTH ( 1<<3 )</code>: | |||
<source lang="cpp"> | |||
#define HIDEHUD_CUSTOMCROSSHAIR ( 1<<4 ) | |||
</source> | |||
Now compile and you are ready to go! | |||
==Keyvalues== | |||
{{Hl1 kv targetname}} | |||
[[Category:Half-Life entities]] | |||
[[Category:Level Design]] |
Latest revision as of 18:49, 17 May 2024
player_weaponstrip
is a point entity available in Half-Life,
Half-Life: Opposing Force,
Half-Life: Blue Shift, and
Cry of Fear. It will take away(strip) all of the player's weapons. The only times the player_weaponstrip entity is used in Half-Life is in the chapter Apprehension, and at the end of the chapter Nihilanth; in Opposing Force, at the very end after killing the final boss, and in Blue Shift, after entering the final teleporter to escape Black Mesa. The player_weaponstrip, as its name implies, only strips the player's weapons, any other items, primarily the player's HEV Suit, will not be removed.
Ammo HUD Bug Fix
A small bug that occurs in the official game, as well as the expansions and many mods, is that the ammo information on your HUD does not get removed, only changing the ammo pool to 0 and leaving you with the number of bullets that were in your magazine before the strip. The following fix can be applied if you work on a GoldSrc modification using the Half-Life SDK provided by Valve on Github.
Open Ammo.cpp and find the following:
if ( iId < 1 )
{
SetCrosshair(0, nullrc, 0, 0, 0);
return 0;
}
Add the following line of code:
if ( iId < 1 )
{
SetCrosshair(0, nullrc, 0, 0, 0);
m_pWeapon = NULL; //Remove Ammo HUD if weapons are removed
return 0;
}
Scroll a little lower and find this block of code:
if ( gHUD.m_iFOV >= 90 )
{ // normal crosshairs
if (fOnTarget && m_pWeapon->hAutoaim)
SetCrosshair(m_pWeapon->hAutoaim, m_pWeapon->rcAutoaim, 255, 255, 255);
else
SetCrosshair(m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255);
}
else
{ // zoomed crosshairs
if (fOnTarget && m_pWeapon->hZoomedAutoaim)
SetCrosshair(m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255);
else
SetCrosshair(m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255);
}
Replace that with the following:
if ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_CUSTOMCROSSHAIR ))
{
WEAPON *ccWeapon = gWR.GetWeapon(7);
SetCrosshair(ccWeapon->hCrosshair, ccWeapon->rcCrosshair, 255, 255, 255);
}
else if ( !(gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )) )
{
if ( gHUD.m_iFOV >= 90 )
{ // normal crosshairs
if (fOnTarget && m_pWeapon->hAutoaim)
SetCrosshair(m_pWeapon->hAutoaim, m_pWeapon->rcAutoaim, 255, 255, 255);
else
SetCrosshair(m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255);
}
else
{ // zoomed crosshairs
if (fOnTarget && m_pWeapon->hZoomedAutoaim)
SetCrosshair(m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255);
else
SetCrosshair(m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255);
}
}
If you try to compile your code at this point, you will only see an error. That's because we added a new identifier calledHIDEHUD_CUSTOMCROSSHAIR
, but this is undefined! Opencdll_dll.h
and add the following under#define HIDEHUD_HEALTH ( 1<<3 )
:
#define HIDEHUD_CUSTOMCROSSHAIR ( 1<<4 )
Now compile and you are ready to go!
Keyvalues
- Name (targetname) <string>
- The targetname that other entities refer to this entity by.
- Point entities
- Non-internal Half-Life entities
- Half-Life entities
- Half-Life point entities
- Non-internal Half-Life: Opposing Force entities
- Half-Life: Opposing Force entities
- Half-Life: Opposing Force point entities
- Non-internal Half-Life: Blue Shift entities
- Half-Life: Blue Shift entities
- Half-Life: Blue Shift point entities
- Non-internal Cry of Fear entities
- Cry of Fear entities
- Cry of Fear point entities
- Non-internal GoldSrc base entities
- GoldSrc base entities
- GoldSrc base point entities
- Level Design