Raised This Month: $153 Target: $400
 38% 

How to SetParent


Post New Thread Reply   
 
Thread Tools Display Modes
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 05-24-2015 , 20:50   Re: How to SetParent
Reply With Quote #11

In retrospect, the reason the valve wiki says to wait "a frame" is probably directed at mappers firing inputs via entities... who knows what order those actually get fired in when you have a list of different inputs that happen on the same trigger.

In sourcepawn... you can actually control that. ;p

I still have no idea what the difference between SetParentAttachment and MaintainOffset is. I tried both and they seemed to work identically, both teleporting the entity to the attachment point. I have no idea what "offset" they're talking about. How far the position of the child is offset from the parent? Doesn't seem like it, since it just teleports to the attachment point anyway...???
__________________

Last edited by Chdata; 05-24-2015 at 20:51.
Chdata is offline
SoulSharD
Member
Join Date: Oct 2013
Location: United Kingdom
Old 05-25-2015 , 18:30   Re: How to SetParent
Reply With Quote #12

Quote:
Originally Posted by Chdata View Post
I still have no idea what the difference between SetParentAttachment and MaintainOffset is. I tried both and they seemed to work identically, both teleporting the entity to the attachment point. I have no idea what "offset" they're talking about. How far the position of the child is offset from the parent? Doesn't seem like it, since it just teleports to the attachment point anyway...???
I do believe they're identical, though I've only tested them in Team Fortress 2.
__________________

SoulSharD is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 01-28-2017 , 17:38   Re: How to SetParent
Reply With Quote #13

Funny thing, apparently my common stocks .inc had

PHP Code:
AcceptEntityInput(iChild"SetParent"iParentiParent); 
Which prevents ClearParent from working properly.

Be sure not to make this mistake ;p


So what do you do to remove particles that linger even if you Stop and Kill them? ("duel_blue" and "duel_red")

PHP Code:
RemoveDuelIcon()
{
    new 
iDuel EntRefToEntIndex(g_iDuelTargetEntRef);
    if (
IsValidEnt(iDuel))
    {
        
AcceptEntityInput(iDuel"ClearParent");
        
TeleportEntity(iDuelOFF_THE_MAPNULL_VECTORNULL_VECTOR);
        
//DelayEntityInput(iDuel, "Stop", 0.05);
        
DelayEntityInput(iDuel"Kill"0.1);
        
g_iDuelTargetEntRef INVALID_ENTREF;
    }

The "Kill" input has to be sent later apparently, else the entity dies in place and leaves its remnants.

duel_icon particles apparently have a long lifetime which is why the particle persists even after the entity is destroyed.
__________________

Last edited by Chdata; 01-29-2017 at 05:57.
Chdata is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 01-30-2017 , 20:35   Re: How to SetParent
Reply With Quote #14

Set parent does not use attachment points, it uses the origin. If you do to a player it is their feet.
Like you can parent almost any entity to another, like a prop dynamic to a func door.
Set parent attachment uses the attachment points, and offset keeps the original xyz offset from eachother
__________________
Profile - Steam Group - Plugins - Blog - Donate
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 02-03-2017 , 16:11   Re: How to SetParent
Reply With Quote #15

Does offset keep the xyz offset from each other based off of an attachment point, or just the origin?
__________________
Chdata is offline
404UserNotFound
( ͡ ͜ʖ ͡)
Join Date: Dec 2011
Location: 🍁
Old 02-06-2017 , 16:12   Re: How to SetParent
Reply With Quote #16

Ooh, very useful info that'll help me fix some old-ass issues from several years ago involving certain particle effects in TF2 remaining after they're killed. I remember those issues from the old AttachParticle stock that many plugins passed around (had two attachment points, "head" and "back" I think). Circling TF particle for example would remain after being killed. mp_restartgame 1 cleared it right up though.

Not to mention, parenting is also used in that recent Piggyback plugin, so this further info on SetParent/ClearParent is nice to have.
__________________
I'm not a SourcePawn expert, I just play one on TV.
Want to join the SourceMod Discord server? Click here!


Last edited by 404UserNotFound; 02-06-2017 at 16:13.
404UserNotFound is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 02-10-2017 , 07:55   Re: How to SetParent
Reply With Quote #17

Quote:
Originally Posted by abrandnewday View Post
Ooh, very useful info that'll help me fix some old-ass issues from several years ago involving certain particle effects in TF2 remaining after they're killed. I remember those issues from the old AttachParticle stock that many plugins passed around (had two attachment points, "head" and "back" I think). Circling TF particle for example would remain after being killed. mp_restartgame 1 cleared it right up though.

Not to mention, parenting is also used in that recent Piggyback plugin, so this further info on SetParent/ClearParent is nice to have.


Children inherit their parent's attachment points iirc.
You could just parent to a weapon and use an attachment point on the player since it's bonemerged. I forget but I think I used to do this to weapons using the hand attachment for weapons... weapons themselves had no ap.
__________________
Profile - Steam Group - Plugins - Blog - Donate
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
404UserNotFound
( ͡ ͜ʖ ͡)
Join Date: Dec 2011
Location: 🍁
Old 02-10-2017 , 14:48   Re: How to SetParent
Reply With Quote #18

Quote:
Originally Posted by friagram View Post
Children inherit their parent's attachment points iirc.
You could just parent to a weapon and use an attachment point on the player since it's bonemerged. I forget but I think I used to do this to weapons using the hand attachment for weapons... weapons themselves had no ap.
You always know when to show up and dispense much-needed advice friagram
__________________
I'm not a SourcePawn expert, I just play one on TV.
Want to join the SourceMod Discord server? Click here!

404UserNotFound is offline
Mitchell
~lick~
Join Date: Mar 2010
Location: noitacoL:
Old 02-16-2017 , 13:57   Re: How to SetParent
Reply With Quote #19

Quote:
Originally Posted by abrandnewday View Post
You always know when to show up and dispense much-needed advice friagram
I have a work example in my WeaponAttachementAPI:
https://github.com/MitchDizzle/Weapo...I.sp#L102-L111
I use it to find the end of a player's barrel by parenting the same weapon model as a prop_dynamic to their player model and using setparentattachment on a info_target to get the abs position from.
__________________
Mitchell is offline
404UserNotFound
( ͡ ͜ʖ ͡)
Join Date: Dec 2011
Location: 🍁
Old 02-16-2017 , 14:22   Re: How to SetParent
Reply With Quote #20

Quote:
Originally Posted by Mitchell View Post
I have a work example in my WeaponAttachementAPI:
https://github.com/MitchDizzle/Weapo...I.sp#L102-L111
I use it to find the end of a player's barrel by parenting the same weapon model as a prop_dynamic to their player model and using setparentattachment on a info_target to get the abs position from.
Dude that is pretty damn cool. Specifically the parenting the same weapon model and using an info_target entity to grab the position part.
__________________
I'm not a SourcePawn expert, I just play one on TV.
Want to join the SourceMod Discord server? Click here!

404UserNotFound 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 18:26.


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