playMaker

Author Topic: Help with prototype  (Read 3709 times)

gearedgeek

  • Playmaker Newbie
  • *
  • Posts: 30
Help with prototype
« on: July 06, 2016, 11:11:58 PM »
Please note that I'm very new to playmaker. I'm trying to put together a simple defense game where the player must survive waves of enemies to win. I have looked through youtube, tutorials, and other places for examples but came up with nothing.

I'm looking to have a GameObject in the leve that the enemies are trying to destroy and that the player is protecting. I need help with figuring out how to set up that GameObject to take damage from the enemies (if enemies reaches the GameObject) and if it dies then the player loses and must restart the level.

Any help would be appreciated. Thanks

Weedsh

  • Playmaker Newbie
  • *
  • Posts: 24
Re: Help with prototype
« Reply #1 on: July 07, 2016, 08:07:07 AM »
You need colliders on the gameobject and the enemy. then you need the trigger event actions.

watch this tutorial playlist https://www.youtube.com/watch?v=hkyUbY3Bq0A&list=PL727CB9763F77BDE0

gearedgeek

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Help with prototype
« Reply #2 on: July 10, 2016, 08:22:07 AM »
I'm currently using the Third Person Controller to control the health of my game objects. I have AI attacking a game object that the player is defending. I would like to use playmaker to restart the game when the game object is destroyed.

How do I get the health of the game object in playmaker and when that game object reaches zero health then the game ends and the play can choose to restart the game?


EDIT:

I just figured out a quick way. I just send event from the AI (from Behavior Designer) to do damage to game  object. Once the game object reaches zero health I have playmaker restart level.
« Last Edit: July 10, 2016, 09:30:37 AM by gearedgeek »

gearedgeek

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Help with prototype
« Reply #3 on: July 11, 2016, 02:53:23 PM »
So I have a GameObject that has a variable for its health. I was working on adding this health bar to that GameObject using the Unity Tank tutorial. How can I get this working?

gearedgeek

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Help with prototype
« Reply #4 on: July 20, 2016, 03:10:59 AM »
I have playmaker retrieve the health from the game object and set text for the health. I'm not sure how to update that text when the game object takes damage.

https://postimg.org/image/b9768xggf/
« Last Edit: July 20, 2016, 03:14:20 AM by gearedgeek »

Chizzler

  • Junior Playmaker
  • **
  • Posts: 67
Re: Help with prototype
« Reply #5 on: July 20, 2016, 05:10:29 AM »
It looks like you know how to get the health value and convert it into a string for your GUI.

The only thing you've not done is setup a system where it will re-enter that Update State upon taking damage... It's just a case of upon receiving damage you send an event to your game object to do a health check and update the string variable with the new value.

gearedgeek

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Help with prototype
« Reply #6 on: July 20, 2016, 10:40:26 AM »
Yea, I need to have playmaker update when that game object takes damage. I don't know how to do that. Any help would be appreciated.

Chizzler

  • Junior Playmaker
  • **
  • Posts: 67
Re: Help with prototype
« Reply #7 on: July 20, 2016, 11:40:06 AM »
Create an Event (Events tab) on the game object and Call it "Update" - Mark it as a Global Event

Right click the state you've got that sets your string and GUI and add a global transition, selecting the "Update" Event

Now, whatever is applying the damage to the object can use the "Send Event" action to tell the game object to jump to the state with the "Update" global transition.

gearedgeek

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Help with prototype
« Reply #8 on: July 20, 2016, 12:33:11 PM »
Awesome, I got it working some what. It displays the number but it just adds the new number after the old one. I'm not sure how to fix that.

Also once that game object reaches zero how can I tell playmaker to ask the player to end or restart the level?

Chizzler

  • Junior Playmaker
  • **
  • Posts: 67
Re: Help with prototype
« Reply #9 on: July 20, 2016, 01:32:17 PM »
Sorry, I'm not sure I understand, it's displaying both numbers? or it's doing an addition rather than a subtraction?

A shot in the dark if it's a display issue... You've set a Format on your "Convert Float to String" Action. Just leave this blank.

If it's an addition rather than a subtraction, check the action on your damage dealer, make sure you're adding a negative value, or using the "Float Operator" action to Subtract.

To deal with player "Death", a simple "Float Compare" action in the "Update" state will be able to tell you if your health value has dropped below 0 and fire off a transition event to other states where you deal with ending the game

gearedgeek

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Help with prototype
« Reply #10 on: July 20, 2016, 01:56:49 PM »
I changed the "Format" to none in the Convert Float to String and that fixed the text displaying multiple numbers when it updates.

Now I just need to figure how to get playmaker to end/restart level when the game object (game objective [player defends the game object]) reaches zero on that string.

EDIT:
I have figured it out. I just used String compare to restart the level when the game object is destroyed. Thanks for the help!  :D
« Last Edit: July 21, 2016, 01:18:54 AM by gearedgeek »

Chizzler

  • Junior Playmaker
  • **
  • Posts: 67
Re: Help with prototype
« Reply #11 on: July 21, 2016, 02:17:18 PM »
I'd avoid using a String Compare for this purpose to be honest.
The reason for this is, there may be a situation where the Health value doesn't equal exactly 0, but goes into negative values.
This would fail a String Compare test, but a Float Compare has an option for "Less than" 0, which would cover negative values.