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