Proximity DMG, more DMG closer to target?

Im trying to make an earthquake skill with an AOE from YF plugin. I figure if I can make 3 skills, one being the Earthquake with a 200 radius that does small damage, on cast it force action to go into EQ2 which does more damage but smaller AOE, finally repeating that for EQ3 which has a smaller range and more damage.
Also ideally I would use action sequences so it doesnt display any animations or text past the first cast.

I tried a few things but I cant get it to work at all, if it does damage its all over the place, I tested numbers with 25/50/100. The second hit ignores the original target and does 100 dmg to one enemy and 50 to another which makes no sense to me.
Code:
<Post-Damage Eval>
// Get the skill ID of the skill that will launch once the charging is complete.
var skill = 138;
// The target's index. -1 for random. -2 for last target.
var target = -2;
// Set the forced action for the user.
user.forceAction(skill, target);
BattleManager.forceAction(user);
BattleManager.processForcedAction();
</Post-Damage Eval>

Is there any way to make this possible where the closer to origin of spell the more damage is dealt?

I've moved this thread to Javascript/Plugin Support. Thank you.

Can you clarify few points ?
- the meaning of AoE : A skill that target multiple enemies as it could be done with default scope options or does the AoE correspond to the use of the plugin YEP_X_AreaOfEffect.js
- Do you really need multiple skills ?
- Do you really want to use forceAction ?

Best,

Lay.
Can you clarify few points ?
- the meaning of AoE : A skill that target multiple enemies as it could be done with default scope options or does the AoE correspond to the use of the plugin YEP_X_AreaOfEffect.js
- Do you really need multiple skills ?
- Do you really want to use forceAction ?

Best,

Lay.

-Im using YEP_X_AreaOfEffect
-I don't but have no other idea how to achieve this.
-No, forceAction is awful and hardly works but again its something I thought could work.
Edit: One problem im seeing with forceAction is -2, the last target seems change focus from the first enemy (B in example) to the last target it did damage which I think calculates as C or A maybe because of YF AOE coding. The second forceAction never seems to work properly either.
Simply put it wont target properly.

Im not sure if im using forceAction properly. The way I propose is most likely more complicated than it needs to be.
In my head you cast the main spell with animations, then it forces another spell that does not have animation (maybe just a screen shake) to display more damage, so it ends up look like
Code:
Enemies   - Wave/Spell(1)    -Wave(2)    -Wave(3)
    A     - 25dmg           - 50dmg      
   B      - 25dmg            - 50dmg        - 100dmg
C         - 25dmg
A takes 75 damge being close to origin
B takes the most being the origin at 175dmg
C is just inside the AoE and takes 25dmg.
If you find the correct target eval, then this should help with reducing damage for each subsequent target hit:

<Damage Formula>
this._chainmultiplier = this._chainmultiplier || 1.0;
value = user.atk + user.agi;
value *= this._chainmultiplier;
this._chainmultiplier -= 0.25;
</Damage Formula>

The problem with this is that you have to set up a pool of targets to choose from. I don't know the javascript line for isolating targets the way you want.


On another note, you could achieve what you want using the Irina Action Impact plugin, because it allows you to select 'previous target' and 'next target' within action sequences, and this one costs some $$$. So if you were to use that plugin, you could actually change the damage formula for the 'next target' after the initial target of the skill (by referencing a variable in the damage formula box) within the action sequence. And maybe there is a way to do this without this particular plugin, I'm not sure how though. I am interested if you can figure this out though.
Y
If you find the correct target eval, then this should help with reducing damage for each subsequent target hit:

<Damage Formula>
this._chainmultiplier = this._chainmultiplier || 1.0;
value = user.atk + user.agi;
value *= this._chainmultiplier;
this._chainmultiplier -= 0.25;
</Damage Formula>

The problem with this is that you have to set up a pool of targets to choose from. I don't know the javascript line for isolating targets the way you want.


