• HL2 Flare Effect on a different prop?
    8 replies, posted
Basically what I'm trying to achieve is a glowstick. Pick it up, and it emits a pale/green light for a long while then slowly "burns" out. Since the physics flare doesn't require any coding in Hammer, the coding must be in the physics prop itself. How would I do that?
Patricle effects implemented to the model and some coding, I'm sure
I just need the dynamic light, that's all.
How would I go about doing that? Kind of the wrong section for this question but the base topic is right.
[url=http://developer.valvesoftware.com/wiki/Physgun_interactions]Physgun interactions[/url] See last option.
onpickup create_flare Is put into the QC to make the prop act like a flare. So this means that the actual files that say WHAT the flare does must be in some code somewhere in Source. Anyone feel like finding this? I have no idea what I'm doing or even where to start looking.
[quote]Note: HL2_EPISODIC DLLs only; see CBreakableProp::OnPhysGunPickup().[/quote] ...\src\game\server\props.cpp [cpp]//----------------------------------------------------------------------------- // Purpose: Keep track of physgun influence //----------------------------------------------------------------------------- void CBreakableProp::OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t reason ) { /* Additional, irrelevant code */ #ifdef HL2_EPISODIC if ( HasInteraction( PROPINTER_PHYSGUN_CREATE_FLARE ) ) { CreateFlare( PROP_FLARE_LIFETIME ); } #endif } #ifdef HL2_EPISODIC //----------------------------------------------------------------------------- // Purpose: Create a flare at the attachment point //----------------------------------------------------------------------------- void CBreakableProp::CreateFlare( float flLifetime ) { // Create the flare CBaseEntity *pFlare = ::CreateFlare( GetAbsOrigin(), GetAbsAngles(), this, flLifetime ); if ( pFlare ) { int iAttachment = LookupAttachment( "fuse" ); Vector vOrigin; GetAttachment( iAttachment, vOrigin ); pFlare->SetMoveType( MOVETYPE_NONE ); pFlare->SetSolid( SOLID_NONE ); pFlare->SetRenderMode( kRenderTransAlpha ); pFlare->SetRenderColorA( 1 ); pFlare->SetLocalOrigin( vOrigin ); pFlare->SetParent( this, iAttachment ); RemoveInteraction( PROPINTER_PHYSGUN_CREATE_FLARE ); m_hFlareEnt = pFlare; SetThink( &CBreakable::SUB_FadeOut ); SetNextThink( gpGlobals->curtime + flLifetime + 5.0f ); m_nSkin = 1; AddEntityToDarknessCheck( pFlare ); AddEffects( EF_NOSHADOW ); } } #endif // HL2_EPISODIC[/cpp] ...\src\game\server\hl2\weapon_flaregun.cpp [cpp]CBaseEntity *CreateFlare( Vector vOrigin, QAngle Angles, CBaseEntity *pOwner, float flDuration ) { CFlare *pFlare = CFlare::Create( vOrigin, Angles, pOwner, flDuration ); if ( pFlare ) { pFlare->m_bPropFlare = true; } return pFlare; } //----------------------------------------------------------------------------- // Purpose: // Input : vecOrigin - // vecAngles - // *pOwner - // Output : CFlare //----------------------------------------------------------------------------- CFlare *CFlare::Create( Vector vecOrigin, QAngle vecAngles, CBaseEntity *pOwner, float lifetime ) { CFlare *pFlare = (CFlare *) CreateEntityByName( "env_flare" ); if ( pFlare == NULL ) return NULL; UTIL_SetOrigin( pFlare, vecOrigin ); pFlare->SetLocalAngles( vecAngles ); pFlare->Spawn(); pFlare->SetTouch( &CFlare::FlareTouch ); pFlare->SetThink( &CFlare::FlareThink ); //Start up the flare pFlare->Start( lifetime ); //Don't start sparking immediately pFlare->SetNextThink( gpGlobals->curtime + 0.5f ); //Burn out time pFlare->m_flTimeBurnOut = gpGlobals->curtime + lifetime; pFlare->RemoveSolidFlags( FSOLID_NOT_SOLID ); pFlare->AddSolidFlags( FSOLID_NOT_STANDABLE ); pFlare->SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE ); pFlare->SetOwnerEntity( pOwner ); pFlare->m_pOwner = pOwner; return pFlare; } [/cpp]
Why thank you. This is just what I needed. Thank you a lot actually! You saved me hours of pointless rummaging.
Sorry, you need to Log In to post a reply to this thread.