Player-held version of stun baton?

it doesn't exist. there's an entity for it in Hammer but if you place it it just increases the battery power thing on your HEV suit
 
I've played with the Hammer entity, and I did notice that when I picked it up, it just charged my suit. I thought I was ding something wrong. Apparently not. Okay then, I guess I get to make my own. SoftImage XSI is a good program to mod weapons, right?
 
Uh there is actually a first person model for it already, it's probably just a question of coding it in.
 
Easier done than said.

Go to HL2_Player.cpp, line 1916. There should be a function called 'Weapon_CanUse'.

Comment all of the code inside this function, except for the 'return BaseClass' one.

Stunstick is now pick-upable from Metrocops.

-Angry Lawyer
 
Cool. I'm going to get a C++ program in a few days or so, so I'll try that out. Thanks, AL.
 
Another thing you'll probably want is to make it so the Stunstick appears in Impulse 101. So, let's do that.

Line 1392 (around about), of HL2_Player.cpp, add the line 'GiveNamedItem( "weapon_stunstick" );'

Compile, and you're ready to go.

-Angry Lawyer
 
Where would I find this file? Under which file? I just got a C++ program (O.K. so maybe it was more than a few days...) and am anxious to hit something or someone with a shock stick!

Edit: Nevermind, I found it.

Edit: Comment means put the //in front of it so it is not read by the code right?

bool CHL2_Player::Weapon_CanUse( CBaseCombatWeapon *pWeapon )
{
if ( pWeapon->ClassMatches( "weapon_stunstick" ) )
{
if ( ApplyBattery( 0.5 ) )
UTIL_Remove( pWeapon );
return false;
}

return BaseClass::Weapon_CanUse( pWeapon );
}

So it should be:
bool CHL2_Player::Weapon_CanUse( CBaseCombatWeapon *pWeapon )
//{
// if ( pWeapon->ClassMatches( "weapon_stunstick" ) )
// {
// if ( ApplyBattery( 0.5 ) )
// UTIL_Remove( pWeapon );
// return false;
// }
//
return BaseClass::Weapon_CanUse( pWeapon );
}

right?
 
The last post isn't working. If that code is correct, then the code section is correct and I did something else wrong. I'm using a Dev-C++ program. I opened up the .cpp file, found weapon_canuse, editted, then compiled. I tried running, finding a stun stick and nothing happened. What happens when I compile a .cpp file? I don't think it got compile and replaced, just compiled. If that's the case, I can't figure out where the compiled file went.

Well, I'm getting really tired and kind of confused, so I think I'll go to sleep.
 
So it should be:
bool CHL2_Player::Weapon_CanUse( CBaseCombatWeapon *pWeapon )
//{
// if ( pWeapon->ClassMatches( "weapon_stunstick" ) )
// {
// if ( ApplyBattery( 0.5 ) )
// UTIL_Remove( pWeapon );
// return false;
// }
//
return BaseClass::Weapon_CanUse( pWeapon );
}

Should read

So it should be:
bool CHL2_Player::Weapon_CanUse( CBaseCombatWeapon *pWeapon )
{
// if ( pWeapon->ClassMatches( "weapon_stunstick" ) )
// {
// if ( ApplyBattery( 0.5 ) )
// UTIL_Remove( pWeapon );
// return false;
// }
//
return BaseClass::Weapon_CanUse( pWeapon );
}

Sounds like it didn't compile properly, though. What Compiler are you using?

-Angry Lawyer
 
I'm using the one in Dev-C++, and it said it compiled...I think. Well here. It said it found 494 errors. That doesn't make any sense. It obviously works (except for the stun stick) and Valve released it. So maybe the program thinks they're errors and they really aren't.

If it will help, I'll show you a screenshot.

devc5bf.jpg


if that doesnt work...

[img=http://img32.exs.cx/img32/284/devc5bf.jpg]

I hate code lol.

EDIT: Whoa, thats a big picture. Sorry :(
 
Actually, it's not compiling at all, because of the errors.

I've no idea how Dev-C++ works, but from the looks of it, it's picking up errors where MSVC++ only picks up warnings (which Valve handily swept under the carpet...)

Tell you what - do you want me to compile it for you?

The one problem is that the two c++ files add up to 10mb, and if you've got a naff mail account, it might not send. And it'll take ages to download.

Beyond that, I strongly recommend MSVC++ 2003

-Angry Lawyer
 
That'd be great. I have a Yahoo email address that can hold 250mb, so it'd would be perfect. I'll Private Message you my email address. No offense to everyone else; I can't be sure that someone else out there might spam me to death.
 
Back
Top