Raised This Month: $32 Target: $400
 8% 

My entity is not solid


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dyceman
Member
Join Date: Jul 2012
Old 07-22-2012 , 15:41   My entity is not solid
Reply With Quote #1

Code:
new String:propmodel[52] = "models/player/demo.mdl";
if(!IsModelPrecached(propmodel)){
   PrecacheModel(propmodel);
}
SetEntityModel(entity, propmodel);
DispatchKeyValue(entity, "targetname", "something");
DispatchKeyValue(entity, "Solid", "6");
DispatchSpawn(entity);
TeleportEntity(entity, spawn_location, NULL_VECTOR, NULL_VECTOR);
I tried everything the entity has the same effects as a hologram, I can walk through it and can't hit it. What am I doing wrong?
dyceman is offline
DaFox
Senior Member
Join Date: Mar 2005
Old 07-22-2012 , 16:31   Re: My entity is not solid
Reply With Quote #2

Use SetEntProp instead

Some sample code (change it to SetEntProp!)

Code:
enum SolidType_t {
    SOLID_NONE        = 0,    //no solid model
    SOLID_BSP        = 1,    //a BSP tree
    SOLID_BBOX        = 2,    //an AABB
    SOLID_OBB        = 3,    //an OBB (not implemented yet)
    SOLID_OBB_YAW        = 4,    //an OBB,constrained so that it can only yaw
    SOLID_CUSTOM        = 5,    //always call into the entity for tests
    SOLID_VPHYSICS        = 6,    //solid vphysics object,get vcollide from the model and collide with that
    SOLID_LAST,
}

new g_iOffs_MoveType = FindSendPropInfo("CDynamicProp","movetype")
new g_iOffs_nSolidType = FindSendPropInfo("CDynamicProp","m_nSolidType")
new g_iOffs_nSkin = g_iOffs_nSkin = FindSendPropInfo("CDynamicProp","m_nSkin")
new g_iOffs_nRenderMode = FindSendPropInfo("CDynamicProp","m_nRenderMode")
new g_iOffs_clrRender = FindSendPropInfo("CDynamicProp","m_clrRender")

new ent = CreateEntityByName("prop_dynamic_override")

if(ent != -1) {
        SetEntityModel(ent,g_szModelList[model])
        DispatchSpawn(ent)

        DispatchKeyValue(ent,"classname","bms_block")
        SetEntData(ent,g_iOffs_MoveType,_:MOVETYPE_NONE,1,true)
        SetEntData(ent,g_iOffs_nSolidType,_:SOLID_BBOX,1,true)
        SetEntData(ent,g_iOffs_nSkin,_:type,1,true)
        SetEntData(ent,g_iOffs_nRenderMode,0,1,true)
        SetEntData(ent,g_iOffs_clrRender,color[0],1,true)
        SetEntData(ent,g_iOffs_clrRender + 1,color[1],1,true)
        SetEntData(ent,g_iOffs_clrRender + 2,color[2],1,true)
        SetEntData(ent,g_iOffs_clrRender + 3,color[3],1,true)
TeleportEntity(entity, spawn_location, NULL_VECTOR, NULL_VECTOR);
}
__________________
Quote:
Originally Posted by Peoples Army
your from Finland? what country is that in?

Last edited by DaFox; 07-22-2012 at 16:38.
DaFox is offline
dyceman
Member
Join Date: Jul 2012
Old 07-22-2012 , 17:30   Re: My entity is not solid
Reply With Quote #3

I did that and still not solid. Explosion trigger the ontakedamage only,
dyceman is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 07-22-2012 , 17:41   Re: My entity is not solid
Reply With Quote #4

does the model have a collision model? also are you changing the movetype at any point?
blodia is offline
dyceman
Member
Join Date: Jul 2012
Old 07-22-2012 , 18:09   Re: My entity is not solid
Reply With Quote #5

yes because when I put it in the map with hammer I collide with it. I did set the movetype to none.

Code:
                new String:propmodel[52] = "models/player/demo.mdl";
                if(!IsModelPrecached(propmodel))
                {
                    PrecacheModel(propmodel);
                }
                SetEntityModel(entity, propmodel);
                DispatchKeyValue(entity, "DefaultAnim", "Stand_LOSER");
                DispatchSpawn(entity);
                
                DispatchKeyValue(entity, "targetname", "demo_monster");
                SetEntityMoveType(entity, MOVETYPE_NONE);  
                SetEntProp(entity, Prop_Data, "m_CollisionGroup", 12);
                SetEntProp(entity, Prop_Data, "m_usSolidFlags", 16);
                SetEntProp(entity, Prop_Data, "m_nSolidType", 2);
                TeleportEntity(entity, spawn_location, NULL_VECTOR, NULL_VECTOR);

Last edited by dyceman; 07-22-2012 at 18:20.
dyceman is offline
t.sang
AlliedModders Donor
Join Date: Jun 2012
Location: Russia
Old 07-22-2012 , 22:36   Re: My entity is not solid
Reply With Quote #6

try
Code:
SetEntProp(entity, Prop_Send, "m_CollisionGroup", <collision type>);
https://developer.valvesoftware.com/...OLLISION_Types

Last edited by t.sang; 07-22-2012 at 22:44.
t.sang is offline
dyceman
Member
Join Date: Jul 2012
Old 07-22-2012 , 23:16   Re: My entity is not solid
Reply With Quote #7

I got it working
I didn't need any of that collision stuff. I just copied all the data from hammer to sourcemod.
dyceman is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 07-22-2012 , 23:20   Re: My entity is not solid
Reply With Quote #8

To clarify, when spawning an entity in hammer, you have the ability to enable/disable "Smart Edit". Disabling it will print out all the data/netprops for the entity, which can then be re-created prior to dispatching the entity in-game. His issue was he just wasn't reproducing the necessary data. (It's always nice to post your solution in-case others have the same issue *cough*)
__________________

Last edited by thetwistedpanda; 07-22-2012 at 23:21.
thetwistedpanda 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 21:01.


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