Player weaponstrip (GoldSrc): Difference between revisions
Speedvoltage (talk | contribs) No edit summary |
m (moved bug description) |
||
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. | ||
==Ammo HUD bug fix== | |||
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 your game has public code. | |||
Open Ammo.cpp and find the following: | Open Ammo.cpp and find the following: | ||
Line 71: | Line 70: | ||
Now compile and you are ready to go! | Now compile and you are ready to go! | ||
== | |||
[[Category:Half-Life | ==Keyvalues== | ||
{{Hl1 kv targetname}} | |||
[[Category:Half-Life entities]] | |||
[[Category:Level Design]] | [[Category:Level Design]] |
Revision as of 09:26, 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 bug fix
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 your game has public code.
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.