• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved How do you manage your addEvent damage?

whitevo

Feeling good, thats what I do.
Joined
Jan 2, 2015
Messages
3,452
Solutions
1
Reaction score
625
Location
Estonia
So I realized my area damages can be dodged by walking trough them.
And that is not good.
I believe I'm not the only one using area damage which moves towards to end instead of just blowing up entire area at the same time.

Code:
for i, posT in pairs(area) do
  for _, pos in pairs(posT) do
  local min = math.floor(min*(1+0.1*i))
  local max = math.floor(max*(1+0.1*i))
  addEvent(dealDamagePos, 200*i, cid, pos, 18, DEATH, min, max, 18, nil, nil, O_player_spells)
  end
  end
So here is my typical mage spell (!death)
The problem here is that, its possible to dodge the damage by walking towards the source.
Its slim chance but if your characters was able to switch the tile within that 200 milliseconds, you wont be dealt damage.

Solution.
Right now the solution I'm preparing to make is, each time the wave goes 1 step further it will also deal damage to previous positions where the wave came from, but simply doesn't show up visually(unless someone got hit)

Problems with the above solution:

Now problem with that is, I need manually define which areas it should take, because sometimes the waves are not that typical and have different sizes(some specific positions from a spell do not need to have a check where it came from) or change direction.

The idea is that, players should be able to teleport/jump over the spellwaves comings towards them. I just want to make it so they cant walk trough them.

Also now Its possible that player takes same damage twice within that 200 milliseconds when he walks along the wave.

For this I need to give all spells unique ID (they have it already anyway), but now I need to send it to damageSystem (trough origin prolly). This also will take quite some time, until ALL the damages have its own uniqueID.


So I'm asking if anyone has alternative solution for this problem or the solution I came up with is the best option?
 
Hmm I would do something like this:
Code:
local area = {
{1, 2, 3, 4, 5},
{1, 2, 3, 4, 5},
{1, 2, 3, 4, 5},
}

So the addevent delay would be time*value in the area and also checking the previous area value. That should solve the "not typical" spells if you can configure the effect for each id in the area, you could just set the id to either check the previous position or not.

And to not take the damage twice you could just do some simple class like "damageSource" so it stores the players that were already affected and don't apply damage again. (and delete it after the spell has ended!)
 
And to not take the damage twice you could just do some simple class like "damageSource" so it stores the players that were already affected and don't apply damage again. (and delete it after the spell has ended!)
Of course! Thank you.

So the addevent delay would be time*value in the area and also checking the previous area value. That should solve the "not typical" spells if you can configure the effect for each id in the area, you could just set the id to either check the previous position or not.
My area:
Code:
mageSpellArea = {
    {n, n, 7, 7, 7, n, n},
    {n, 7, 6, 5, 6, 7, n},
    {7, 6, 5, 5, 5, 6, 7},
    {5, 4, 4, 3, 4, 4, 5},
    {n, 3, 2, 2, 2, 3, n},
    {n, n, n, 1, n, n, n},
    {n, 4, n, 0, n, 4, n},
    {n, n, 2, n, 2, n, n},
    {n, n, n, 6, n, n, n},
}
As you can see the problem is that sometimes its not related with wave.

But as I can understand, you also think I should work with the previous areaPos where the wave came from.

Right now The plan is to check previous position and then compare is 1 tile nearby. If not, then it wont do anything.
 
Of course! Thank you.


My area:
Code:
mageSpellArea = {
    {n, n, 7, 7, 7, n, n},
    {n, 7, 6, 5, 6, 7, n},
    {7, 6, 5, 5, 5, 6, 7},
    {5, 4, 4, 3, 4, 4, 5},
    {n, 3, 2, 2, 2, 3, n},
    {n, n, n, 1, n, n, n},
    {n, 4, n, 0, n, 4, n},
    {n, n, 2, n, 2, n, n},
    {n, n, n, 6, n, n, n},
}
As you can see the problem is that sometimes its not related with wave.

But as I can understand, you also think I should work with the previous areaPos where the wave came from.

Right now The plan is to check previous position and then compare is 1 tile nearby. If not, then it wont do anything.
Your area is regarding only effects, mine was for time+effect, that is why it wouldn't have the problem, you could as well use both to be able to set different effects for the same time, you would need 2 area tables to relate time and effect, and then you could easily check the previous position using the time one.

You won't need the area regarding time if its always using the Y position to increase time tho.
 
Your area is regarding only effects, mine was for time+effect, that is why it wouldn't have the problem, you could as well use both to be able to set different effects for the same time, you would need 2 area tables to relate time and effect, and then you could easily check the previous position using the time one.

You won't need the area regarding time if its always using the Y position to increase time tho.
Mine is doing time and position.
The time multiplier is the value itself in area.
The position is compared with the startpos which is either 0 or 1, depends do i want it to be included or not.
 
for i, posT in pairs(area) do
...
addEvent(dealDamagePos, 200*i, cid, pos, 18, DEATH, min, max, 18, nil, nil, O_player_spells)

Not that one :/

Well if its time+effect you just have to do the damageSource thing and check the previous effect example:

When in 1 values you wont check cause 0 is not valid
When in 2 values you check 1 values and apply damage
...
When in x values you check x-1 values and apply damage

And its good i guess
 
Making another config to do is taking a step back. Because with the current solution I can do it with 1 loop.
It would take 1 loop as well with 2 tables, you would loop in the time area and index the effect area setting the addEvent depending on the effect value.
 
It would take 1 loop as well with 2 tables, you would loop in the time area and index the effect area setting the addEvent depending on the effect value.
Its not nice to add 2 tables and loop them at the same time and it makes more static values for me to add. In other words not good.

Currently It knows where to doublecheck and it all comes from 1 config (aka the area table) All I do is use 1 function inside the loop.

But the idea seems to same for you too, check the previous area where damage came from and the idea matches with mine. So I guess its the best solution.
 
Why not prevent the player from moving if they cast a spell that uses an addEvent until the spell has completed, many major mmorpg's prevent players from moving when using skills and or casting spells.

If they move, cancel the spell.. this is why we need progression bars :p
 
Why dont you just damage every sqm once and then just do the visual effect (no damage applied)?
Then player will get hit before he even gets hit by spell.
In my server I want players to be able to dodge spells.

Why not prevent the player from moving if they cast a spell that uses an addEvent until the spell has completed, many major mmorpg's prevent players from moving when using skills and or casting spells.

If they move, cancel the spell.. this is why we need progression bars :p
What? Locking player down to position has nothing to do with other player walking trough your spell.

But about that. My spells can already lock caster down if channeling is required :p if I do say so in config.
 
Then player will get hit before he even gets hit by spell.
In my server I want players to be able to dodge spells.


What? Locking player down to position has nothing to do with other player walking trough your spell.

But about that. My spells can already lock caster down if channeling is required :p if I do say so in config.
Sorry I must of misunderstood, i do tend to ignore walls of text :p
 
Code:
local previousPosT = {}   
    for i, posT in pairs(area) do
        local newPreviousPosT = {}
       
        for _, pos in pairs(posT) do
            local min = math.floor(min*(1+0.1*i))
            local max = math.floor(max*(1+0.1*i))
           
            for k, pos2 in pairs(previousPosT) do
                if getDistanceBetween(pos, pos2, true) == 1 then
                    addEvent(dealDamagePos, 200*i, cid, pos2, 18, DEATH, min, max, 18, nil, nil, 100)
                    previousPosT[k] = nil
                end
            end
            table.insert(newPreviousPosT, pos)
            addEvent(dealDamagePos, 200*i, cid, pos, 18, DEATH, min, max, 18, nil, nil, 100) -- 100 is spell custom origin
        end
        previousPosT = newPreviousPosT
    end

This is how I solved it. Sadly had to use custom origin, but Currently they are static values, didn't feel like adding ID's to every damage right now.
Because I didn't want make yet another damage function what is just for this one spell. Becuase damage is dealt in future and matheus solution was meant for "right now function"
 
Back
Top