Playmaker Forum
PlayMaker Feedback => Action Requests => Topic started by: Dev_Sebas on October 15, 2011, 04:10:16 PM
-
There is this script
// Detects if any key has been pressed down.
function Update() {
if(Input.anyKeyDown)
Debug.Log("A key or mouse click has been detected");
}
Who can make it ready to use in PlayMaker?
Thanks for any help
Bye
-
There is an Any Key action that ships with playmaker:
https://hutonggames.fogbugz.com/default.asp?W29
-
Thank you Alex
Just for I know what I need for put my scripts in PlayMaker?
Bye
-
Can somebody help me?
-
Are you asking how to put a new action into Playmaker or how to use the Any Key action that is already there?
Q
-
I am question how to put a new action into Playmaker.
Thanks for any help
-
Well what i do is use MonoDevelop that comes with Unity and i paste the code from the website into it and then save the file into the \Assets\PlayMaker\Actions\ folder... I actually put a folder in there called Custom for all my home made or down loaded ones..
Make sure you call the file the same as the Public Class name in the file.. I think it will throw an error if you do not but i cant remember.. Anyway it helps regardless..
And you can not have two Actions with the same Public Class name. So if you have a custom version of something that already exists then i usually just call it something else that tells me what i changed.. And that way when you update PlayMaker you do not loose your changed version.. I had that happen to me once too.
Does that help?
Q
-
I am go try
-
I tried this
public class AI : FsmStateAction;
var turnSpeed : float = 5;
var speed : float = 10;
var distanceToGo : float = 5;
var leftOrRight : boolean = true;
function Update () {
if(Input.GetKeyDown(KeyCode.E)){
if(leftOrRight)
leftOrRight = false;
else
leftOrRight = true;
}
var hit : RaycastHit;
var fwd : Vector3 = transform.forward;
if(Physics.Raycast(transform.position, fwd, hit, distanceToGo)){
if(leftOrRight)
transform.Rotate(Vector3.up, 90 * turnSpeed * Time.smoothDeltaTime);
else
transform.Rotate(Vector3.up, -90 * turnSpeed * Time.smoothDeltaTime);
}
else{
transform.Translate(Vector3.forward * speed * Time.smoothDeltaTime);
}
}
-
And did it work?
Q
-
No, it´s not working
-
HI,
the best way to start is to study the actions shipped with playmaker. understand how the "template" for cusotm work and then you'll be able to build your own , very, very easily.
So for example in your attempt, you miss the namespace declaration "namespace HutongGames.PlayMaker.Actions " and the "using UnityEngine;" that needs to be declared prior that
I leave you do some research a bit more :) shout when you're stuck again and I'll make a working example of your script.
Bye,
Jean
-
Hi Jean thanks for reply
I thought the Playmaker can read my scripts easily
But I very very noob on scripts and I can´t write
If you can make me a example of this script I´am very appreciated and thanks
Bye
-
Well i learned from nothing by looking at the existing scripts... Everything you need is there. If you took an existing script that was close and attempted to implement your own code in it that would be a great step then someone can help you fix any issues with it.
Q
-
Thanks by the tip qholmes
Yes you are right about "took an existing script that was close and attempted" thanks again
Bye