Raised This Month: $51 Target: $400
 12% 

Is it possible to attach bone in pluins?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LinLinLin
Senior Member
Join Date: Sep 2021
Old 03-03-2022 , 10:30   Is it possible to attach bone in pluins?
Reply With Quote #1

I know how to use SetParent and SetParentAttachment in plugins,but i find that there are no attachment point like righthand or RHand in L4D2 common infected and i readlly want to attach something in there hand XD.

So is it possible to use bone as a attachment point in plugins?
I have used Model Viewer to find attachment and bone and i find something like that
PHP Code:
    $attachment "RArm" "ValveBiped.Bip01_R_Finger0" 0.00 -0.00 0.00 rotate -0 0 0 
In developer it said this code shold write in .qc file but i actually have nothing about it.
Very thanks for any help.
Attached Thumbnails
Click image for larger version

Name:	ModelView.png
Views:	67
Size:	20.2 KB
ID:	194013  

Last edited by DarkDeviL; 03-07-2022 at 08:24. Reason: Corrected typo, being the only update in bump below
LinLinLin is online now
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 03-08-2022 , 16:11   Re: Is it possible to attach bone in pluins?
Reply With Quote #2

You can attach to a "poor" model a fake invisible overlay having desired attachment point, than attach a goal entity to that point.

