playMaker

Author Topic: Help with determining health status on trigger enter  (Read 1370 times)

MadToLive

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Help with determining health status on trigger enter
« on: January 13, 2013, 02:25:55 PM »
So right now I have a trigger that when the player enters it they take health damage and it updates the health tracker. For example, character has 100 health, enters hidden trigger and takes 2 damage and the health updates this to say the character now has 98 health. Now I want to create other types of triggers where when the character walks into a trigger, it checks to see how much health the character has and depending on how much health the character has it does something different. Example: Character walks into a trigger with 100 health, the trigger sees the character has 100 health and does nothing. Character walks into the same trigger later and has 50 health and now that trigger does a specified number of actions.

The way in my head I see this needing to work is that the trigger sees if the characters health is between 75 and 100 a series of actions happen. If the characters health is between 50 and 75 a DIFFERENT series of actions happen.

Now I think I can pretty much set all this up but I am not sure what action may check to see where the characters health stands between specific numbers and depending on where they stand health wise it heads to the next appropriate set of actions.

Any insight or help would be greatly appreciated.

Right now the characters health is tracked and updated via a global float.

Vallar

  • Junior Playmaker
  • **
  • Posts: 90
    • View Profile
Re: Help with determining health status on trigger enter
« Reply #1 on: January 13, 2013, 11:13:11 PM »
Re: Help with determining health status on trigger enter
Hello,

To setup something like that with Playmaker you would use Float Compare action.
Enter in the first parameter the health variable and in the second parameter you can enter 75. Now in the Equals To parameter you can enter whatever  you want as well as the Greater Than (which checks if if the health is more than 75)

As for the second example you would need to do it a bit differently am not sure however if this will work or not (since I am posting from my phone and I can't check) you can add another Float Compare with the Health Variable again and the value to check against is 50, in the equals to you do the actions associated with that and the greater than would send an event that would transfer u to the last step and leave the rest blank. For the final step, use another Float Compare with the variable being checked against 75 and only populate the equal and the less than events which would both transfer you to the state u want to do actions testing against 50-75, for the Greater Than event send the 75-100 actiom since if it is more than 75 it falls between 75-100 state

Edit: If the two examples are on the same trigger then I would ignore what I said first and setup the second example since when you check against the value 50 and flow to the other state in that state you can test against the value 75 and put in the Equal To as well as the Less Than what you want to do 50-75 and in the Greater Than what you want to do (75-100)

Hope that helps and if you need more ellaboration/explanation please let me know.
« Last Edit: January 13, 2013, 11:20:28 PM by Vallar »

Alio

  • Playmaker Newbie
  • *
  • Posts: 19
    • View Profile
Re: Help with determining health status on trigger enter
« Reply #2 on: January 14, 2013, 11:22:59 AM »
Just like Vallar said, you'll need to do float compare.


Set it up with multiple events sending to different states

State     [Health Check]
Events    Full Health     -------> [Full Health State]
             75-99 Health  -------> [High Health State]
             51 - 74 Health ------> [Medium Health State]
             1 - 50 Health -------> [Low Health State]


Have the float compare, compare your current global health float to set variables that you will have to create.  Then based on the comparison, greather than, equal to, less than, set them as above stated events which will sent it to the new states (full, high, medium, low) and in these states you will then apply whatever action you wanted the trigger to say/do.

Hope that clears things up a bit.
I just frankenstein it.