Well that's how the other file did it, but it had a while loop as well, 
adding that fixed it but I dont think ill get the wanted effect through 
that anyway!

Think I finally got it though, trying something like this:
    if ( inputInfo.GetDamageType() == DMG_WIND )
        VelocityPunch( Vector( 1000, 1000, 0 ) );

in the function of OnTakeDamage in hl2mp_player.cpp
buuut, I cant normally add a new damage type, and the way valve says to 
do it is totally unclear and there's no tutorial on it.. anyone know how 
to add new damage types?
other then that I may know a better way I just hope it won't need too 
many changes heh.

DMG_ would be the easiest way too go I think if anyone knows how... but 
not the best probably.

Andrew Watkins wrote:
> You set pEntity equal to null, then two lines later try to access it.
>
> Thats your crash, a null pointer exception. Debugging this really would
> have pointed you to that! :)
>
> Andrew
>
>   
>> Message: 6
>> Date: Fri, 19 Dec 2008 20:28:29 +0100
>> From: Yorg Kuijs <yorg.ku...@home.nl>
>> Subject: Re: [hlcoders] VelocityPunch and... what else?
>> To: Discussion of Half-Life Programming
>>      <hlcoders@list.valvesoftware.com>
>> Message-ID: <494bf5dd.2060...@home.nl>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> A friend helped me out and pointed me too something usefull, namely a 
>> entity for explosion that specifically has the code for pushing players, 
>> but I haven't got it too work yet, I took the parts I needed but it 
>> crashes on launch
>>
>> have been busy all day and need a fresh pair of eyes to look at it, 
>> would ask the other guy but he's offline now
>> anyway here's the code:
>>
>>     if( tr.fraction == 1.0 || !(tr.surface.flags & SURF_SKY) ) // this 
>> makes grenade explode on contact
>>     {
>>         //WindDetonate1();
>>         SailboatEffects(); //smoke cloud on ground touch
>>         CBaseEntity *pEntity = NULL;
>>         Vector        vecSpot, vecOrigin;
>>
>>         if ( pEntity->GetMoveType() == MOVETYPE_VPHYSICS || 
>> (pEntity->VPhysicsGetObject() /*&& !pEntity->IsPlayer()*/) ) // Only 
>> push things if they're physics items
>>         {
>>             vecOrigin = GetAbsOrigin();
>>            
>>             vecSpot = pEntity->BodyTarget( vecOrigin );
>>             // Squash this down to a circle
>>             vecOrigin[2] = vecSpot[2];
>>    
>>             if ( pEntity->IsPlayer() )
>>             {
>>                 Vector vecPushDir = ( pEntity->BodyTarget( 
>> GetAbsOrigin(), false ) - GetAbsOrigin() );
>>                 VectorNormalize( vecPushDir );
>>
>>                 Vector vecPush = (vecPushDir * 100);
>>
>>                 if ( pEntity->GetFlags() & FL_BASEVELOCITY )
>>                 {
>>                     vecPush = vecPush + pEntity->GetBaseVelocity();
>>                 }
>>                 //if ( vecPush.z > 0 && (pEntity->GetFlags() & 
>> FL_ONGROUND) )
>>                 //{
>>                 //    pEntity->SetGroundEntity( NULL );
>>                 //    Vector origin = pEntity->GetAbsOrigin();
>>                 //    origin.z += 1.0f;
>>                 //    pEntity->SetAbsOrigin( origin );
>>                 //}
>>
>>                 pEntity->SetBaseVelocity( vecPush ); // is this the 
>> actual push?
>>                 pEntity->AddFlag( FL_BASEVELOCITY );
>>             }
>>         }
>>
>>         //Explode( &tr, DMG_BLAST ); // old explosion
>>     }
>>     

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to