Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Nietzsche on September 06, 2019, 06:00:25 PM

Title: Adding and subtracting damage between units [SOLVED]
Post by: Nietzsche 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.
Title: Re: Adding and subtracting damage between units
Post by: Thore 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).
Title: Re: Adding and subtracting damage between units
Post by: Nietzsche on September 07, 2019, 03:00:53 PM
thanks, that threat helped me a lot.