Storing enemy stats/attributes inside variables to apply in Damage Formula, won't work.

Discussion in 'RPG Maker MV' started by Bulletcaster, Jan 22, 2018.

  1. Bulletcaster

    Bulletcaster Warper Member

    Likes Received:
    First Language:
    Primarily Uses:
    Hi guys, this is actually my first time posting a thread on this website. I hope I am easy to understand.
    I have the following situation:

    I have assigned certain enemy attributes to variables for each of them. I used the command "Control Variables"
    In this case for:
    enemy ID #5 Current HP --> V[1]
    enemy ID #5 MAX HP --> V[2]
    enemy ID #6 Current HP --> V[3]
    enemy ID #6 MAX HP --> V[4]

    Both enemy 5 and 6 have 500 max hp.
    Also, lets consider current hp to be 370hp for #5 and 450hp for #6.

    The idea is, to create an attack that takes the current damage dealt to the specified enemies (#5 and #6), make some calculations, and return it to the target.

    Whether I create an event with parallel running span or a common event linked to an event in the map, or even on the troop events,
    the damage returned is always 0.
    c=((v[1]/v[2])-1)*-1; d=((v[3]/v[4])-1)*-1; e=d+c; e<=0?e*-1*v[4]+(v[1]*c):e>=0?e*v[4]+(v[1]*c):0;

    If the variables were substituted with the expected values, it would look like:

    c = (( 370 / 500 ) -1 )* -1; d = (( 450 / 500 ) -1 ) * -1; e = d + c; e <= 0? e * -1 *500 + (370*c):e >= 0? e * 500 + (370*c): 0

    Result as damage output should be: 276

    I have another one that uses the caster and the target in the formula, instead of the Variables.. and that works just fine.
    However, this one doesn't :-(

    I attached some Screenshots too. Sorry for it being in German, language was set automatically.
    (In the command list, it says "Control Variables" and my Plugin list looks messy too XD)

    Thanks in advance for anyone who is willing to help me in this case.

    Attached Files:

    Last edited: Jan 26, 2018

Share This Page