Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Fat Pug Studio on February 04, 2019, 02:11:25 PM

Title: Question about FsmVar
Post by: Fat Pug Studio on February 04, 2019, 02:11:25 PM
Hi guys,

I have an issue, but i need to know how some things work to know how to solve it.

I'm using get array list random to get a random GameObject from array list. Now, when  i instantiate that object with Create Object Advanced it's ok, but when i use Core Game Kit and set the GameObject to spawn it spawns the wrong thing.

I suppose FsmVar is changeable variable that sets its type depending on the type of variable in the action by using PlayMakerUtils.ApplyValueToFsmVar, but why doesn't it work in things like Core Game Kit?

I'll dig up the code to the action of CGK to see how it's handled there, but isn't FsmVar automatically converted to GameObject variable in the Get Array List Random action?
Title: Re: Question about FsmVar
Post by: jeanfabre on February 05, 2019, 01:55:54 AM
Hi,

 you'll need to debug what's being read when you use CoreGameKit, maybe the value is not what you expected because of a logical issue within your fsm? else, what if you wait one frame?

if you have some code sample, it will help, I am not sure how you work with playmaker and coregamekit and where fsmvar are involved ( never used it)

Bye,

 Jean
Title: Re: Question about FsmVar
Post by: Fat Pug Studio on February 05, 2019, 07:45:28 AM
Waiting for a frame does not solve it unfortunately.

CGK action for spawning uses FsmGameObject as a reference.

Code: [Select]
prefabToSpawn = new FsmGameObject();
So, what should i do with FsmVar to use it as an FsmGameObject?

Title: Re: Question about FsmVar
Post by: jeanfabre on February 06, 2019, 02:08:58 AM
Hi,

 Sorry, I am not sure I follow, can you give a concrete example with code that I can run so that I see what you are trying to achieve?

why do you want an fsmvar here?

Bye,

 Jean
Title: Re: Question about FsmVar
Post by: Fat Pug Studio on February 06, 2019, 02:36:05 AM
Hi Jean,

check pm.
Title: Re: Question about FsmVar
Post by: Fat Pug Studio on February 09, 2019, 07:04:36 PM
Any news on this one? I'll try modifying the action to get random gameobject from array list.
Title: Re: Question about FsmVar
Post by: jeanfabre on February 11, 2019, 12:58:52 AM
Hi,

 Did not get any pm :)

Bye,

 Jean
Title: Re: Question about FsmVar
Post by: Fat Pug Studio on February 11, 2019, 03:48:03 AM
Ok, i've sent it again.
Title: Re: Question about FsmVar [SOLVED]
Post by: Fat Pug Studio on February 16, 2019, 12:51:58 PM
Works when i use setgameobject then use that variable. Thanks Jean!
Title: Re: Question about FsmVar[SOLVED]
Post by: Fat Pug Studio on March 07, 2019, 07:56:24 AM
Ok, i have to bump this, there's something fishy going on.

I have an arraylist

(https://i.postimg.cc/nz6Tdhgm/screenshot-229.png)

I get a random item from the array

(https://i.postimg.cc/xjvKr5bh/screenshot-230.png)

I set the game object since it saves the item as fsmvar

(https://i.postimg.cc/V6jb8s5n/screenshot-231.png)

It saves it nice and dandy into variable

(https://i.postimg.cc/x8nNTrb7/screenshot-232.png)

Then i spawn it

(https://i.postimg.cc/J0xDsTNh/screenshot-233.png)

But as you can see it spawns an object that is not even in the arraylist! But the worst thing is that it sometimes does the job properly and spawns the selected game object, and sometimes it spawns this. Worst thing part 2: wrong prefab is always the same.
Title: Re: Question about FsmVar
Post by: djaydino on March 07, 2019, 11:07:52 AM
Hi.
From the 1st look of it, it think the core game kit has to do something with it.

try enabling debug (bottom/left on the state window/tab)
and set a few breakpoints.

so you can see as the selected random is correct, if so go next step.
Title: Re: Question about FsmVar
Post by: Fat Pug Studio on March 12, 2019, 02:14:31 PM
Yeah, probably Core Game Kit has something to do, though the code looks clean. I'll check out with Brian anyway.