AMX Mod X Plugin Approver
Join Date: Feb 2009
Location: Iwotadai Dorm
is a value that tells the game which sub-model should be visible.
This can be extremely powerful with more player models, except nobody seems to have used this feature to its potential yet. As of now and as far as I know, CS only uses this to display bomb on the player.
What can be done with this value?
For example, you can put all of the custom models and hats on your server into a single model. This has a lot of pros over the cons (below).
How do you change the combinations?
Let's say you have two groups of sub-models like me - models and hats.
THIS IS NOT HOW IT WORKS:
Model1 - ID: 0
Model2 - ID: 1
Model3 - ID: 2
Hat1 - ID: 3
Hat2 - ID: 4
Hat3 - ID: 5
THIS IS HOW IT WORKS:
Model1 - ID: 0
Model2 - ID: 1
Model3 - ID: 2
Hat1 - ID: 0
Hat2 - ID: 1
Hat3 - ID: 2
For only two groups, you want to use this to get the pev_body number you need:
pev_body = hat_id * amount_of_models + model_id
So let's say you want to give the player Model 2 with Hat 3.
pev_body = 2 * 3 + 1 = 7
I haven't tried working with more groups yet, I'll report back once I do.
What can be done with this?
You can for example make a plugin for full character customization. Create a model with body parts such as face, hair, chest size, etc. and allow the player to choose what suits him.
- All models are in one larger file, which gives a better "feeling" when downloading
- A great way to reduce the amount of precached files on your server
- The file size is a lot smaller than all the models one by one together, because the duplicates (model information, animations etc) are removed
- For hats and such, you don't need a 3rd party plugin to handle it (creating a new entity, setting it's origin, etc)
- The model + hat is still one single entity
- A lot of new possibilities
- Adding more models will require a new download of the complete file
- Not too easy to work with
- Compiler is a bitch
- The final model requires all the already existing Counter-Strike models, if you want to make hats available for standard models as well
- Players won't be able to see their custom models
- The compiler keeps crashing for some reason, producing an unfinished model (split textures)
- Need to figure out how to add models split into parts as a submodel. Currently, it adds each part as a submodel (see the model example: group 'modely', submodels 5 and 6
- Need to make the bomb visible, I'm going to add it in a completely new group and see what it looks like.
- Edit: Compiler crashing when the file size is above 4 megabytes. Trying to find a way around this (splitting models)
If you know how to solve any of the problems above, please let me know.
Use this small plugin with the included model to see what is this feature capable of
#include < amxmodx >
#include < fakemeta >
#include < cstrike >
new const cstModel[ ] = "models/player/testmdl/testmdl.mdl"
new const cstModelT[ ] = "models/player/testmdl/testmdlt.mdl"
new const cstMdlName[ ] = "testmdl"
public plugin_precache( )
precache_model( cstModel )
precache_model( cstModelT )
public plugin_init( )
register_clcmd( "pev_body", "_body" )
register_clcmd( "changemdl", "_changemdl" )
public _body( id )
new szArgs[ 4 ]
read_args( szArgs, charsmax( szArgs ) )
remove_quotes( szArgs )
trim( szArgs )
new iPev = str_to_num( szArgs )
set_pev( id, pev_body, iPev )
client_print( id, print_console, "Changing your pev_body value to %d", iPev )
public _changemdl( id )
cs_set_user_model( id, cstMdlName )
client_print( id, print_console, "Your model was changed to %s. You can now change your pev_body value using console command 'pev_body'.", cstMdlName )
Table of values:
You can see the submodels in HLMV in the "Body Parts" tab.
MODEL NAME HAT PEV_BODY
T Model 1 Indian Hat 0
T Model 2 Indian Hat 1
CT Model 1 Indian Hat 2
Hitman Indian Hat 3
Banana (eyes) Indian Hat 4
Banana (rest) Indian Hat 5
CT Model 2 Indian Hat 6
Assassin Indian Hat 7
T Model 1 Afro 8
T Model 2 Afro 9
CT Model 1 Afro 10
Hitman Afro 11
Banana (eyes) Afro 12
Banana (rest) Afro 13
CT Model 2 Afro 14
Assassin Afro 15
T Model 1 Minecraft 16
T Model 2 Minecraft 17
CT Model 1 Minecraft 18
Hitman Minecraft 19
Banana (eyes) Minecraft 20
Banana (rest) Minecraft 21
CT Model 2 Minecraft 22
Assassin Minecraft 23
T Model 1 Fly 24
T Model 2 Fly 25
CT Model 1 Fly 26
Hitman Fly 27
Banana (eyes) Fly 28
Banana (rest) Fly 29
CT Model 2 Fly 30
Assassin Fly 31
T Model 1 Wings (broken) 32
T Model 2 Wings (broken) 33
CT Model 1 Wings (broken) 34
Hitman Wings (broken) 35
Banana (eyes) Wings (broken) 36
Banana (rest) Wings (broken) 37
CT Model 2 Wings (broken) 38
Assassin Wings (broken) 39
Thanks for reading.
Okay, this is getting even better than I thought it would be.
Each model has around 120 sequences. What's funny about this is an average model has 2.3MB filesize - 2 megabytes of that are the animations. Which means if you're going to combine 5 models of size 2.3MB each, your final size will be 2MB for the animations + 5 * 300kB = 3.5MB total.
Bomb and defusal kit
I've implemented those in my new model. The function to get the pev_body ID is as follows:
I'm not sure about this - haven't tested it yet.
stock get_bodyid( iModelId, iHatId, bool: bBomb, bool: bDefusalKit )
new iPevBody = iHatId * g_TotalModels + iModelId
if( bBomb )
iPevBody += ( g_TotalModels * g_TotalHats )
if( bDefusalKit )
iPevBody += ( g_TotalModels * g_TotalHats * 2 )
The new model is in attachments. There are 17 models and 39 hats - total size: 11.15MB. I removed the shield animations, because they're useless for me. Two models are duplicate (my bad), because I forgot to rename the textures of these, so they just replaced the other textures.
The limits for combined models are:
- Max 16MB filesize
- Texture names sometimes need to be changed or they will be overwritten by other models
- Maximum 40 sub-models per group (39 hats, because the first one is empty)
Note the first HatID is no longer 0 (ID 0 is "nothing", we're setting HatID 0 for people without any hat)
Last edited by Backstabnoob; 05-17-2014 at 18:43.