playMaker

Author Topic: Send local events to template using actions  (Read 3273 times)

agelvik

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 46
Send local events to template using actions
« on: December 21, 2018, 02:04:15 AM »
Hey,
is there a way to send local events to game objects ran by a template without using any scripts? With actions such as "Send event by name" etc... It doesn't seem to work.
I saw a "Store ID" input option on the "Run FSM" action, but not quite sure what to do with this. Does it have a function for something?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Send local events to template using actions
« Reply #1 on: December 21, 2018, 02:22:11 AM »
Hi,
What unity / playmaker version are you using?

I believe send event by name should work.

can you show some images of your setup?

agelvik

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 46
Re: Send local events to template using actions
« Reply #2 on: December 21, 2018, 03:43:44 AM »
Unity 2018.2.10f1, Playmaker 1.9.0



hope it's not too confusing lol

thanks for fast reply :)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Send local events to template using actions
« Reply #3 on: December 21, 2018, 04:36:16 AM »
Hi.
i don't have much experience with runfsm, but i can see that you are sending the event to the 'enemy_controller : shoot'

Which only has a 'start' and it will not reach the 'EnemyShoot' Template inside the run fsm.

I don't think it is possible to send an event to something inside the run fsm.

Maybe instead of using the runfsm, place the template in the 'enemy_controller : shoot' fsm.

agelvik

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 46
Re: Send local events to template using actions
« Reply #4 on: December 21, 2018, 05:32:48 AM »
hmm, yeah this works.. however it might be an issue in the long run, i'll add various other enemies using similar fsms but with different hierarchy and components, so i'm kind of depending on "run fsm" so i can easily make it fit each type and avoid making a mess lol

would've thought the "store ID" input has a function for something though, but it's just an int and doesn't look like there are actions that does something with it..

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 226
Re: Send local events to template using actions
« Reply #5 on: December 21, 2018, 07:27:57 AM »
You can in fact send an event to a template, just send the event to the Host FSM running the "Run FSM" action and place a "Forward All" action in it's active state with Sub FSM as the target.

And uncheck "Eat Event" so it also forwards any variables attached to the event.

This will forward any events and event data to all sub FSM's being run.

Store ID isn't really good for anything at the moment.
« Last Edit: December 21, 2018, 07:32:14 AM by LordHorusNL »

agelvik

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 46
Re: Send local events to template using actions
« Reply #6 on: December 21, 2018, 09:25:48 AM »
ooo sounds interesting, ill take a look at this

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Send local events to template using actions
« Reply #7 on: December 21, 2018, 11:12:14 AM »
Hi.
Thx for the reply LordHorusNL.

I just almost never used run FSM yet so my knowledge is very little.

Awaiting the template update to take the dive :)

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 226
Re: Send local events to template using actions
« Reply #8 on: December 21, 2018, 11:41:00 AM »
I had a sudden need to use Run FSM this week or else i wouldn't have known either ;D

The "Forward All Event" is not a very elegant fix, but until we are able to send events directly to the sub FSM it will have to do.

agelvik

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 46
Re: Send local events to template using actions
« Reply #9 on: December 21, 2018, 03:18:34 PM »
ah heck this worked out very nicely! took a while to wrap my head around it, but got it working. it has potential to mess things up inside the fsm from events it receives, but just gotta careful with selecting which events to send and it should be good. what's important is that it's working :D

on another note, i'm curious how much performance the "forward all" action uses as it looks like its running every frame. any idea here?

i've already done the "trigger/collision stay" mistake in a bullet-hell game where i had this action placed multiple times inside the same State on all projectiles...
had to reprogram the whole game over again, kind of traumatized by that LOL

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 226
Re: Send local events to template using actions
« Reply #10 on: December 21, 2018, 04:13:27 PM »
Don't worry about it, the action doesn't run on update i believe.

Unity's event system is very robust, you'd have to send a hell of a lot of events to slow things down.

8bitbrainpower

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Send local events to template using actions
« Reply #11 on: February 06, 2023, 05:08:59 AM »
Oops, don't mind me, got it working! Thank you
« Last Edit: March 07, 2023, 09:15:22 PM by 8bitbrainpower »