Can you clear Setparentattachment?

Discussion in 'Mapping Questions & Discussion' started by TheMightyGerbil, Nov 28, 2017.

  1. TheMightyGerbil

    TheMightyGerbil L1: Registered

    Messages:
    36
    Positive Ratings:
    8
    I've successfully "setparent" a player to a model and then "setparentattachment" the player to the attachment point but "clearparent" doesn't release the player. If I only "setparent" then "clearparent" it works.

    I'm guessing but it seems like there has to be another keyvalue that setparentattachment sets on the player that needs to be cleared.

    The only thread I've found referring to this is on CSGO https://gamebanana.com/threads/194852 where he mentions using AddOutput > movetype 1 to fix it but this does not appear to work.
     
    Last edited: Nov 28, 2017
  2. Izotope

    aa Izotope Never releases maps

    Messages:
    608
    Positive Ratings:
    568
    It should be working though.
    Try leaving the parameter field empty when doing SetParentAttachment and see if that clears it.
     
    • Thanks Thanks x 1
  3. henke37

    aa henke37

    Messages:
    1,876
    Positive Ratings:
    440
    Parenting to nothing should mean parenting to the worldspawn, which should be the same as having no parent.
     
    • Thanks Thanks x 1
  4. TheMightyGerbil

    TheMightyGerbil L1: Registered

    Messages:
    36
    Positive Ratings:
    8
    I tried leaving the SetParentAttachment parameter blank but it didn't work. Tried 0 and "" earlier and it didn't work either, (fun side fact apparently "" parses the vmf file so it won't compile correctly.

    I've got to go to sleep atm but I'll work on it more tomorrow or tonight. I'll try to make up a simplified vmf to eliminate any possibility of another entity causing the problem.
     
  5. Tumbolisu

    aa Tumbolisu  I ⌄ I 

    Messages:
    937
    Positive Ratings:
    905
    Worst case use a dummy entity inbetween the steps. For example, an info_target.
    SetParent and SetParentAttachment the info_target to your model.
    SetParent the player to the info_target and then ClearParent again.
     
    • Thanks Thanks x 1
  6. TheMightyGerbil

    TheMightyGerbil L1: Registered

    Messages:
    36
    Positive Ratings:
    8
    After beating my head against working on a Tabletop Simulator model problem I finally got back to working on this a few hours and beating my head against it for a change, fun XD.

    Unfortunately this causes the same problem I get when I SetParent a player directly to a moving model. When the parent model moves it jerks the child, you, around un-smoothly and inconsistently. If I had to guess it's probably because in this mode the child's position (at least if they are a player) is updated after the parent moves while as an attachment both are updated in tandem.

    At this point I've tried three things which all freed the player from being an attachment but only one is really an option, and not one I like.

    1. toggle noclip. Requires using a point_servercommand, blah.
    2. respawn the player. Can't find a way to respawn a single player, blarg.
    3. kill the player to respawn them. I'd much rather players just be able to exit the vehicle.

    Again this https://gamebanana.com/threads/194852 is the only thread I've found referencing the problem and it's solution does not appear to work so maybe I'm doing something wrong? Movetype appears to be code and not a setting you can change?

    Also tried a trigger_add_tf_player_condition to see if a movement condition could reset it but that did nothing.

    Attached below is a super simplified, no moving model, vmf I made for testing if anyone thinks they can get it working. Currently the second setparentattachment shows an error because I left it blank. It's blank because because no parameter I've put in worked to clear it. The following clearparent obviously doesn't clear it either.

    Thanks if you have any ideas. If you don't get a quick response I have to go to sleep soon and who knows when I can get back to this.
     

    Attached Files: