Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: merde10 on February 19, 2016, 09:57:24 AM
-
Hello guys,
for my game, i'm using playmaker and i create a script for the score.
i would like to know how can i call the "game over" event in playmaker so i can use it on my script as a boolean?
i code in java.
-
If you want to access variables in a script try the "Get property" and "Set property" actions- just drag and drop the script into the actions field-
-
thank you for you reply,
i already use "game over event" with playmaker on my game and it works fine.
What i want to know is how can i call this event in my java script?
-
Here's some links that might be helpful
https://hutonggames.fogbugz.com/?W329 (https://hutonggames.fogbugz.com/?W329)
http://hutonggames.com/playmakerforum/index.php?topic=1355.0 (http://hutonggames.com/playmakerforum/index.php?topic=1355.0)
https://matthewwaring.wordpress.com/2014/01/14/using-playmaker-with-code-quick-introduction/ (https://matthewwaring.wordpress.com/2014/01/14/using-playmaker-with-code-quick-introduction/)
-
i'm completely lost...
-
Why not just build a score system in Playmaker? Then you won't have to deal with sending events to/from scripts-
-
I dont know scripting at all myself, but i think I know how it can be done. If you could set up a float (or int i think) variable to be the score in your script.
Then with the 'game over' fsm open, drag and drop the script component from the game object onto the state's action list. When you drop the script there select 'get property', in the small menu that appears.
In the 'get property' action's drop down menu, i think you should be able to choose the 'score' variable from the script (though ive never used get property on a script myself). Save the score variable from the script into a playmaker variable, every frame if thats an option.
Then add a float/int compare to compare the variable you just saved from the script...
When the score is 0 or less send to the game over state (or whatever numbers you have in mind).
Also you can reverse this using 'set property'. So to make a bool for the script, setup a bool in playmaker ( for example 'game over= true' once the score has reached 0) Drag and drop the script component from the game object, into the actions list on the game over state. Choose 'set property'. Then setup the action so the playmaker bool value sets the bool value in the script.
Hope my ramble helps lol. Let us know how you get on.