playMaker

Author Topic: Return Key to End Turn [SOLVED]  (Read 1889 times)

IonusPrimus

  • Playmaker Newbie
  • *
  • Posts: 6
Return Key to End Turn [SOLVED]
« on: November 10, 2020, 01:08:51 AM »
Hi, I have a UI button to end turn in a game. Problem is to get the Return key to do the same. I think I have tried every way except the one that works. HELP !!
« Last Edit: November 12, 2020, 04:04:32 AM by IonusPrimus »

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: Return Key to End Turn
« Reply #1 on: November 10, 2020, 08:56:14 PM »
Once the UI button is clicked you are probably sending an event from the On Click function in the inspector.

To do the same thing with a key down event I would try the action Get Key Down in the first state (Key, Return of course), then in the next state do a Send Event Action the Event Target drop down in this action has multiple selections I usually use Game Object if I just need to send an event or Game Object FSM if that object has more than one FSM.  Please see attached they both work Just press play and the state will change.
« Last Edit: November 10, 2020, 09:00:50 PM by Kodagames »
Have I said how much I love playmaker!!! This is one amazing tool

IonusPrimus

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Return Key to End Turn
« Reply #2 on: November 11, 2020, 09:23:40 PM »
Thank you for your help. I can not get it to work still. In your graphic example you have the Send Event on the first Start state, but in the written example you have it the other way around. No matter, I tried both.

I dont have an On Click in the inspector as the FSM's worked fine without it. I have some UI graphic changes on the End Turn button and they have now decided to fall over, probably due to a conflict with an attempt to install Itween as DOTween Pro wasn't co-operating. I did get Itween to work for a different matter, but it seems more than coincidence that I now have 3 exceptions on my end turn which is fitted to the canvas.

When I connect the Start to the return key it works only once.
PS I now have no errors but can not get the Return key working.
« Last Edit: November 11, 2020, 11:15:03 PM by IonusPrimus »

IonusPrimus

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Return Key to End Turn
« Reply #3 on: November 12, 2020, 04:02:53 AM »
SOLVED !!
For others who may want the solution: Have an empty FSM1 coming off the Start. Then have Finished as the FSM1 Event transferring to FSM2 which has the GetKeyDown and any single use event to take it to FSM3 where there is the Send Event that sends the End Turn Event and a Finished to take it back to FSM2.  :) ;) :)

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: Return Key to End Turn [SOLVED]
« Reply #4 on: November 12, 2020, 05:53:37 AM »
Glad you figured it out ;)
Have I said how much I love playmaker!!! This is one amazing tool

IonusPrimus

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Return Key to End Turn [SOLVED]
« Reply #5 on: November 14, 2020, 06:28:44 AM »
Thank you for tour help. I felt encouraged to keep trying !!
Cheers !!  ;D ;D