On another note, you could achieve what you want using the Irina Action Impact plugin, because it allows you to select 'previous target' and 'next target' within action sequences, and this one costs some $$$. So if you were to use that plugin, you could actually change the damage formula for the 'next target' after the initial target of the skill (by referencing a variable in the damage formula box) within the action sequence. And maybe there is a way to do this without this particular plugin, I'm not sure how though. I am interested if you can figure this out though.

Yeah I have no idea the formula or even have the skills lol. If forcedAction actually worked and was usable it would make it easier IMO. If we knew how to check for distance between enemies and set if conditions then maybe it will work.

An idea we could do is have it go with Rows instead simpler to Piercing Arrow, change it so if target is in the same row damage = 100%,
+/- 1 row DMG =50%,
+/- 2rows DMG=25%.
Im too lazy to try it because its not my intended design but it should work and its kinda similar to what we are going for. Enemies further from origin take less damage. I guess it turns into a target all skill at that point?
change the different values to fit your game.

JavaScript:
<Post-Damage Eval>

var originTarget_x = target.spriteHomeX();
var originTarget_y = target.spriteHomeY();

var innerShell = 50; // all enemies with a distance from the target below this value will be in the innerShell
var midShell = 150; // all enemies with a distance from the target below this value will be in the midShell
var outerShell = 200; // all enemies with a distance from the target below this value will be in the outerShell. This value might fit with the AoE of your skill.

var maxIteration = $gameTroop.aliveMembers().length
var enemies = $gameTroop.aliveMembers()

for (i = 0; i < maxIteration; i++){

    // get curent target and curent target position
    var curTarget = enemies[i];
    var curTarget_x = curTarget.spriteHomeX();
    var curTarget_y = curTarget.spriteHomeY();

    // compute distance between origin position and current target position
    var dist = Math.sqrt( (originTarget_x - curTarget_x)**2 + (originTarget_y - curTarget_y)**2);
    dist = Math.floor(dist);

    var damage = 0

    // apply damage
    // to make damages proportional to the damage of the skill, use the keyword 'value'
   // exemple : damage = value * 0.75 // 75% of the damage dealt on the target.


    // the damages applied to the target are govern by the skill. So here we do nothing
    if (dist === 0) {  

   // below the damages applied to all enemies that are in the inner shell
    } else if (dist < innerShell) {
        damage = -300;
        curTarget.gainHp(damage);
        curTarget.startDamagePopup();

    // below the damages applied to all enemies that are in the midshell
    } else if (dist < midShell) {
        damage = -200;
        curTarget.gainHp(damage);
        curTarget.startDamagePopup();

    // below the damages applied to all enemies that are in the outerShell
    } else if (dist < outerShell) {
        damage = -100;
        curTarget.gainHp(damage);
        curTarget.startDamagePopup();
    };

    // because we are in post damage eval, we have to perform collapse if hp < 0
    if (curTarget.hp <= 0) curTarget.performCollapse();

};

</Post-Damage Eval>

The skill has to target only one enemy.


EDIT : mistake, I've send the message before I've finished. Few explanation are missing xD
I have added notes to the script.
If that works, it's brilliant! Lol, I did not even think about using the x,y coordinates in such a way.
If that works, it's brilliant! Lol, I did not even think about using the x,y coordinates in such a way.
I don't know if it will works as you wish but, so far I tried in a new rmmv project, the skill works according to the general idea.
If you want to introduce the notion of distance between targets in your skill, you will need to use x,y coordinates btw.
I was thinking of the issue more in terms of target selection through the action sequencing with plugins.

But if your way works, then I believe that's what the OP wanted.
change the different values to fit your game.

JavaScript:
<Post-Damage Eval>

var originTarget_x = target.spriteHomeX();
var originTarget_y = target.spriteHomeY();

