playMaker

Author Topic: Using Variables in Destroy Objects Action[SOLVED]  (Read 2839 times)

Farwest

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 63
Using Variables in Destroy Objects Action[SOLVED]
« 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.



If you can make DestroyObjects with variables, same as "Destroy Object" action, I will appreciate greatly! Thanks!
« Last Edit: May 16, 2018, 02:40:47 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Using Variables in Destroy Objects Action
« Reply #1 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:



Bye,

 Jean

Farwest

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 63
Re: Using Variables in Destroy Objects Action
« Reply #2 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!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Using Variables in Destroy Objects Action
« Reply #3 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

Farwest

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 63
Re: Using Variables in Destroy Objects Action
« Reply #4 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.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Using Variables in Destroy Objects Action
« Reply #5 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

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Using Variables in Destroy Objects Action
« Reply #6 on: May 14, 2018, 06:02:53 AM »
Hi.
I made an action for you.

Search for 'destroy object multi' on the Ecosystem

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 :


Farwest

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 63
Re: Using Variables in Destroy Objects Action
« Reply #7 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!