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

Creating an Entity which is Parented to a player and triggers "trigger_multiple"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OSWO
Senior Member
Join Date: Jul 2015
Location: United Kingdom, London
Old 08-14-2019 , 22:30   Creating an Entity which is Parented to a player and triggers "trigger_multiple"
Reply With Quote #1

Hello, I'm trying to create an entity that follows a player, I've tried multiple threads for using the "SetParent", but none of the entities are "following" the player, and neither is it being teleported to the Players correct cords. The entity must also trigger "trigger_multiple" too, the flags on the "trigger_multiple" is "1088".

I've tried 0.1 timers between using SetParent and SetParentAttachment etc.

The 1.0 Timer includes me moving in-game too.

PHP Code:
void EntityPlayer(int iClient) {
    
float fPos[3];
    
GetClientAbsOrigin(iClientfPos);
    
PrintToChatAll("CReating: %i, %f, %f, %f"iClientfPos[0], fPos[1], fPos[2]);
    
int iEntity CreateEntityByName("trigger_multiple");
    if (
iEntity && IsValidEntity(iEntity)) {
        
char[] cBuffer = new char[512];
        
SetEntityModel(iEntity"models/error.mdl");

        
Format(cBuffer512"cclient%i"iClient);
        
DispatchKeyValue(iClient"targetname"cBuffer);

        
SetVariantString("!activator");
        
AcceptEntityInput(iEntity"SetParent"iClient);  
        
SetEntityMoveType(iEntityMOVETYPE_NOCLIP);

        if (
DispatchSpawn(iEntity)) {
            
PrintToChatAll("Spawned %i"iEntity);

            
DataPack pack = new DataPack();
            
pack.WriteCell(iEntity);
            
pack.WriteCell(iClient);
            
CreateTimer(0.1Timer_Assignpack);

            
CreateTimer(1.0Timer_EntityiEntityTIMER_REPEAT);
        }
    }
}

public 
Action Timer_Assign(Handle hTimerDataPack pack) {
    
PrintToChatAll("Running");
    
pack.Reset();
    
int iEntity pack.ReadCell();
    
int iClient pack.ReadCell();

    
PrintToChatAll("%i, %i"iEntityiClient);
    
//AcceptEntityInput(iEntity, "SetParentAttachment", iClient, iEntity);
}

public 
Action Timer_Entity(Handle hTimerint iEntity) {
    if (
IsValidEntity(iEntity)) {
        
float fPos[3];
        
GetEntPropVector(iEntityProp_Send"m_vecOrigin"fPos);

        
PrintToChatAll("Entity: %i, %f, %f, %f"iEntityfPos[0], fPos[1], fPos[2]);
    }

__________________
SourceTimer | WeaponSkins++ | BasePlugins++ https://github.com/OSCAR-WOS

Last edited by OSWO; 08-14-2019 at 22:39.
OSWO is offline
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 08-15-2019 , 05:43   Re: Creating an Entity which is Parented to a player and triggers "trigger_multiple"
Reply With Quote #2

You should try to attach it to a valid attachmentpoint with :

SetVariantString("facemask"); as example.

You could get a list with attachmentpoints on HLMV Modelviewer for your game......
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<
andi67 is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 08-15-2019 , 14:39   Re: Creating an Entity which is Parented to a player and triggers "trigger_multiple"
Reply With Quote #3

iirc m_vecOrigin of a parented entity gets the local origin, essentially the Entity being parented to becomes it's 0,0,0. There's another netprop that gets the absolute origin of an entity.
Mitchell is offline
OSWO
Senior Member
Join Date: Jul 2015
Location: United Kingdom, London
Old 08-15-2019 , 17:30   Re: Creating an Entity which is Parented to a player and triggers "trigger_multiple"
Reply With Quote #4

Quote:
Originally Posted by andi67 View Post
You should try to attach it to a valid attachmentpoint with :

SetVariantString("facemask"); as example.

You could get a list with attachmentpoints on HLMV Modelviewer for your game......
I've tested with that too still not the correct position.

Quote:
Originally Posted by Mitchell View Post
iirc m_vecOrigin of a parented entity gets the local origin, essentially the Entity being parented to becomes it's 0,0,0. There's another netprop that gets the absolute origin of an entity.
Do you know what the netprop is called? I've looked at them all still cannot find it
__________________
SourceTimer | WeaponSkins++ | BasePlugins++ https://github.com/OSCAR-WOS
OSWO 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 13:29.


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