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

[CS:S] SetParentAttachmentMaintainOffset Entity Input Failing only on linux.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
backwards
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 05-24-2018 , 01:31   [CS:S] SetParentAttachmentMaintainOffset Entity Input Failing only on linux.
Reply With Quote #1

The following error occurs when running the same code on a linux system that works on a windows system.

PHP Code:
ERRORTried to SetParentAttachmentMaintainOffset for entity prop_dynamic (prop_dynamic), but it has no attachment named baseorigin


The model I've created only has a single bone and that bone is used as an attachment point with no offset.



The QC file to compile the model is really simple.



Both the windows and linux server are running the same base sourcemod install plugins.

Looking at the function in the SDK the LookupAttachment function is failing.

This should obviously only fail if the entity's model doesn't have any attachments with the lookup name.

This is how the code is structured
PHP Code:
new ent CreateEntityByName("prop_dynamic_override");
....
TeleportEntity(ent, or, angNULL_VECTOR); 
    
SetVariantString("!activator");
AcceptEntityInput(ent"SetParent"clientent0);
    
SetVariantString("baseorigin");
AcceptEntityInput(ent"SetParentAttachmentMaintainOffset"entent0); 
I check the model before setting it like so to validate it's the correct one.

PHP Code:
decl String:m_ModelName[PLATFORM_MAX_PATH];
GetEntPropString(clientProp_Data"m_ModelName"m_ModelNamesizeof(m_ModelName));

if (
strcmp(m_ModelName"models/player/Placeholder_Model/placeholder_model.mdl") != 0)
{
    
PrintToChat(client"%s"m_ModelName);
    
Format(m_OrginalModelName[client], PLATFORM_MAX_PATH"%s"m_ModelName);
    
SetEntityModel(client"models/player/Placeholder_Model/placeholder_model.mdl");

Using delays in timers after setting the model or using BoneMerge doesn't seem to fix the issue either.

PHP Code:
public void Bonemerge(int ent)
{
    
int m_iEntEffects GetEntProp(entProp_Send"m_fEffects"); 
    
m_iEntEffects &= ~32;
    
m_iEntEffects |= 1;
    
m_iEntEffects |= 128;
    
SetEntProp(entProp_Send"m_fEffects"m_iEntEffects); 

I'm curious if anyone knows the reason for this as i haven't seen a single topic about this issue. Is there some dumb rule that isn't mentioned on the Developer.Valve website like "root bones can not be attachments and must have a child bone"? (which i know isn't right since it works on windows)
__________________
I highly recommend joining the SourceMod Discord Server for real time support.
backwards is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 05-24-2018 , 09:50   Re: [CS:S] SetParentAttachmentMaintainOffset Entity Input Failing only on linux.
Reply With Quote #2

The attachment must exist on the player's model not the model you created. Try setting the attachment point to "forward"
Mitchell is offline
backwards
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 05-24-2018 , 17:30   Re: [CS:S] SetParentAttachmentMaintainOffset Entity Input Failing only on linux.
Reply With Quote #3

Quote:
Originally Posted by Mitchell View Post
The attachment must exist on the player's model not the model you created. Try setting the attachment point to "forward"
Sorry for not being clear about this part but this is a secondary model I've created which i turn into the players model so that i can utilize pos (0 0 0) since the default models have no attachment at this position. This player model is turned invisible and is only used for this attachment point so that i can utilize the "m_flPoseParameter" netprop on the prop_dynamic_override. If I just assign the model to the player and attempt to use those they appear to be overwritten by game code constantly, even if i add 23 bogus pose parameters and attempt to set the 24th one it still seems to be overwritten. The thing is i don't believe anything is wrong with the setup as the attachment point works just fine on my windows system srcds but on the two linux srcds they just throw out this error and prevent the attachment.

Here's a quick video i made describing the issue.
https://www.youtube.com/watch?v=p_SwyaDHQ3w

Edit: I've made a work around after debugging the process and realizing it's not populating the array of data for studiohdr_t related information after using SetEntityModel. The loop exits before comparing the string for the input attachment point name here at GetNumAttachments(). So after looking deeper into the code I decided to try calling the main function with my own identifier of the attachment point which should be 1 in this case. Using SDKTools here's the config file with signatures to call the function in cstrike.
PHP Code:
"Games"
{
    
"cstrike"
    
{
        
"Signatures"
        
{
            
"SetParent"
            
{
                
"library"    "server"
                "linux"        "@_ZN11CBaseEntity9SetParentEPS_i"
                "windows"    "\x55\x8B\xEC\x81\xEC\x2A\x2A\x2A\x2A\x83\x7D\x0C\xFF"
            
}
        }
    }

And to call the function inside sourcemod.

PHP Code:
#include <sdktools>
new Handle:g_hSetParent INVALID_HANDLE;
...

public 
OnPluginStart()
{
    new 
Handle:m_hGameConf LoadGameConfigFile("mario_wheelchair.gamedata");
    
StartPrepSDKCall(SDKCall_Entity);
    
PrepSDKCall_SetFromConf(m_hGameConfSDKConf_Signature"SetParent");
    
PrepSDKCall_AddParameter(SDKType_CBaseEntitySDKPass_Pointer);
    
PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_Plain);
    
g_hSetParent EndPrepSDKCall();
    
CloseHandle(m_hGameConf);
        
    if(!
g_hSetParent)
    {
        
LogError("SetParent signature is out of date or not supported in this game.");
        return;
    }
}
...
public 
SetParent(cliententiAttachment)
{
    if(
g_hSetParent==INVALID_HANDLE)
        return;
    if(!
client || !IsClientInGame(client))
        return;
        
    
SDKCall(g_hSetParententclientiAttachment);
}
...

    
TeleportEntity(ent, or, angNULL_VECTOR); 
    
    
SetVariantString("!activator");
    
AcceptEntityInput(ent"SetParent"clientent0);
    
    
SetParent(clientent1); 
Topic can be changed to resolved.
__________________
I highly recommend joining the SourceMod Discord Server for real time support.

Last edited by backwards; 05-25-2018 at 22:53. Reason: video & resolution
backwards is offline
Reply


Thread Tools
Display Modes

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 10:34.


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