playMaker

Author Topic: Adding and subtracting damage between units [SOLVED]  (Read 957 times)

Nietzsche

  • Playmaker Newbie
  • *
  • Posts: 26
Adding and subtracting damage between units [SOLVED]
« on: September 06, 2019, 06:00:25 PM »
I asked a few days ago, about how you could create two units shooting oneanother in a strategygame, and while all my questions came to a satisfying conclusion, I am now stuck with annother question:

If ship A shoots at ship B and does 30 Damage out of 100 health, how do I get my fsm's to make this? So far I tried to do it by event, which works fine if you only have one or two diffrent damage values, what I want to know is, how I can comunicate exact values between two fsm's.

It is for a 3d strategy game, and I would like every unit to have a dedicated fsm for their health and not use global variables for health.
« Last Edit: September 07, 2019, 03:01:07 PM by Nietzsche »

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: Adding and subtracting damage between units
« Reply #1 on: September 06, 2019, 09:25:34 PM »
One way, see here, Set Event Data & Get Event Info
https://hutonggames.com/playmakerforum/index.php?topic=4963.msg23336#msg23336

Another way: Set FSM float/int (action) of the damage on the target health FSM, which must be a variable (e.g. incomingDamage). Then substract the incomingDamage from health, e.g. float operator, then instantly set incomingDamage to zero, as we’ve now used it. After that, check if the remaining health is deadly etc. For exact and clear sequences, you can switch the state to action sequence (right click on empty area where actions are placed).
« Last Edit: September 07, 2019, 10:25:16 AM by Thore »

Nietzsche

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Adding and subtracting damage between units
« Reply #2 on: September 07, 2019, 03:00:53 PM »
thanks, that threat helped me a lot.