AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solidity Mins/Maxs mistake (https://forums.alliedmods.net/showthread.php?t=147349)

kossolax 01-08-2011 08:03

Solidity Mins/Maxs mistake
 
Hello,

I'm trying to spawn a block

PHP Code:

public SpawnBlock(client) {
    
    
decl Float:position[3];
    
GetClientAimLocation(clientposition);
    
    new 
index CreateEntityByName("prop_dynamic");
    if( !
IsValidEdict(index) )
        return;
    
    new 
String:model_path[128];
    
Format(model_path128"models/DeadlyDesire/props/blocks/block_%s.mdl"g_szSizeg_iData[data_size][client] ]);
    
    if ( !
IsModelPrecachedmodel_path ) ) {
        
PrecacheModelmodel_path );
    }
    
SetEntityModel(indexmodel_path);
    
    
decl String:skin[12];
    
IntToString(g_iData[data_color][client], skin11);
    
    
DispatchKeyValue(index"disableshadows""1");
    
DispatchKeyValue(index"StartDisabled""0");
    
DispatchKeyValue(index"PerformanceMode""1");
    
DispatchKeyValue(index"solid""2");
    
DispatchKeyValueVector(index"mins"g_fMinsg_iData[data_size][client] ]);
    
DispatchKeyValueVector(index"maxs"g_fMaxsg_iData[data_size][client] ]);
    
    
DispatchKeyValue(index"model"model_path);
    
DispatchKeyValue(index"Skin"skin);
    
    
ActivateEntityindex);
    
DispatchSpawnindex);
    
    
TeleportEntity(indexpositionNULL_VECTORNULL_VECTOR);
    
SetEntPropVectorindexProp_Send"m_vecMins"g_fMinsg_iData[data_size][client] ]);
    
SetEntPropVectorindexProp_Send"m_vecMaxs"g_fMaxsg_iData[data_size][client] ]);
    
    
AcceptEntityInputindex"DisableCollision" );
    
AcceptEntityInputindex"EnableCollision" );


The result for players are correct and fetch to the block, but for prop, completly wrong... Look what it's doing in game:
[IMG]http://img267.**************/img267/6521/solidity.jpg[/IMG]


why?


In advance, thank you

FaTony 01-08-2011 08:38

Re: Solidity Mins/Maxs mistake
 
The props don't have good built-in collision models, don't they?

kossolax 01-08-2011 08:41

Re: Solidity Mins/Maxs mistake
 
Thank you for your reply,

Actually, I've made it using hammer and propper.
The physic box look good in Model Viewer :/

FaTony 01-08-2011 08:47

Re: Solidity Mins/Maxs mistake
 
If it looks good then you shouldn't mess with any collision property at all.

kossolax 01-08-2011 09:05

Re: Solidity Mins/Maxs mistake
 
[IMG]http://img217.**************/img217/1579/blockq.jpg[/IMG]
So looks good...

Changing
PHP Code:

DispatchKeyValue(index"solid""2"); 

to
PHP Code:

DispatchKeyValue(index"solid""6"); 

Make a the block with a strange non-solidity, player are slowing down but can travers it... :/

FaTony 01-08-2011 09:37

Re: Solidity Mins/Maxs mistake
 
...and what if you don't set "solid" at all?

EDIT: Also, you should really precache all models OnMapStart.

Also:
PHP Code:

g_szSizeg_iData[data_size][client] ] 

This is SO ugly. Hold all model names fully in the adt_array (this would be most scalable solution).

And all paths should have PLATFORM_MAX_PATH size.

PHP Code:

DispatchKeyValue(index"StartDisabled""0");
    
DispatchKeyValue(index"PerformanceMode""1");
    
DispatchKeyValue(index"solid""2");
    
DispatchKeyValueVector(index"mins"g_fMinsg_iData[data_size][client] ]);
    
DispatchKeyValueVector(index"maxs"g_fMaxsg_iData[data_size][client] ]);
    
    
ActivateEntityindex);
    
    
AcceptEntityInputindex"DisableCollision" );
    
AcceptEntityInputindex"EnableCollision" ); 

All these lines are unnecessary I think.

kossolax 01-08-2011 10:16