var innerShell = 50; // all enemies with a distance from the target below this value will be in the innerShell
var midShell = 150; // all enemies with a distance from the target below this value will be in the midShell
var outerShell = 200; // all enemies with a distance from the target below this value will be in the outerShell. This value might fit with the AoE of your skill.

var maxIteration = $gameTroop.aliveMembers().length
var enemies = $gameTroop.aliveMembers()

for (i = 0; i < maxIteration; i++){

    // get curent target and curent target position
    var curTarget = enemies[i];
    var curTarget_x = curTarget.spriteHomeX();
    var curTarget_y = curTarget.spriteHomeY();

    // compute distance between origin position and current target position
    var dist = Math.sqrt( (originTarget_x - curTarget_x)**2 + (originTarget_y - curTarget_y)**2);
    dist = Math.floor(dist);

    var damage = 0

    // apply damage
    // to make damages proportional to the damage of the skill, use the keyword 'value'
   // exemple : damage = value * 0.75 // 75% of the damage dealt on the target.


    // the damages applied to the target are govern by the skill. So here we do nothing
    if (dist === 0) {

   // below the damages applied to all enemies that are in the inner shell
    } else if (dist < innerShell) {
        damage = -300;
        curTarget.gainHp(damage);
        curTarget.startDamagePopup();

    // below the damages applied to all enemies that are in the midshell
    } else if (dist < midShell) {
        damage = -200;
        curTarget.gainHp(damage);
        curTarget.startDamagePopup();

    // below the damages applied to all enemies that are in the outerShell
    } else if (dist < outerShell) {
        damage = -100;
        curTarget.gainHp(damage);
        curTarget.startDamagePopup();
    };

    // because we are in post damage eval, we have to perform collapse if hp < 0
    if (curTarget.hp <= 0) curTarget.performCollapse();

};

</Post-Damage Eval>

The skill has to target only one enemy.


EDIT : mistake, I've send the message before I've finished. Few explanation are missing xD
I have added notes to the script.

Wow very cool! Love the notes, im trying to learn so it helps a lot! I don't fully get it all but now I have a reference!
However it does not work
I got this error:
SyntaxError: Unexpected token *

HumanNinjaToo Did you try it?
Wow very cool! Love the notes, im trying to learn so it helps a lot! I don't fully get it all but now I have a reference!
However it does not work
I got this error:
SyntaxError: Unexpected token *

HumanNinjaToo Did you try it?

Don't understand why, it works fine for me with the exact same code (I've just copied/pasted it in a new skill on my rmmv test project)
Don't understand why, it works fine for me with the exact same code (I've just copied/pasted it in a new skill on my rmmv test project)

Just Tried it in a new game with just YANFLY CORE, BATTLE CORE, SKILL CORE. Same error, im on 1.51 btw
The way javascript works with your version probaly doesn't support the way to make exponent using **. use the script below and tell me if it works

JavaScript:
<Post-Damage Eval>

var originTarget_x = target.spriteHomeX();
var originTarget_y = target.spriteHomeY();

var innerShell = 50; // all enemies with a distance from the target below this value will be in the innerShell
var midShell = 150; // all enemies with a distance from the target below this value will be in the midShell
var outerShell = 200; // all enemies with a distance from the target below this value will be in the outerShell. This value might fit with the AoE of your skill.

var maxIteration = $gameTroop.aliveMembers().length
var enemies = $gameTroop.aliveMembers()