Example how I did it in one of private plugins:
PHP Code:
bool ParentOverlay(int witch// adds additional layer since witch itself does not have attachment point on spine
{
    
// prevent double overlay
    
if ( IsValidEntRef(g_iOverlay[witch]) )
        return 
true;
    
    
int entity CreateEntityByName("prop_dynamic_ornament");
    if( 
entity != -)
    {
        
MoveType mt GetEntityMoveType(witch);
        
SetEntityMoveType(witchMOVETYPE_NONE);
        
DispatchKeyValue(entity"spawnflags""256");
        
DispatchKeyValue(entity"solid""0");
        
DispatchKeyValue(entity"rendermode""1");
        
DispatchKeyValue(entity"renderfx""6");
        
DispatchKeyValue(entity"renderamt""0");
        
DispatchKeyValue(entity"rendercolor""255 255 255");
        
DispatchKeyValue(entity"disablereceiveshadows""1");
        
DispatchKeyValue(entity"model""models/survivors/survivor_teenangst.mdl");
        
DispatchSpawn(entity);
        
ActivateEntity(entity);
        
SetVariantString("!activator");
        
AcceptEntityInput(entity"SetParent"witch);
        
SetVariantString("!activator");
        
AcceptEntityInput(entity"SetAttached"witch);
        
AcceptEntityInput(entity"TurnOn");
        
SetEntityMoveType(witchmt);
        
g_iOverlay[witch] = EntIndexToEntRef(entity);
        return 
true;
    }
    return 
false;

PHP Code:
    int overlay g_iOverlay[witch];
    
    
SetEntProp(weaponProp_Data"m_CollisionGroup"COLLISION_GROUP_DEBRIS);
    
SetVariantString("!activator");
    
AcceptEntityInput(weapon"SetParent"overlay);
    
//...
    
sAttach "medkit";
    
SetVariantString(sAttach);
    
AcceptEntityInput(weapon"SetParentAttachment");
    
TeleportEntity(weaponposangNULL_VECTOR);
    
SetEntPropEnt(weaponProp_Send"m_hOwnerEntity"witch); 
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 03-08-2022 at 16:15.
Dragokas is offline
LinLinLin
Senior Member
Join Date: Sep 2021
Old 03-18-2022 , 09:32   Re: Is it possible to attach bone in pluins?
Reply With Quote #3

Quote:
Originally Posted by Dragokas View Post
You can attach to a "poor" model a fake invisible overlay having desired attachment point, than attach a goal entity to that point.

Example how I did it in one of private plugins:
PHP Code:
bool ParentOverlay(int witch// adds additional layer since witch itself does not have attachment point on spine
{
    
// prevent double overlay
    
if ( IsValidEntRef(g_iOverlay[witch]) )
        return 
true;
    
    
int entity CreateEntityByName("prop_dynamic_ornament");
    if( 
entity != -)
    {
        
MoveType mt GetEntityMoveType(witch);
        
SetEntityMoveType(witchMOVETYPE_NONE);
        
DispatchKeyValue(entity"spawnflags""256");
        
DispatchKeyValue(entity"solid""0");
        
DispatchKeyValue(entity"rendermode""1");
        
DispatchKeyValue(entity"renderfx""6");
        
DispatchKeyValue(entity"renderamt""0");
        
DispatchKeyValue(entity"rendercolor""255 255 255");
        
DispatchKeyValue(entity"disablereceiveshadows""1");
        
DispatchKeyValue(entity"model""models/survivors/survivor_teenangst.mdl");
        
DispatchSpawn(entity);
        
ActivateEntity(entity);
        
SetVariantString("!activator");
        
AcceptEntityInput(entity"SetParent"witch);
        
SetVariantString("!activator");
        
AcceptEntityInput(entity"SetAttached"witch);
        
AcceptEntityInput(entity"TurnOn");
        
SetEntityMoveType(witchmt);
        
g_iOverlay[witch] = EntIndexToEntRef(entity);
        return 
true;
    }
    return 
false;

PHP Code:
    int overlay g_iOverlay[witch];
    
    
SetEntProp(weaponProp_Data"m_CollisionGroup"COLLISION_GROUP_DEBRIS);
    
SetVariantString("!activator");
    
AcceptEntityInput(weapon"SetParent"overlay);
    
//...
    
sAttach "medkit";
    
SetVariantString(sAttach);
    
AcceptEntityInput(weapon"SetParentAttachment");
    
TeleportEntity(weaponposangNULL_VECTOR);
    
SetEntPropEnt(weaponProp_Send"m_hOwnerEntity"witch); 
i think i need read more document to understand those code,
but anyway,thanks for your help.
LinLinLin is online now
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 03-18-2022 , 09:47   Re: Is it possible to attach bone in pluins?
Reply With Quote #4

I don't think you can find somewhere complete document explaining that stuff. Info is very fragmented. Most things you can found on valve wiki.
Ask, I can answer more or less if I have time.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
LinLinLin
Senior Member
Join Date: Sep 2021
Old 03-18-2022 , 10:57   Re: Is it possible to attach bone in pluins?
Reply With Quote #5

Quote:
Originally Posted by Dragokas View Post
I don't think you can find somewhere complete document explaining that stuff. Info is very fragmented. Most things you can found on valve wiki.
Ask, I can answer more or less if I have time.
emmmmmmm,
i haven't test those code yet, maybe i will get some mistakes under.

1.attach an invisible entity(prop_dynamic_ornament) to the main entity.
2.set the invisible entity model with the attachment you want.
3.let your true target attaches to the invisible entity.

Is that right?(ignore other thing like collision or color)

Actually i am afraid that the invisible entity attachmentpoint will be close to the main entity attachmentpoint i want?

For example,i am sure tank has the hand attachmentpoint.
I attach an invisble entity with tank model to the infected first,and then attach a melee to the tank's hand.
It will look like the melee is in the infected hand and will follow the infeted hand bone to move?

Althoght i get an attachmentpoint,it will be useless if it isn't the position i want or don't follow the main entity bone to move,i think.

Last edited by LinLinLin; 03-18-2022 at 11:05. Reason: some syntax error
LinLinLin is online now
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 03-18-2022 , 11:13   Re: Is it possible to attach bone in pluins?
Reply With Quote #6

All correct.
It will follow attachment point, not the specific bone.
You may need to adjust accurately the position offset and angle (relative to attachment point) for each weapon in above code in this line:
PHP Code:
TeleportEntity(weaponposangNULL_VECTOR); 
To make it accuratelty, personally I wrote menu interface, a bit similar to what is done in Silver's Hats plugin.
It looks so:
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 03-18-2022 at 11:14.
Dragokas is offline
LinLinLin
Senior Member
Join Date: Sep 2021
Old 03-18-2022 , 12:06   Re: Is it possible to attach bone in pluins?
Reply With Quote #7

Quote:
Originally Posted by Dragokas View Post
All correct.
It will follow attachment point, not the specific bone.
You may need to adjust accurately the position offset and angle (relative to attachment point) for each weapon in above code in this line:
PHP Code:
TeleportEntity(weaponposangNULL_VECTOR); 
To make it accuratelty, personally I wrote menu interface, a bit similar to what is done in Silver's Hats plugin.
It looks so:
Great help! I will try it later.
Perhaps it will be a large project because there are more than ten kinds of Infected in L4D2().
If i need to change every attachment position of every infected awhhhh.

Last edited by LinLinLin; 03-18-2022 at 12:13. Reason: some lose
LinLinLin is online now
LinLinLin
Senior Member
Join Date: Sep 2021
Old 03-18-2022 , 21:09   Re: Is it possible to attach bone in pluins?
Reply With Quote #8

Quote:
Originally Posted by Dragokas View Post
All correct.
It will follow attachment point, not the specific bone.
You may need to adjust accurately the position offset and angle (relative to attachment point) for each weapon in above code in this line:
PHP Code:
TeleportEntity(weaponposangNULL_VECTOR); 
To make it accuratelty, personally I wrote menu interface, a bit similar to what is done in Silver's Hats plugin.
It looks so:
Yeah,i understand what is prop_dynamic_ornament.
It will let the attachment entity move like using the main entity bone.

Something like the first image.

I get my target,but it seem to be trouble to adjust the pos and ang awhhh.
Attached Images
File Type: jpg tank.jpg (54.1 KB, 58 views)
File Type: jpg test.jpg (42.5 KB, 41 views)
LinLinLin is online now
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 03-19-2022 , 06:33   Re: Is it possible to attach bone in pluins?
Reply With Quote #9

Please, don't quote all and every post. It is very hard to read.
And yeah, it is very hard process of adjusting. That's why I proposed to make a menu interface.
You freeze the client, than working with correction of position / angles. It's not fast.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas 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 16:49.


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