Re: Solidity Mins/Maxs mistake
 
Thank's you again for assists

Quote:

Originally Posted by FaTony (Post 1388929)
PHP Code:

g_szSizeg_iData[data_size][client] ] 

This is SO ugly. Hold all model names fully in the adt_array (this would be most scalable solution).

Actually, this only contain few data:
PHP Code:

new String:g_szSize[3][12] = {
    
"16x16",
    
"32x32",
    
"64x8"
}; 

Quote:

Originally Posted by FaTony (Post 1388929)
Also, you should really precache all models OnMapStart.

Everything, execpt .vmt/.vtf are precached and added in downloadtable on map start.

Quote:

Originally Posted by FaTony (Post 1388929)
And all paths should have PLATFORM_MAX_PATH size.

Didn't know that, thank's





Now, I'm spawning them like this:

PHP Code:

public SpawnBlock(client) {
    
    
decl Float:position[3];
    
GetClientAimLocation(clientposition);
    
    new 
index CreateEntityByName("prop_dynamic");
    if( !
IsValidEdict(index) )
        return;
    
    new 
String:model_path[PLATFORM_MAX_PATH];
    
Format(model_pathPLATFORM_MAX_PATH"models/DeadlyDesire/props/blocks/block_%s.mdl"g_szSizeg_iData[data_size][client] ]);
    
    if ( !
IsModelPrecachedmodel_path ) ) {
        
PrecacheModelmodel_path );
    }
    
SetEntityModel(indexmodel_path);
    
    
decl String:skin[12];
    
IntToString(g_iData[data_color][client], skin11);
    
    
DispatchKeyValue(index"disableshadows""1");
    
    
DispatchKeyValue(index"model"model_path);
    
DispatchKeyValue(index"Skin"skin);
    
    
DispatchSpawnindex);
    
    
TeleportEntity(indexpositionNULL_VECTORNULL_VECTOR);
    
SetEntPropVectorindexProp_Send"m_vecMins"g_fMinsg_iData[data_size][client] ]);
    
SetEntPropVectorindexProp_Send"m_vecMaxs"g_fMaxsg_iData[data_size][client] ]);



And it's not solid at all...

PHP Code:

// Adding this make it solid for player, but mistake with props
DispatchKeyValue(index"solid""2");
// Adding this, slow down the player on entering it, but it's not solid
DispatchKeyValue(index"solid""6"); 


I don't get why, what I'm supposed to do?

FaTony 01-08-2011 10:25

Re: Solidity Mins/Maxs mistake
 
Are your props compiled with dynamic mode enabled?

I think this is unnecessary too:
PHP Code:

SetEntPropVectorindexProp_Send"m_vecMins"g_fMinsg_iData[data_size][client] ]);
SetEntPropVectorindexProp_Send"m_vecMaxs"g_fMaxsg_iData[data_size][client] ]); 

Quote:

Originally Posted by kossolax (Post 1388973)
Everything, execpt .vmt/.vtf are precached and added in downloadtable on map start.

.vtf and .vmt should also be added to downloads table. Dunno about precaching.

kossolax 01-08-2011 10:36

Re: Solidity Mins/Maxs mistake
 
Thank you again for your reply

Quote:

Originally Posted by FaTony (Post 1388978)
Are your props compiled with dynamic mode enabled?

They are marked as in hammer's model viewer.

Quote:

Originally Posted by FaTony (Post 1388978)
I think this is unnecessary too:
PHP Code:

SetEntPropVectorindexProp_Send"m_vecMins"g_fMinsg_iData[data_size][client] ]);
SetEntPropVectorindexProp_Send"m_vecMaxs"g_fMaxsg_iData[data_size][client] ]); 


Removed, now players got the same bug as props using "solid" = "2"
If I set solid = 6, it's like barrel in de_dust2, it's not really blocking you, but push you out of it...




I need them to be fully solid and blocking everything correctly...

FaTony 01-08-2011 10:40

Re: Solidity Mins/Maxs mistake
 
Ok... so what was the original problem? Did we break something while removing the lines?

Any errors in the console while spawning the prop?


All times are GMT -4. The time now is 17:19.

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