for (i = 0; i < maxIteration; i++){

    // get curent target and curent target position
    var curTarget = enemies[i];
    var curTarget_x = curTarget.spriteHomeX();
    var curTarget_y = curTarget.spriteHomeY();

    // compute distance between origin position and current target position
    var dx = originTarget_x - curTarget_x;
    var dy = originTarget_y - curTarget_y;
    var dist = Math.sqrt( Math.pow(dx,2) + Math.pow(dy,2));
    dist = Math.floor(dist);

    var damage = 0

    // apply damage
    // to make damages proportional to the damage of the skill, use the keyword 'value'
   // exemple : damage = value * 0.75 // 75% of the damage dealt on the target.


    // the damages applied to the target are govern by the skill. So here we do nothing
    if (dist === 0) {

   // below the damages applied to all enemies that are in the inner shell
    } else if (dist < innerShell) {
        damage = -300;
        curTarget.gainHp(damage);
        curTarget.startDamagePopup();

    // below the damages applied to all enemies that are in the midshell
    } else if (dist < midShell) {
        damage = -200;
        curTarget.gainHp(damage);
        curTarget.startDamagePopup();

    // below the damages applied to all enemies that are in the outerShell
    } else if (dist < outerShell) {
        damage = -100;
        curTarget.gainHp(damage);
        curTarget.startDamagePopup();
    };

    // because we are in post damage eval, we have to perform collapse if hp < 0
    if (curTarget.hp <= 0) curTarget.performCollapse();

};

</Post-Damage Eval>
The way javascript works with your version probaly doesn't support the way to make exponent using **. use the script below and tell me if it works

JavaScript:
<Post-Damage Eval>

var originTarget_x = target.spriteHomeX();
var originTarget_y = target.spriteHomeY();

var innerShell = 50; // all enemies with a distance from the target below this value will be in the innerShell
var midShell = 150; // all enemies with a distance from the target below this value will be in the midShell
var outerShell = 200; // all enemies with a distance from the target below this value will be in the outerShell. This value might fit with the AoE of your skill.

var maxIteration = $gameTroop.aliveMembers().length
var enemies = $gameTroop.aliveMembers()

for (i = 0; i < maxIteration; i++){

    // get curent target and curent target position
    var curTarget = enemies[i];
    var curTarget_x = curTarget.spriteHomeX();
    var curTarget_y = curTarget.spriteHomeY();

    // compute distance between origin position and current target position
    var dx = originTarget_x - curTarget_x;
    var dy = originTarget_y - curTarget_y;
    var dist = Math.sqrt( Math.pow(dx,2) + Math.pow(dy,2));
    dist = Math.floor(dist);

    var damage = 0

    // apply damage
    // to make damages proportional to the damage of the skill, use the keyword 'value'
   // exemple : damage = value * 0.75 // 75% of the damage dealt on the target.


    // the damages applied to the target are govern by the skill. So here we do nothing
    if (dist === 0) {

   // below the damages applied to all enemies that are in the inner shell
    } else if (dist < innerShell) {
        damage = -300;
        curTarget.gainHp(damage);
        curTarget.startDamagePopup();

    // below the damages applied to all enemies that are in the midshell
    } else if (dist < midShell) {
        damage = -200;
        curTarget.gainHp(damage);
        curTarget.startDamagePopup();

    // below the damages applied to all enemies that are in the outerShell
    } else if (dist < outerShell) {
        damage = -100;
        curTarget.gainHp(damage);
        curTarget.startDamagePopup();
    };

    // because we are in post damage eval, we have to perform collapse if hp < 0
    if (curTarget.hp <= 0) curTarget.performCollapse();

};

</Post-Damage Eval>

Copy pasted your code, I set the default damage to 25 in skill formula box:

Target is the bat closest to players and for some reason it does 200 damage to everyone except the middle bat which takes 200 twice :S

For reference 200 AoE hits all 3 targets if the bat is targeted if the second bat is targeted then only hits flower and that second bat.
I don't understand why it works so differently between you and me.
Does it the only one notetag you have set to your skill ?
Does scope is set to one enemy only ?

EDIT : according to your picture it seems that scope is all enemy, it should be only one.
I don't understand why it works so differently between you and me.
Does it the only one notetag you have set to your skill ?
Does scope is set to one enemy only ?

EDIT : according to your picture it seems that scope is all enemy, it should be only one.

