playMaker

Author Topic: Variable Help  (Read 2394 times)

KurdLegend

  • Playmaker Newbie
  • *
  • Posts: 7
Variable Help
« on: July 25, 2012, 07:06:31 PM »
Hi there guys,

Im creating a 1st person rpg and it involves mining ores and thats where im kinda stuck

You can see in the attached picture how my Ore Vein trigger is set up, after a 1/3 chance of mining a ore which pops out, so my question is how can i add some EXP to the player after he has successfully mined a vein ? im still kind of new to unity and playmaker so im not sure how to use variables and such, plus i also would like the mining exp to be displayed on the HUD if its easy to do

And also is it possible to create an inventory system with Playmaker? i did some searching and couldnt find any

Any kind of help will be deeply appreciated

Thanks for your time :)

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Variable Help
« Reply #1 on: July 25, 2012, 07:38:24 PM »
The XP would just be a variable (int/float) that you would have a few different ways of gathering.

Basically, the way I would do it is.


  • Create an empty gameObject and name it go_manager_xp  //the empty game object will basically just be a place in your hierarchy there you manage the collection of XP, a defined place to contain the FSM events and get orders to increase the xp numerical variable.
  • Make a global variable called playerXP //this will be the amount of experience points the player currently has.
  • In your mining FSM in the event that you successfully mine a vein you can either use send event to object fsm and direct the manager to run an event and add float/int Nth to the XP variable you defined or you can broadcast the event while the xp manager is idle and listening for an event to run.

Basically just make the manager wait for the event, make a blank state and add transitions that are global events like "addXP" so when an action sends the 'do this' command then it runs the event, adds to the xp variable and loops back to the idle listener state when its done.

To create the GUI reference you can briefly make a quick fix for testing by creating a GUILayout Float(or Int) Field and have it reflect the global playerXP variable. This should be updated regularly, like when the manager loops back to idle state or something.
« Last Edit: July 25, 2012, 07:47:40 PM by Lane »
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

KurdLegend

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Variable Help
« Reply #2 on: July 25, 2012, 07:51:41 PM »
wow thats a great reply thank you, im going to try it out now :)

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Variable Help
« Reply #3 on: July 25, 2012, 09:30:32 PM »
One of the video tutorials (the health one?) explains the idea behind managers but once you create your first one it should be pretty clear what you can do with them. In conjunction with the send and broadcast event actions they're quite flexible.

Later you can set up a level manager or something that reads the xp manager and runs an event that gives the player an item or reward when the XP variable reads a value greater than Nth.
« Last Edit: July 25, 2012, 09:32:11 PM by Lane »
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D