playMaker

Author Topic: Game Objects to Objects?  (Read 2943 times)

MarkD

  • Full Member
  • ***
  • Posts: 113
Game Objects to Objects?
« on: December 23, 2015, 01:44:31 AM »
Disclaimer:  I barely know what I'm talking about when it comes to scripting, so please explain things as if I'm your average golden retriever.

In my project, I have an AI that searches for gameobjects with a specific tag.  These objects it's looking for our patrol paths used with Apex Path.

My FSM finds the objects with the correct tag and stores them in a Playmaker Array and then randomly chooses one of those and stores it as a Game Object.

Now, the Apex Patrol Path has a variable on it called "Route" where I can manually drag a gameobject into to set.  But when I try to do this with a variable, it only accepts gameobject with a specific type, specific to Apex Path. 

I can brute force my way around this, but.. guh.. that'll be ugly.  I was wondering if there's some way to convert a game object to the object type the script will take?  I've looked through the actions several times and can't find anything.

Does any of this make sense to anyone else, and if so, any ideas? 

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Game Objects to Objects?
« Reply #1 on: December 23, 2015, 02:06:41 AM »
You can try creating a new "object" variable type to hold the apex var- with the object type var you can use any object in the unity engine so the apex var type might be available that way-

Create a new "object" type var in Playmaker- then in the var settings click "Object type" and see if you can find the one you want
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

MarkD

  • Full Member
  • ***
  • Posts: 113
Re: Game Objects to Objects?
« Reply #2 on: December 23, 2015, 06:43:30 PM »
I think I've already done what you're suggesting and it's not exactly what the problem is (at least so I think).

Let me break it down for you with a little more detail and some pictures.



On my AI object, I have this script.  I want to use a variable in Playmaker to  provide the gameobject that should be placed inside.  I can drag a Gameobject from the scene (as shown) into this field and it works perfectly.



This is my FSM where I am finding all of the game objects with a specific tag and then pulling one at random.  The playmaker array doesn't have an option for "Object", but it does for Gameplay.  The object I want to be placed in there is a gameplay object so that seems like a good idea.

If I try to pull an "object" type from the array it doesn't find or store anything.  So I have to use a gameplay object.

In this last part of the FSM, I'm attempting to set the "Route" property on the script.  Gameplay objects aren't recognized, but if I make an object variable of the type "apex.Steering.Props.PatrolRoute" it IS recognized.



So - I seem to only be able to store and pull gameobjects from my array and set property on the script only takes objects of a specific type. 

I don't know how to translate between the two.  Does that make sense? 


mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Game Objects to Objects?
« Reply #3 on: December 23, 2015, 09:56:17 PM »
Ok I see- hmmm- you could store the name of the object var as a string in a normal array- then use that string to access the object variable using a string compare/switch
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

MarkD

  • Full Member
  • ***
  • Posts: 113
Re: Game Objects to Objects?
« Reply #4 on: December 24, 2015, 01:54:16 PM »
Thanks - I might just be not fully understanding your idea, but I couldn't find a way to make what your suggesting work. 

Maybe I'm not getting the string compare/switch thing?