Raised This Month: $105 Target: $400
 26% 

[CS:GO] Spawned prop push away player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Reiko1231
Member
Join Date: Apr 2013
Location: Russia
Old 08-01-2013 , 06:13   [CS:GO] Spawned prop push away player
Reply With Quote #1

I spawn prop with this code:
Code:
SpawnProp(iClient, iPropID, Float:fOrigin[3], Float:fAngles[3])
{
	new iEntity = CreateEntityByName("prop_dynamic");
	
	DispatchKeyValue(iEntity, "model", g_szPropPath[iPropID]);
	DispatchKeyValue(iEntity, "targetname", "prop");
	DispatchKeyValue(iEntity, "solid", "6");
	DispatchKeyValueVector(iEntity, "origin", fOrigin);
	DispatchKeyValueVector(iEntity, "angles", fAngles);
	DispatchSpawn(iEntity);
	
	SetEntProp(iEntity, Prop_Data, "m_CollisionGroup", 17);
	
	AcceptEntityInput(iEntity, "DisableShadow");
	
	SetEntPropEnt(iEntity, Prop_Send, "m_hOwnerEntity", iClient);
	return iEntity;
}
but prop, spawned with this code, push away player, when he come close.
If I change m_CollisionGroup from 0 to 50 (I tried it all), prop become unsolid in all case, except 17.
Is here any way to make prop solid and remove push away force?

Btw, this code without SetEntProp(iEntity, Prop_Data, "m_CollisionGroup", 17); spawn prop without push away in CS:S, but in CS:GO without this line prop spawned unsolid.

P.S. Sorry for bad language.


Problem Solved:
1. SetEntPropEnt(iEntity, Prop_Send, "m_hOwnerEntity", iClient); - I don't know why, but this line ruined all code before. I replace that with:
SetEntPropEnt(iEntity, Prop_Send, "m_hEffectEntity", iClient);.
2. SetEntProp(iEntity, Prop_Send, "m_usSolidFlags", 152); - don't know what is it, but it works
SetEntProp(iEntity, Prop_Send, "m_CollisionGroup", 8 ); - collusion group like a player
3. Full Code:
Code:
SpawnProp(iClient, iPropID, Float:fOrigin[3], Float:fAngles[3])
{
	new iEntity = CreateEntityByName("prop_physics_override"); 
	DispatchKeyValue(iEntity, "targetname", "prop");
	DispatchKeyValue(iEntity, "model", g_szPropPath[iPropID]);
	DispatchKeyValue(iEntity, "solid", "6");
		
	if ( DispatchSpawn(iEntity) ) 
	{
		SetEntPropEnt(iEntity, Prop_Send, "m_hEffectEntity", iClient);
		TeleportEntity(iEntity, fOrigin, fAngles, NULL_VECTOR); 
		SetEntProp(iEntity, Prop_Send, "m_usSolidFlags",  152);
		SetEntProp(iEntity, Prop_Send, "m_CollisionGroup", 8);
		AcceptEntityInput(iEntity, "DisableMotion");
		
		return iEntity;
	}
	
	return -1;
}
With this code spawned prop is pretty solid and without "push away" force.

Last edited by Reiko1231; 10-30-2013 at 11:28. Reason: Problem Solved
Reiko1231 is offline
Reiko1231
Member
Join Date: Apr 2013
Location: Russia
Old 09-04-2013 , 10:45   Re: [CS:GO] Spawned prop push away player
Reply With Quote #2

up... sourcemod 1.5 released, but problem still not solved...
Reiko1231 is offline
wanted2411
Senior Member
Join Date: Jun 2012
Old 09-04-2013 , 13:33   Re: [CS:GO] Spawned prop push away player
Reply With Quote #3

Code:
    COLLISION_GROUP_NONE  = 0,
    COLLISION_GROUP_DEBRIS,            // Collides with nothing but world and static stuff
    COLLISION_GROUP_DEBRIS_TRIGGER, // Same as debris, but hits triggers
    COLLISION_GROUP_INTERACTIVE_DEBRIS,    // Collides with everything except other interactive debris or debris
    COLLISION_GROUP_INTERACTIVE,    // Collides with everything except interactive debris or debris
    COLLISION_GROUP_PLAYER,
    COLLISION_GROUP_BREAKABLE_GLASS,
    COLLISION_GROUP_VEHICLE,
    COLLISION_GROUP_PLAYER_MOVEMENT,  // For HL2, same as Collision_Group_Player
                                        
    COLLISION_GROUP_NPC,            // Generic NPC group
    COLLISION_GROUP_IN_VEHICLE,        // for any entity inside a vehicle
    COLLISION_GROUP_WEAPON,            // for any weapons that need collision detection
    COLLISION_GROUP_VEHICLE_CLIP,    // vehicle clip brush to restrict vehicle movement
    COLLISION_GROUP_PROJECTILE,        // Projectiles!
    COLLISION_GROUP_DOOR_BLOCKER,    // Blocks entities not permitted to get near moving doors
    COLLISION_GROUP_PASSABLE_DOOR,    // Doors that the player shouldn't collide with
    COLLISION_GROUP_DISSOLVING,        // Things that are dissolving are in this group
    COLLISION_GROUP_PUSHAWAY,        // Nonsolid on client and server, pushaway in player code

    COLLISION_GROUP_NPC_ACTOR,        // Used so NPCs in scripts ignore the player.