I had aoe 200 radius but I removed it and now its giving me the following results;
If I target the closest bat from the pic, it deals 200 damage to the second (middle bat)
Targeting middle bat does 200 damage to other bat and plant,
Targeting plant does 200 to middle bat,
none do damage to the target except 24 damage which makes no sense since I have it set to 25 with no variance. The pic shows the AOE notetag but I didnt have it when I checked this.


EDIT: Also I tried this and for some reason its giving me variance on damage, aside from the point its not targeting properly. How come the damage on main target is 187 and 94 on mid shell... btw I set damage to be flat 200 in this scenario.

Code:
<Post-Damage Eval>

var originTarget_x = target.spriteHomeX();
var originTarget_y = target.spriteHomeY();

var innerShell = 100; // all enemies with a distance from the target below this value will be in the innerShell
var midShell = 150; // all enemies with a distance from the target below this value will be in the midShell
var outerShell = 200; // all enemies with a distance from the target below this value will be in the outerShell. This value might fit with the AoE of your skill.

var maxIteration = $gameTroop.aliveMembers().length
var enemies = $gameTroop.aliveMembers()

for (i = 0; i < maxIteration; i++){

    // get curent target and curent target position
    var curTarget = enemies[i];
    var curTarget_x = curTarget.spriteHomeX();
    var curTarget_y = curTarget.spriteHomeY();

    // compute distance between origin position and current target position
    var dx = originTarget_x - curTarget_x;
    var dy = originTarget_y - curTarget_y;
    var dist = Math.sqrt( Math.pow(dx,2) + Math.pow(dy,2));
    dist = Math.floor(dist);

    var damage = 0

    // apply damage
    // to make damages proportional to the damage of the skill, use the keyword 'value'
   // exemple : damage = value * 0.75 // 75% of the damage dealt on the target.


    // the damages applied to the target are govern by the skill. So here we do nothing
    if (dist === 0) {

   // below the damages applied to all enemies that are in the inner shell
    } else if (dist < innerShell) {
        damage = -Math.round(value);
        curTarget.gainHp(damage);
        curTarget.startDamagePopup();

    // below the damages applied to all enemies that are in the midshell
    } else if (dist < midShell) {
        damage = -(Math.round(value * .5));
        curTarget.gainHp(damage);
        curTarget.startDamagePopup();

    // below the damages applied to all enemies that are in the outerShell
    } else if (dist < outerShell) {
        damage = -(Math.round(value * .25));
        curTarget.gainHp(damage);
        curTarget.startDamagePopup();
    };

    // because we are in post damage eval, we have to perform collapse if hp < 0
    if (curTarget.hp <= 0) curTarget.performCollapse();

};

</Post-Damage Eval>
The 24 damages dealt to the target really come from the 25 you have set from the editor. The target do not receive damage from what is indicated in the notetag. If you want that this skill makes sens, you have to edit the notetags and the different values I have fixed in order to fit your game.

The challenge of those kind of skills resides in how we can get access to the x,y coordinates of a target.
When using the AOE yanfly plugin, during pre or post-damage eval, we don't have any variable that could be used to define what are those coordinates.

If you want to use the yanfly aoe plugin, I can propose you the following set of notetags.

However, it imposes to dedicate 2 game variables to it. Those variables could correspond to variables that are used in a row and frequently erased.

This is the best I can do. If it's not enought, I'm affraid that you will need to wait for a better maker.

JavaScript:
<AOE Radius: 250>

<Custom Execution>
// Custom Execution is executed only once regardless of the scope size
$gameVariables.setValue(1,-1); // set a variable to -1.
$gameVariables.setValue(2,-1); // set a variable to -1.
// Make sure those variables are not important for your game
</Custom Execution>

<Pre-Damage Eval>
// When scope consist in multiple target, Pre-Damage Eval is executed as many times
// as there are targets. The variable target refer to the current target.
// With a yanfly AOE scope, the first target in the list is the target at the center.

