playMaker

Author Topic: "Find Closest Parent (up the chain) with tag/name X"?  (Read 355 times)

westingtyler

  • Full Member
  • ***
  • Posts: 125
    • View Profile
"Find Closest Parent (up the chain) with tag/name X"?
« on: March 07, 2017, 10:05:46 PM »
Rather than adding a thousand loops and get parent and check tag commands, it would be great to have this. So when I shoot someone's hand, it can go up the chain and find out the name of the person it belongs to, for instance.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: "Find Closest Parent (up the chain) with tag/name X"?
« Reply #1 on: March 12, 2017, 11:14:56 PM »
Hi,

 Have you tried "Get Root", it's likely what you need. Else I'll do a custom action.

 Bye,

 Jean

beowulfkaine

  • Playmaker Newbie
  • *
  • Posts: 44
    • View Profile
Re: "Find Closest Parent (up the chain) with tag/name X"?
« Reply #2 on: July 09, 2017, 02:17:08 PM »
Hi,

 Have you tried "Get Root", it's likely what you need. Else I'll do a custom action.

 Bye,

 Jean

Thank you so much for the suggestion. Although what you mentioned didn't exactly work (though it did literally do what it was meant to do) I had a nested gameobject within a game object:

Arrow
Misc (folder)
Arrows-->
     ->Base Arrow
          ->Arrow Prop
     ->Ice Arrow
          ->Arrow Prop

So the get parent got the parent of the immediate folder.  So it did what it was suppose to, but I needed to get the Root parent. This is because when the arrow is fired, the parent tag determines what effect the target displays. (Ice Arrow = Ice effect on target) ect..

So although your method may have not worked, it definitely put me on the path to discovering how to use "Get (whatever) action.  Which led me to do a down and dirty mod to do it.  I don't know if there is an action that makes this easier than the way I did it, but this is what I have done:





I don't know if there is a n easier way or maybe an action that streamlines all this, but this seems to work pretty good.

Oh and I should mention, the arrow objects within the gameobject are enabled and disabled on command, thus starting the FSM that turns the tag to whatever arrow it is.