Playmaker Forum

PlayMaker News => General Discussion => Topic started by: wirejaw on June 28, 2021, 11:26:23 PM

Title: Prefab enemies and waypoints
Post by: wirejaw on June 28, 2021, 11:26:23 PM
Hello PlayMakers.  I've encountered an issue with enemies and waypoints.  I have several enemies built as prefabs that need to follow a variety of waypoint objects, however I've realized the enemies (prefabs) will not recognize waypoint objects unless those waypoint objects have been set into global variables.  Is there a graceful and efficient way to handle this?  I'm hoping to avoid having to make every single waypoint in my game into a global variable.

Thanks much for any help!
Title: Re: Prefab enemies and waypoints
Post by: djaydino on June 29, 2021, 07:32:24 AM
Hi.
you can have a 'Waypoint List' object.
on that, use a Array List (Array Maker (https://hutonggames.fogbugz.com/?W715))
You can add several way point lists if you wish.
the lists can be objects or vector 3 positions.

you can set this single object as a global.
or if you have a object that is in globals, then you can add a gameobject variable and you can get the reference by using get fsm gameobject.
Title: Re: Prefab enemies and waypoints
Post by: wirejaw on June 29, 2021, 10:38:43 AM
Thanks djdino.  I downloaded the Array Maker package, but I'm not seeing any new actions and getting this error.
Title: Re: Prefab enemies and waypoints
Post by: djaydino on July 01, 2021, 10:03:26 AM
Hi.
The image is a bit to small to read.

But you might need to download playmaker utills
right after downloading Arraymaker
Title: Re: Prefab enemies and waypoints
Post by: CuriousRodeo on July 19, 2021, 08:10:11 AM
You can also use the "Find Game Object" action on an FSM in your enemies prefab.
This searches the Hierarchy by String (or exact naming of an Object), or by tag, or both.

If your Waypoints are parented to another object, you will need to search for the parent object and then use the Find Child action for each of the child objects.
Title: Re: Prefab enemies and waypoints
Post by: djaydino on July 21, 2021, 09:03:00 AM
Hi.
Its not advisable to use 'Find Game Object' During gameplay.
Only use this when loading scenes or during some breaks in the game.

for something like this its better the way i said in my earlier post
Title: Re: Prefab enemies and waypoints
Post by: colpolstudios on August 28, 2021, 06:23:40 PM
Hi.
Its not advisable to use 'Find Game Object' During gameplay.
Only use this when loading scenes or during some breaks in the game.

for something like this its better the way i said in my earlier post

Would you possibly have time to explain more information in this regard please?
Title: Re: Prefab enemies and waypoints
Post by: djaydino on August 28, 2021, 07:52:45 PM
Hi.
Find Game Object will look to all objects in your scene.
which is not an efficient way to do this during gameplay.
its ok to use @ start when scene gets loaded.