var innerShell = 50; // setting what our shells will looks like.
var midShell = 100;
var outerShell = 150;

var x = $gameVariables.value(1); // the variable with ID 1 is used for x
var y = $gameVariables.value(2); // the variable with ID 2 is used for y

var target_x = target.aoeX(); // this is the x coord of the current target
var target_y = target.aoeY(); // this is the y coord of the current target

if (x === -1 && y === -1){ // x and y = -1 only for the first target.
    $gameVariables.setValue(1,target_x); // store the x coord of the first target
    $gameVariables.setValue(2,target_y); // store the y coord of the first target
}

// Below computing the distance between first target and current target.
dx = target_x - $gameVariables.value(1);
dy = target_y - $gameVariables.value(2);
dist = Math.sqrt( Math.pow(dx,2) + Math.pow(dy,2) );

// Below scalling the damage according to shells.
if (dist < innerShell) {
    value = value;
} else if (dist < midShell) {
    value = 0.75 * value;
} else if (dist < outerShell) {
    value = 0.5 * value;
} else if (dist > outerShell) {
    value = 0.25 * value;
}
</Pre-Damage Eval>

An alternative is to store the x and y variable inside the user. Thus, don't need to use $gameVariables

JavaScript:
<AOE Radius: 250>

<Custom Execution>
// Custom Execution is executed only once regardless of the scope size
user._targetX = -1; // set a variable to -1.
user._targetY = -1; // set a variable to -1.
// Make sure those variables are not important for your game
</Custom Execution>

<Pre-Damage Eval>
// When scope consist in multiple target, Pre-Damage Eval is executed as many times
// as there are targets. The variable target refer to the current target.
// With a yanfly AOE scope, the first target in the list is the target at the center.

var innerShell = 50; // setting what our shells will looks like.
var midShell = 100;
var outerShell = 150;

var x = user._targetX; // the variable with ID 1 is used for x
var y = user._targetY; // the variable with ID 2 is used for y

var target_x = target.aoeX(); // this is the x coord of the current target
var target_y = target.aoeY(); // this is the y coord of the current target

if (x === -1 && y === -1){ // x and y = -1 only for the first target.
    user._targetX = target_x; // store the x coord of the first target
    user._targetY = target_y; // store the y coord of the first target
}

// Below computing the distance between first target and current target.
dx = target_x - user._targetX;
dy = target_y - user._targetY;
dist = Math.sqrt( Math.pow(dx,2) + Math.pow(dy,2) )

// Below scalling the damages according to shells.
if (dist < innerShell) {
    value = value;
} else if (dist < midShell) {
    value = 0.75 * value;
} else if (dist < outerShell) {
    value = 0.5 * value;
} else if (dist > outerShell) {
    value = 0.25 * value;
}
</Pre-Damage Eval>
Wow thank you
The 24 damages dealt to the target really come from the 25 you have set from the editor. The target do not receive damage from what is indicated in the notetag. If you want that this skill makes sens, you have to edit the notetags and the different values I have fixed in order to fit your game.

The challenge of those kind of skills resides in how we can get access to the x,y coordinates of a target.
When using the AOE yanfly plugin, during pre or post-damage eval, we don't have any variable that could be used to define what are those coordinates.

If you want to use the yanfly aoe plugin, I can propose you the following set of notetags.

However, it imposes to dedicate 2 game variables to it. Those variables could correspond to variables that are used in a row and frequently erased.

This is the best I can do. If it's not enought, I'm affraid that you will need to wait for a better maker.

JavaScript:
<AOE Radius: 250>

<Custom Execution>
// Custom Execution is executed only once regardless of the scope size
$gameVariables.setValue(1,-1); // set a variable to -1.
$gameVariables.setValue(2,-1); // set a variable to -1.
// Make sure those variables are not important for your game
</Custom Execution>

