Raised This Month: $51 Target: $400
 12% 

[Solved] Create a prop_dynamic_override breakable.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 03-08-2015 , 11:21   [Solved] Create a prop_dynamic_override breakable.
Reply With Quote #1

Hi everyone,

I'm trying to spawn an entity which can be destroyed ( Example: a crate, ... ).

The entity spawns, collides with players, shows the bullet impacts ( Sparks ) but can't be destroyed.

Did I miss something?

PHP Code:
public void Crate_Spawn( const float vOrigin], const float vAngle] )
{
    
int iCrate CreateEntityByName"prop_dynamic_override" );
    
    if( 
IsValidEdictiCrate ))
    {
        
DispatchKeyValueiCrate"Model""models/props_unique/atm01.mdl" );
        
DispatchKeyValueiCrate"Health""10" ); // Need something else?
        
DispatchKeyValueiCrate"Solid""6" );
        
DispatchSpawniCrate );
        
TeleportEntityiCratevOriginvAngleNULL_VECTOR );
        
        
HookSingleEntityOutputiCrate"OnBreak"Crate_Breaktrue );
    }
}

public 
void Crate_Break( const char[ ] szOutputint iCallerint iActivatorfloat flDelay )
{
    
PrintToChatAll"Check OK" );

Thanks you
__________________

Last edited by micapat; 03-14-2015 at 17:50.
micapat is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 03-14-2015 , 07:10   Re: Create a prop_dynamic_override breakable.
Reply With Quote #2

Bump.

Even by setting the health after the DispatchSpawn ( With SetEntityHealth ), nothing happen. Is there a flag / bool that I missed ..?

Valve wiki for this entity: https://developer.valvesoftware.com/...namic_override ( "It can also be configured to break when it takes enough damage" ? ).
__________________
micapat is offline
VoiDeD
AlliedModders Donor
Join Date: Mar 2009
Location: Illinois, USA
Old 03-14-2015 , 17:26   Re: Create a prop_dynamic_override breakable.
Reply With Quote #3

Have you tried the m_takedamage sendprop?

https://mxr.alliedmods.net/hl2sdk-sd...areddefs.h#447
__________________
VoiDeD is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 03-14-2015 , 17:49   Re: Create a prop_dynamic_override breakable.
Reply With Quote #4

Thank you VoiDeD, it works now .

/!\ "Prop_Data" must be used!

PHP Code:
public void Crate_Spawn( const float vOrigin], const float vAngle] )
{
    
int iCrate CreateEntityByName"prop_dynamic_override" );
    
    if( 
IsValidEdictiCrate ))
    {
        
DispatchKeyValueiCrate"Model""models/props_unique/atm01.mdl" );
        
DispatchKeyValueiCrate"Solid""6" );
        
DispatchSpawniCrate );
        
        
SetEntPropiCrateProp_Data"m_iHealth"100 );
        
SetEntPropiCrateProp_Data"m_takedamage");
        
        
TeleportEntityiCratevOriginvAngleNULL_VECTOR );
        
        
HookSingleEntityOutputiCrate"OnBreak"Crate_Breaktrue );
    }

__________________
micapat is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:44.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode