playMaker

Author Topic: Need help with damage  (Read 1303 times)

Krauser1129

  • Playmaker Newbie
  • *
  • Posts: 22
Need help with damage
« on: September 12, 2020, 12:21:31 AM »
My current system of sending damage is Send Event and the event tells the FSM to subtract 1 from the variable health. I need a way of increasing the damage source by any variable and send that number to that FSM as damage.

For a more detailed explanation, I have turrets you can buy, set up and upgrade. As a single turrets damage goes up, it needs to do that damage to my enemies.

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: Need help with damage
« Reply #1 on: September 12, 2020, 06:10:29 AM »
You could use SetFSM... or GetFSM... variable (float, int etc). Some FSM could SetFSMInt for instance in the turret, or probably better the turrets could GetFSMInt from a manager FSM when they upgrade. Either way, you can pass over values with this. A third way is the pair of set event data and get event info (or something similar).

Krauser1129

  • Playmaker Newbie
  • *
  • Posts: 22
Re: Need help with damage
« Reply #2 on: September 13, 2020, 09:40:12 AM »
I looked and I'm not sure how to use "Get Event Data" like yeah it stands the info but how do I transfer it into a variable?

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: Need help with damage
« Reply #3 on: September 13, 2020, 12:24:07 PM »
I can’t remember which around it was: Set Event Info is setting things into a package of sorts, and then Get Event Data can read that event. Search the forum or ecosystem as there should be an example somewhere.

Hasuman

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Need help with damage
« Reply #4 on: September 13, 2020, 02:03:22 PM »
Have variables like Damage set into the turret and also anything that can take damage. When the damage is dealt you first use "Set FSM float" to the object that takes damage and tell it how much damage it's going to take. Then send the "take damage" event. In the "take damage" event subtract the sent amount of damage from the object's health. Remember to first set the float and then subtract, in order, so it always subtracts the right amount.

As for upgrades, maybe set the turret's damage as a global variable so you can change that variable and affect every turret with the changes.

ch1ky3n

  • Full Member
  • ***
  • Posts: 208
Re: Need help with damage
« Reply #5 on: September 13, 2020, 11:57:03 PM »
I kinda like the process of calculating damage lies in the beaten rather than the beater.

if The Hero attacks an orc, the hero just sends the event "I Attack You" and the orc is the one who calculates the damage and applies it to himself. Of course, that would mean that the orc must have access to the hero parameter to be able to calculate how much damage he will receive.

Krauser1129

  • Playmaker Newbie
  • *
  • Posts: 22
Re: Need help with damage
« Reply #6 on: September 14, 2020, 01:57:47 AM »
The normal premise of having the damage calculated on the victim, doesn't work with what I'm doing. Individual turrets have their own damage as well as the player. With the ability to also sell turrets, I need a way of sending data from one FSM to another. So far I got my turret so send its damage data to the bullet but I'm having issues with the bullet passing it along to the enemy, despite it being set up the same way.

Krauser1129

  • Playmaker Newbie
  • *
  • Posts: 22
Re: Need help with damage
« Reply #7 on: September 14, 2020, 09:39:19 AM »
GOT IT TO WORK! THANK YUO EVERYONE!

You use Get EVent Info, store the object as a variable. Then use Get FSM Float from thew variable you got in Get Event Info. THen tell your object to subtract that amount on your global event that makes it take damage.