<Pre-Damage Eval>
// When scope consist in multiple target, Pre-Damage Eval is executed as many times
// as there are targets. The variable target refer to the current target.
// With a yanfly AOE scope, the first target in the list is the target at the center.

var innerShell = 50; // setting what our shells will looks like.
var midShell = 100;
var outerShell = 150;

var x = $gameVariables.value(1); // the variable with ID 1 is used for x
var y = $gameVariables.value(2); // the variable with ID 2 is used for y

var target_x = target.aoeX(); // this is the x coord of the current target
var target_y = target.aoeY(); // this is the y coord of the current target

if (x === -1 && y === -1){ // x and y = -1 only for the first target.
    $gameVariables.setValue(1,target_x); // store the x coord of the first target
    $gameVariables.setValue(2,target_y); // store the y coord of the first target
}

// Below computing the distance between first target and current target.
dx = target_x - $gameVariables.value(1);
dy = target_y - $gameVariables.value(2);
dist = Math.sqrt( Math.pow(dx,2) + Math.pow(dy,2) );

// Below scalling the damage according to shells.
if (dist < innerShell) {
    value = value;
} else if (dist < midShell) {
    value = 0.75 * value;
} else if (dist < outerShell) {
    value = 0.5 * value;
} else if (dist > outerShell) {
    value = 0.25 * value;
}
</Pre-Damage Eval>

An alternative is to store the x and y variable inside the user. Thus, don't need to use $gameVariables

JavaScript:
<AOE Radius: 250>

<Custom Execution>
// Custom Execution is executed only once regardless of the scope size
user._targetX = -1; // set a variable to -1.
user._targetY = -1; // set a variable to -1.
// Make sure those variables are not important for your game
</Custom Execution>

<Pre-Damage Eval>
// When scope consist in multiple target, Pre-Damage Eval is executed as many times
// as there are targets. The variable target refer to the current target.
// With a yanfly AOE scope, the first target in the list is the target at the center.

var innerShell = 50; // setting what our shells will looks like.
var midShell = 100;
var outerShell = 150;

var x = user._targetX; // the variable with ID 1 is used for x
var y = user._targetY; // the variable with ID 2 is used for y

var target_x = target.aoeX(); // this is the x coord of the current target
var target_y = target.aoeY(); // this is the y coord of the current target

if (x === -1 && y === -1){ // x and y = -1 only for the first target.
    user._targetX = target_x; // store the x coord of the first target
    user._targetY = target_y; // store the y coord of the first target
}

// Below computing the distance between first target and current target.
dx = target_x - user._targetX;
dy = target_y - user._targetY;
dist = Math.sqrt( Math.pow(dx,2) + Math.pow(dy,2) )

// Below scalling the damages according to shells.
if (dist < innerShell) {
    value = value;
} else if (dist < midShell) {
    value = 0.75 * value;
} else if (dist < outerShell) {
    value = 0.5 * value;
} else if (dist > outerShell) {
    value = 0.25 * value;
}
</Pre-Damage Eval>
Wow thank you so much Lay! I appreciate it 🙂
Im using the second code and it works very well, im very impressed, I would haave never understood it enough to create this.
I was only mentioned before why the damage is not what I set it in the formula but I assume its because of the distance and its fine. I was just curious.
So if I understand correctly the second code doesnt use game variables to store data so I dont need to dedicate a variable to it?
no you don't have to.
But you will need to edit the shell in the script to fit your game.
In the present script, shells are define as 50px, 100px and 150px distances. if your aoe radius is 100px, those shells definition will not make sens.
find the following lines in the script and edit them accordingly :
JavaScript:
var innerShell = 50; // setting what our shells will looks like.
var midShell = 100;
var outerShell = 150;

PS : pretty sure you can understand it, the most complex thing in it is the pythagorean theorem

Original thread: https://forums.rpgmakerweb.com/threads/proximity-dmg-more-dmg-closer-to-target.120927/