In my map I try to make a specific damaging area mechanics (not my invention). It's not sophisticated at all, but is difficult enough for me. I managed to establish it, but I'm not sure that I made it the right way. Let me describe it.
When the hero enters the damaging area, a special scale/bar ("damage scale") begins to gain points. For example, 10 points per second. Every five seconds the hero takes damage equal to the number of points accumulated. So, after 5 seconds he will take 50 damage, after 10 seconds - 100 damage, etc.
When the hero leaves the damaging area, the "damage scale" begins to lose points with the same rate instead of gaining. The hero continues to take damage every 5 seconds until the "damage scale" reaches zero. So, the hero can, for example, leave the damaging area 8 seconds after entering. In 2 seconds he will take 60 damage and after another 5 seconds - 10 damage:
Special actions (use of items, spells, etc.) can increase the hero's resistance to this damage by reducing the number of points gained by the "damage scale" per second. And there are items which can instantly remove some points from the scale reducing the damage inflicted at the end of the current "5 sec cycle".
Well, I managed to make this system, but only by using the 1 sec timer. There are three little triggers (which can be compressed to two):
1) When the hero enters the defined region, the 1 sec timer is started and the hero receives a damaging buff with the period of 5 sec and initial damage of 10.
2) When the timer is expired and the hero is still in the region, 10 points are added to the "damage scale" variable, buff's damage is set to this value, timer is started again.
3) When the timer is expired and the hero is no longer in the region, 10 points are subtracted from the "damage scale" variable, buff's damage is set to this value. If "damage scale">0, timer is started again. Else, the buff is removed from the hero.
This seems to work correctly enough. Timer's delay and points' number can be replaced by the variables to assure resistance and "potion" effects. There is only one unit (the hero) under the player's control, it simplifies the situation.
Well, what do you think of it? What are the disadvantages of this system? Any hints how to make it better and safer?
Hello people.
In my map I try to make a specific damaging area mechanics (not my invention). It's not sophisticated at all, but is difficult enough for me. I managed to establish it, but I'm not sure that I made it the right way. Let me describe it.
When the hero enters the damaging area, a special scale/bar ("damage scale") begins to gain points. For example, 10 points per second. Every five seconds the hero takes damage equal to the number of points accumulated. So, after 5 seconds he will take 50 damage, after 10 seconds - 100 damage, etc.
When the hero leaves the damaging area, the "damage scale" begins to lose points with the same rate instead of gaining. The hero continues to take damage every 5 seconds until the "damage scale" reaches zero. So, the hero can, for example, leave the damaging area 8 seconds after entering. In 2 seconds he will take 60 damage and after another 5 seconds - 10 damage:
Schematically [ 10 | 20 | 30 | 40 | 50 | DMG | 60 | 70 | 80 | 70 | 60 | DMG | 50 | 40| 30| 20| 10| DMG ]
Special actions (use of items, spells, etc.) can increase the hero's resistance to this damage by reducing the number of points gained by the "damage scale" per second. And there are items which can instantly remove some points from the scale reducing the damage inflicted at the end of the current "5 sec cycle".
Well, I managed to make this system, but only by using the 1 sec timer. There are three little triggers (which can be compressed to two):
1) When the hero enters the defined region, the 1 sec timer is started and the hero receives a damaging buff with the period of 5 sec and initial damage of 10.
2) When the timer is expired and the hero is still in the region, 10 points are added to the "damage scale" variable, buff's damage is set to this value, timer is started again.
3) When the timer is expired and the hero is no longer in the region, 10 points are subtracted from the "damage scale" variable, buff's damage is set to this value. If "damage scale">0, timer is started again. Else, the buff is removed from the hero.
This seems to work correctly enough. Timer's delay and points' number can be replaced by the variables to assure resistance and "potion" effects. There is only one unit (the hero) under the player's control, it simplifies the situation.
Well, what do you think of it? What are the disadvantages of this system? Any hints how to make it better and safer?