Player weaponstrip (GoldSrc): Difference between revisions
Speedvoltage (talk | contribs) mNo edit summary |
Speedvoltage (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
{{Hl1 series point|player_weaponstrip}} 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. | {{Hl1 series point|player_weaponstrip}} 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. | ||
{{bug|A small bug 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 | {{bug|A small bug 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.}} | ||
==Ammo HUD Fix== | |||
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! | |||
==Flags== | ==Flags== | ||
[[Category:Half-Life Entities]] | [[Category:Half-Life Entities]] | ||
[[Category:Level Design]] | [[Category:Level Design]] |
Revision as of 01:05, 21 November 2018
Template:Hl1 series point 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 Fix
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!