Collision Group Types. Find what you want and use this.
wanted2411 is offline
wanted2411
Senior Member
Join Date: Jun 2012
Old 09-04-2013 , 13:39   Re: [CS:GO] Spawned prop push away player
Reply With Quote #4

Try to enable/disable collisions for ents:

Code:
bool:CreateEntity(client, String:mdlMine[])
{
	new entity = CreateEntityByName("prop_dynamic_override");
	PrecacheModel(mdlMine);
	SetEntityModel(entity, mdlMine);
	if (entity != -1)
	{
		decl Float:min[3], Float:max[3];

		GetEntPropVector(entity, Prop_Send, "m_vecMins", min);
		GetEntPropVector(entity, Prop_Send, "m_vecMaxs", max);

		decl Float:position[3], Float:ang_eye[3], Float:ang_ent[3], Float:normal[3];
		
		if (GetClientAimedLocationData(client, position, ang_eye, normal) == -1)
		{
			AcceptEntityInput(entity, "Kill");
		}
		
		GetVectorAngles(normal, ang_ent);
		ang_ent[0] += 90.0;

		position[0] -= normal[0] * min[2];
		position[1] -= normal[1] * min[2];
		position[2] -= normal[2] * min[2];

		DispatchKeyValue(entity, "Solid", "6");
		DispatchKeyValueVector(entity, "Origin", position);
		DispatchKeyValueVector(entity, "Angles", ang_ent);
		DispatchSpawn(entity);

		AcceptEntityInput(entity, "DisableCollision");
		AcceptEntityInput(entity, "EnableCollision");
		
		return true;
	}
	return false;
}
wanted2411 is offline
javalia
Senior Member
Join Date: May 2009
Location: korea, republic of
Old 09-06-2013 , 06:02   Re: [CS:GO] Spawned prop push away player
Reply With Quote #5

https://forums.alliedmods.net/showthread.php?p=1850373
try this.
__________________
javalia is offline
Reiko1231
Member
Join Date: Apr 2013
Location: Russia
Old 09-06-2013 , 10:15   Re: [CS:GO] Spawned prop push away player
Reply With Quote #6

Enable/disable collisions not working, and plugin not working too.
Only one group give different result - COLLISION_GROUP_PUSHAWAY, but I don't need to having pushaway force, and prop are unsolid - I can jump into it, and inside of prop are empty space, and I can see through it.
Screenshots:

Reiko1231 is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 09-06-2013 , 12:07   Re: [CS:GO] Spawned prop push away player
Reply With Quote #7

I think it might be because you're setting "Solid" to 6. Looking in entities.inc you find this enum:
PHP Code:
enum SolidFlags_t
{
    
FSOLID_CUSTOMRAYTEST        0x0001,    // Ignore solid type + always call into the entity for ray tests
    
FSOLID_CUSTOMBOXTEST        0x0002,    // Ignore solid type + always call into the entity for swept box tests
    
FSOLID_NOT_SOLID            0x0004,    // Are we currently not solid?
    
FSOLID_TRIGGER                0x0008,    // This is something may be collideable but fires touch functions
                                            // even when it's not collideable (when the FSOLID_NOT_SOLID flag is set)
    
FSOLID_NOT_STANDABLE        0x0010,    // You can't stand on this
    
FSOLID_VOLUME_CONTENTS        0x0020,    // Contains volumetric contents (like water)
    
FSOLID_FORCE_WORLD_ALIGNED    0x0040,    // Forces the collision rep to be world-aligned even if it's SOLID_BSP or SOLID_VPHYSICS
    
FSOLID_USE_TRIGGER_BOUNDS    0x0080,    // Uses a special trigger bounds separate from the normal OBB
    
FSOLID_ROOT_PARENT_ALIGNED    0x0100,    // Collisions are defined in root parent's local coordinate space
    
FSOLID_TRIGGER_TOUCH_DEBRIS    0x0200,    // This trigger will touch debris objects

    
FSOLID_MAX_BITS    10
}; 
6 is 2 + 4, which would be FSOLID_CUSTOMBOXTEST and FSOLID_NOT_SOLID.
bl4nk is offline
javalia
Senior Member
Join Date: May 2009
Location: korea, republic of
Old 09-06-2013 , 12:07   Re: [CS:GO] Spawned prop push away player
Reply With Quote #8

i recommand you to try to remove the code that changes collisiongroup and spawn them as normal prop_physics
__________________
javalia is offline
javalia
Senior Member
Join Date: May 2009
Location: korea, republic of
Old 09-06-2013 , 12:08   Re: [CS:GO] Spawned prop push away player
Reply With Quote #9

yes, removing the code that changes solid type will be good as bl4nk said.
__________________
javalia is offline
Reiko1231
Member
Join Date: Apr 2013
Location: Russia
Old 09-06-2013 , 12:41   Re: [CS:GO] Spawned prop push away player
Reply With Quote #10

Removing code that changes solid type won't helped, same result at removing code that changing collusiongroup; and spawning like prop_physics_override.
Clear prop_physics I can't spawn, because I don't know, how. I try to create, then dipatch spawn, teleport entity and setting model, but I see none. It case prop_physics_override this works.
But in all checked cases spawned props are empty and unsolid.
Reiko1231 is offline
Reply


Thread Tools
Display Modes

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 01:02.


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