Damage not stacking
Franto
Member Posts: 779
In my previous game, I noticed that same instances of an attack, when overlapping the player character, did not stack damage, but instead counted them all as a single attack. My guess is as long as they are constantly overlapping, it counts as the attack actor being on them the entire time and why damage isn't applied again until the character moves and is hit again.
What would be the most efficient way to get attack instances to stack damage? This is also why I was afraid to try out tables, thinking the same thing would happen, and a single column/row applying attack damage for many actors would only count all instances of the actor as the same thing. I hope tables are different and calculate damage from multiple instances separately.
What would be the most efficient way to get attack instances to stack damage? This is also why I was afraid to try out tables, thinking the same thing would happen, and a single column/row applying attack damage for many actors would only count all instances of the actor as the same thing. I hope tables are different and calculate damage from multiple instances separately.
Comments
When overlap/collide
--every 1 second
---change damage to damage + 1
Besides that i think we will need a little more explanation of what your actually doing or trying to do.
In effect here:
However, damage still does not stack, and I would rather not use timer based damage unless its a fire type attack. Timer based damage is especially ineffective with fast moving lasers, even if you set it at apply damage every 0.01 seconds, sometimes the overlap is so fast that no damage is calculated.
If 20 attacks are on the character, I would like the damage to be all of them combined. I did use a timer in the last builds just so that damage could be applied constantly, but I still want that stacked damage goodness of being foolish enough to get surrounded by 20 projectiles.
Like right here at this point at 1:47, the player character is surrounded and being fired at with dozens of timer based energy ball attacks. If damage stacked, his HP should have depleted in seconds as a single energy ball's damage is low, instead, it depletes as if a single energy ball is only hitting him.
Although I didn't mention timer based damage in opening post as the other game I'm working on is trying to stay away from timer based damage and I'm trying to get stacked damage instead. Hoping tables could pull it off somehow and now have a single unit in a table only apply to a single character, but allow for the calculation of various instances of said character separately.
When actor collides with [player actor]
Change attribute game.playerHealth to game.playerHealth - 1
That way, even if 30 projectiles all hit the player at the exact same time, each one will run that rule because it will be true for each projectile rather than being triggered by the player actor when the first projectile hits it and then not able to immediately trigger again for each other projectile.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I think in a video tutorial I saw, there was a drawback to just putting the damage behavior on the projectile actors and not the character actors, but I can't remember what it was.
EDIT: What about for enemies who's HP stat is a self attribute? I think this is what probably stopped me last time.
EDIT2: This is where your health bar demo would have come in handy for reference of self attributes, but like I mentioned earlier in the thread, the tables are mysteriously gone and any change attributes have been replaced with a behavior having a message about tables.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Perhaps waiting until GS releases a way for actors to read the self.attributes of other actors or have some behavior that allows for damage to be calculated multiple times based on overlapping actors, etc.
What I did to sync them is to have the spawner actor change a game attribute (integer) to its own self.ID (that I've set manually or just before it spawns) right before it spawns its health bar. The health bar changes its own self.ID to whatever the game attribute value is. That way, the health bar and player/enemy have the same self.ID value. That value is used to look up table information. Each player/enemy and health bar stores and retrieves its data from the row number equal to self.ID. They are always synced. And if, as in my demo, the health bar needs to be positionally synced as well, I just have it look up the player/enemy x and y positions and constrain itself to an offset of them.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Now the part that confused me, was that the table in the demo only had 1 row and 3 columns, no labels. How many rows did you use in your actual table or what did the table you use look like? If what I'm thinking is true, then I would have to limit the enemies to whatever number of rows I choose. Say 25 or so, so I would then have to make that many rows for this to work. A nice solution, the only drawback being the number of enemies on screen are limited to the number of rows you have, but for this game, it won't really matter.
Thanks again for the help.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thanks again, @Tatiang.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
That's understandable. You don't really have to watch that video but it does explain how to use Change Table Value and Add/Remove Row behaviors.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I was looking for written documentation of not only how to use tables, but putting tables into action and different examples of how to use them in order to understand what works and what doesn't.
I still have had yet to implement what you described as I've been away most of the day for the past week. I will end up learning the intricacies of tables anyway once I've recreated your example today or tomorrow. Thank you again for the help.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User