Playmaker Forum

PlayMaker Feedback => Action Requests => Topic started by: Farwest on May 10, 2018, 05:16:01 PM

Title: Using Variables in Destroy Objects Action[SOLVED]
Post by: Farwest on May 10, 2018, 05:16:01 PM
Hi!
I am using GameObjects as variables in my project. And I need to use "Destroy Objects" action (downloaded from Ecosystem), but I am unable to use variables, instead I need to choose manually.

If I use "Destroy Object" action, I need to duplicate the action a lot, which is very time consuming and flooding the State browser very much. Destroy Objects will make this action in a tidy way.

(http://oi67.tinypic.com/2ai22pf.jpg)

If you can make DestroyObjects with variables, same as "Destroy Object" action, I will appreciate greatly! Thanks!
Title: Re: Using Variables in Destroy Objects Action
Post by: jeanfabre on May 11, 2018, 03:27:35 AM
Hi,

 what you need to do is create an FsmArray, populate that array, and then use that array directly, like so:

(https://i.imgur.com/rQWOGI8.png)

Bye,

 Jean
Title: Re: Using Variables in Destroy Objects Action
Post by: Farwest on May 11, 2018, 07:08:02 AM
Hi jeanfabre!
If you had added any image or schema in your message ( ":" ), it seems it doesn't appear.

I am a designer who purely depend on Playmaker and I am not good at modifying scripts much.
As this is "Action Requests" thread, I will appreciate very much if you can provide such array or guide me doing that. Thanks!
Title: Re: Using Variables in Destroy Objects Action
Post by: jeanfabre on May 11, 2018, 09:49:11 AM
hi,

 The action works as you intended, but I think you are getting confused by the principle of operation.

1: create an FsmArray of type GameObjects
2: set the content of the array, either during editing, or at runtime in your fsm logic to populate the list to all the GameObject you want to destroy
3: reference that FsmArray in your destroy action.

 Let me know if that doesn't help.

 Bye,

 Jean
Title: Re: Using Variables in Destroy Objects Action
Post by: Farwest on May 11, 2018, 10:05:19 AM
Sorry, that is not what I am looking for. I was looking for something easier and tidier to destroy, such as the picture I gave example (I made action request for this purpose eventually), additionally I mentioned I am not good at script editing.

Thanks. Bye.
Title: Re: Using Variables in Destroy Objects Action
Post by: jeanfabre on May 14, 2018, 02:02:53 AM
Hi,

 ok, no problem, At least you know how it should be done. another way is to use a loop using arraygetnext and destroy each go isnide the array one after the other, it will work very well too.

 Bye,

 Jean

 Bye,

 Jean
Title: Re: Using Variables in Destroy Objects Action
Post by: djaydino on May 14, 2018, 06:02:53 AM
Hi.
I made an action for you.

Search for 'destroy object multi' on the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181)

But i also do think its better/easier to use an array, as it is more flexible to use.

Arrays are like a list of variables (objects/ints/floats/materials/...) and very useful in many cases.

Here is a tutorial video about arrays :

Title: Re: Using Variables in Destroy Objects Action
Post by: Farwest on May 14, 2018, 11:16:40 AM
Thanks jeanfabre, I already do loop there, but I don't want to complicate the things with additional actions and additional loops, because I handle dozens or hundreds of unit management in that FSM already, that's why I needed a tidier Destroy function for "multiple objects as variables" at once.

Thanks djaydino, you made my day! What you prepared was what I was looking for, thanks a lot and be blessed!