playMaker

Author Topic: How to re-script things with Playmaker  (Read 2300 times)

morrigan

  • Playmaker Newbie
  • *
  • Posts: 2
How to re-script things with Playmaker
« on: February 01, 2016, 08:21:43 AM »
Hello there!
I am a game and level designer, and I'm developing a project with C#. I've purchased Playmaker some months ago but never had time to use it. I already have a working menu and events to start my game, exit the application, load levels, pausing, restarting and so on. I've scripted everything in C# because I wanted to learn, but now that my project is more defined I want to use Playmaker to have a neat structure and implement also Easy Save 2.
That said, can you people suggest me a way to start the whole process? Do I have to remove my scripts? At first sight I don't know where to start and I'm tempted to just continue with the traditional way, but I don't want to waste too much time and I feel that my project will have a more solid code with this tool.
Correct me if I am wrong...!
« Last Edit: February 01, 2016, 08:24:13 AM by morrigan »

KellyRay

  • Full Member
  • ***
  • Posts: 170
Re: How to re-script things with Playmaker
« Reply #1 on: February 01, 2016, 09:45:52 AM »
I'm a whole-fully terrible coder. I managed to translate some other peoples scripts into playmaker actions in about a day. I started by opening up the other playmaker actions that did similar things to what I wanted and just read them. I started to piece together what words and nuances I needed to know.

To start, I made a duplicate of the playmaker script, stripped it of its guts, and filled it in with the other script. Worked pretty well for me.

I find Playmaker easy to follow. Some coders have said that it's a waste of time. I say you should give it a shot.

Vallar

  • Junior Playmaker
  • **
  • Posts: 90
Re: How to re-script things with Playmaker
« Reply #2 on: February 02, 2016, 04:35:59 AM »
As far as I know you can trigger scripts from Playmaker and vice versa. So you don't need to lose your scripts and redo them in Playmaker if you don't want to. But as KellyRay said, it isn't too hard. That is how I work, I look at scripts over the internet of stuff I am not sure how to do and translate it to Playmaker.

A quick search yielded this:
and
Perhaps they could give you an insight on the process and hope they help in anyway.

That said, if you want to translate code into playmaker; each code line might end up as an action. So for example if you have a line of code that says something along the lines of (I am bad at coding so bear with me):

if keypressed "w" == true
{
   object.transform.translate (x, 2, 0);
}

Then the equivalent of this in Playmaker terms would be an FSM with 2 states:

1- A state with the "Get Key Down" action and has the "W" letter as the key

2- A state with the "Translate" action with the value of 2 at "y".

An event is required to transition from state1 to state2 so you'd need to create an event called "key pressed" for example. Then hook everything up.

If you want to be more "OOP" then instead of writing the "2" in the "Translate" action, you'd then create a variable called speed for example and then give it the value of "2" and edit the translate action in state2 to point to the variable rather than the value itself.

Hope that helps.
« Last Edit: February 02, 2016, 04:41:29 AM by Vallar »

morrigan

  • Playmaker Newbie
  • *
  • Posts: 2
Re: How to re-script things with Playmaker
« Reply #3 on: February 02, 2016, 10:58:44 AM »
Kelly and Vallar, thank you very much for your replies! I don't want to rescript everything, also because I have a lot of scripts! The idea of Playmaker comes with Easy Save 2 that I want to use to save things. Currently the game lacks a Save/Load feature, so I wanted to integrate Easy Save 2 with Playmaker.

Since my game has collectibles I'll start with that. The videos seem useful, I'll take a deep look. Thanks!

Vallar

  • Junior Playmaker
  • **
  • Posts: 90
Re: How to re-script things with Playmaker
« Reply #4 on: February 02, 2016, 11:16:05 AM »
You are most welcome and good luck. Just one tip with Playmaker, keywords in programming (like collision, move, push, etc...) can be used in the Action search bar and most likely you'll end up with an action that has the description similar to that of the programming concept.

Again, good luck :)