playMaker

Author Topic: Get Key without pressing key?  (Read 4395 times)

Blubbfischtier

  • Playmaker Newbie
  • *
  • Posts: 11
Get Key without pressing key?
« on: June 13, 2014, 08:01:00 AM »
Is it possible to build a state machine which simulates key pressed event?
like "set Any Key True" or "Set Button Pressed"?. I have a jump script attached to my fsm and want to jump, without pressing the jump button (in my case space).

:)
« Last Edit: June 13, 2014, 09:03:26 AM by Blubbfischtier »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Get Key without pressing key?
« Reply #1 on: June 13, 2014, 10:58:53 AM »
Hmm.. I don't think so.

You could just make a second event and wire it up the same as your Spacebar event, then send that instead when you want to 'force' jump. That would do the same thing, just bypassing the input.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

j-man82

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Get Key without pressing key?
« Reply #2 on: September 26, 2014, 05:21:17 AM »
Hi Lane
I'm new to Playmaker and Unity but would also like to know how to 'simulate' key presses or mouse button clicks - could you maybe explain in more detail, how to set up what you suggested?
In my case it's a 3rd person character, that I want to act as an npc instead and make him move (keys) and shoot (mouse click), without having to press any keys myself. I have a movement script, crouch control script and a weapon controller script attached...
Hope you can help!
I make custom music for games - see my portfolio here www.jonaskappel.com PM for rates

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Get Key without pressing key?
« Reply #3 on: September 26, 2014, 10:13:14 AM »
I made the same post in the Feature Request forum.

This would make automated testing much more feasible.

j-man82

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Get Key without pressing key?
« Reply #4 on: September 26, 2014, 01:46:26 PM »
Great! I second that request  :)
I make custom music for games - see my portfolio here www.jonaskappel.com PM for rates

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Get Key without pressing key?
« Reply #5 on: September 26, 2014, 02:17:23 PM »
Im not sure if that is possible, but I'll look into it.

In the meantime, what I meant was that you can fake the input in to force the appropriate events to fire or you can create parallel events to fire, based on some other prerequisites that you control.

For instance, if you're using Get Axis Vector to store inputs then you can simply change that vector explicitly and anything looking at the variable will react per usual.

Another instance is that you're firing an event say, for Jump, which depends on spacebar being pressed. Well, instead of fake firing spacebar just add in a debug hack where you fire the same event by way of something like a bool test, or a wait action that loops.

Make sense? It's basically just finding another way to do the event. Do you want to jump every 3 seconds? Setup a wait to fire the same event that Spacebar does. Do you want to move the character? Then what variables control that? Can you force them to change in another manner or force it another way?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

j-man82

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Get Key without pressing key?
« Reply #6 on: September 26, 2014, 04:41:56 PM »
That's awesome - thanks, Lane.
As I mentioned, I'm new to Unity, scripting and all that, but I'll definitely try this out and see if I can get it to work :)
I make custom music for games - see my portfolio here www.jonaskappel.com PM for rates

j-man82

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Get Key without pressing key?
« Reply #7 on: September 28, 2014, 02:27:44 PM »
Hi again
Don't know if I'm asking the right questions, but the problem seems to be that I can't turn off the character controller component in the 3rd person character and make it a NPC. I tried adding a character motor script and unchecked  'can control', but that didn't seem to have any influence. I'm guessing that's because it has its own movement script? Would I have to edit that script or is there some other way?

What I would like the NPC to do is for instance to shoot when the character that I do control, enters a trigger.

Don't know if this is possible to achieve, but I hope you can help!
I make custom music for games - see my portfolio here www.jonaskappel.com PM for rates