RPG Maker MV

RPG Maker MV

Trouble with damage calculations. Using Timed Attack plugin.
I'm using SRD_TimedAttackCore and SRD_SequenceInput, trying to add timed hits to a particular attack. Problem is, I want my project to be the kind of game where most stats don't leave the single digits until past midgame or so. So the only test enemies I have programmed have a defense of 1 and 2 respectively, with 5 and 10 HP. Trying to keep it simple.

My problem is the way the example SRD gives handles damage calculation: the number it stores is apparently based on the number of frames. This leaves me with an attack that deals 2 HP when left alone, but deals a minimum of 11 HP damage when I press the button before the attack. I've even seen it reach the 30s. Needless to say that throws the balance out the window and I don't want that.

I've been trying to fiddle with the variable it saves, attempting to add something that turns the variable into more manageable numbers at one point before it does the damage calculation, but I either end up making the game freeze or it still results in double digits damage. I've tried looking online to see what I'm doing wrong, but much to my delight the only thread I found I could understand had the relevant piece of code deleted from the page.

Here's my damage formula and the lines of stuff I have inside the notes box.

a.atk + v[5] - b.def

<target action> move user: target, front, 30 wait for movement start sequence input: ok, 5 motion swing: user perform action motion wait: user end sequence input if $gameVariables.value(5) > 25 $gameVariables.setValue(5, 1) else $gameVariables.setValue(5, 0) end
< >
Showing 1-1 of 1 comments
I doubt anybody ever had the same problem as I did, but I'm just writing this down here just in case it can help somebody in the future (you know, avoid the wonderful "nvm I fixed it" posts).

The solution was actually really simple: since I know the variable will at most return 30, I set the attack formula to divide the variable by 30. That way, if it's really close to 30, it will round the result up to 1, and only add such. Otherwise it will round the resulting number down to zero and the rest of the attack formula will be intact.

Like this:

(v[5] / 30) + (a.atk - b.def)

It's probably something very basic for most programmers out there, oh well.
< >
Showing 1-1 of 1 comments
Per page: 1530 50

Date Posted: Oct 6, 2017 @ 11:11pm
Posts: 1