AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to attach bomb model to CT's back ? (https://forums.alliedmods.net/showthread.php?t=237437)

souvikdas95 03-24-2014 01:18

How to attach bomb model to CT's back ?
 
Attempt 1 : By default, the terrorist models have a submodel backpack which is the same as "models/w_backpack.mdl" ( bomb ) while the counter-terrorists, also have a submodel backpack which is the same as "models/w_thighpack.mdl" ( defusal kit )
I want counter terrorists to have "models/w_backpack.mdl" as backpack but that's not possible due to submodels ( entity is not unique/ not found )
I tried and it failed as usual :

Code:

        give_item ( <player_index>, "item_thighpack" );
        cs_set_user_submodel ( <player_index>, 1 );
        new submodel_ent = find_ent_by_class ( -1, "item_thighpack" );
        while ( submodel_ent > 0 )
        {
                entity_set_model ( submodel_ent, "models/w_backpack.mdl" );
                submodel_ent = find_ent_by_class ( -1, "item_thighpack" );
        }


Attempt 2 : By attaching a new entity to the player aiment but it's distorted and misplaced and need some maths with origin and angle which I can't figure out :

Code:

        new tempent = create_entity ( "info_target" );
        entity_set_model ( tempent, "models/w_backpack.mdl" );
        entity_set_int ( tempent, EV_INT_movetype, MOVETYPE_FOLLOW );
        entity_set_edict ( tempent, EV_ENT_aiment, <player_index> );
        entity_set_edict ( tempent, EV_ENT_owner, <player_index> );

Attempt 3 : Last I tried was using client_PreThink to stick it to player origin but again it need a lot of maths including player aim checking which again I can't figure out.

Code:

        new Float: origin[3];
        entity_get_vector ( id, EV_VEC_origin, origin );
        entity_set_origin ( tempent, origin );

Need some help with it. Can't find any suitable TUT related to it

DavidJr 03-25-2014 05:35

Re: How to attach bomb model to CT's back ?
 
PHP Code:

entity_set_int(idEV_INT_body1); 


souvikdas95 03-25-2014 05:58

Re: How to attach bomb model to CT's back ?
 
@DavidJr - Unfortunately the submodels are unique... for CTs - it's defusal kit... for T's - it's bomb. I wanted CTs to get the bomb ( the bag at the back of the player )

hornet 03-25-2014 06:49

Re: How to attach bomb model to CT's back ?
 
Quote:

Originally Posted by DavidJr (Post 2115633)
PHP Code:

entity_set_int(idEV_INT_body1); 


Would be nice if you tested your code before posting it once in a while.

Quote:

Originally Posted by souvikdas95 (Post 2115638)
@DavidJr - Unfortunately the submodels are unique... for CTs - it's defusal kit... for T's - it's bomb. I wanted CTs to get the bomb ( the bag at the back of the player )

Yes, it's actually part of the player model, so you would have to do it manually.


All times are GMT -4. The time now is 06:03.

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