View Single Post
Author Message
scorpius2k1
Senior Member
Join Date: Feb 2016
Old 05-13-2020 , 11:07   SetEntPropEnt "m_hOwnerEntity" Changes Collision Group & Weapon Interaction
Reply With Quote #1

When trying to spawn an entity prop, setting it's owner to a client entity via...

Code:
SetEntPropEnt(iEnt, Prop_Data, "m_hOwnerEntity", client);
...causes the prop to not collide with the player as well as no damage taken from hitscan weapons (pistol, smg, ar2, etc) while non-hitscan weapons work fine (crossbow, crowbar, etc). I should note, this is occurring on HL2DM so I am not sure if behavior is similar on other games, I would suspect it is.

If I do not set an owner entity, the prop takes damage from all weapon types and collides with the player as expected.

Any ideas here?

PHP Code:
stock void SpawnEntityAtPlayer(int client) {

    
int iEnt CreateEntityByName("prop_physics_override");

    if(
IsValidEntity(iEnt)) {
        
float fSpawnLocation[3];
        
GetClientAbsOrigin(clientfSpawnLocation);
        
fSpawnLocation[0] += 64.0;
        
fSpawnLocation[1] += 64.0;

        
DispatchKeyValue(iEnt"model""models/props_citizen_tech/guillotine001a_wheel01.mdl");
        
DispatchKeyValue(iEnt"targetname"sEntName);

        
// ???
        // FOR SOME REASON, THIS MODIFIES COLLISION GROUP WITH PLAYER
        // AND INTERACTION HITSCAN-BASED WEAPONS
        
SetEntPropEnt(iEntProp_Data"m_hOwnerEntity"client);

    
        
DispatchSpawn(iEnt);
        
TeleportEntity(iEntfSpawnLocationNULL_VECTORNULL_VECTOR);

        
HookSingleEntityOutput(iEnt"OnTakeDamage"OnPropTakeDamage);
    }
}


public 
void OnPropTakeDamage(const char [] outputint callerint activatorfloat delay) {
    
PrintToChatAll("Prop Damaged!");

__________________
{__ PIRATES COVE __} ● HIGH-KILL Community | Stats ●
Half-Life 2: Deathmatch
66.151.244.149:27016 => CONNECT

Last edited by scorpius2k1; 05-20-2020 at 16:34.
scorpius2k1 is offline