Damage Calculation Bug

For questions about using Classic.

Post » Tue Sep 13, 2011 12:48 am

So I've got a pretty spiffy damage calculation thing going on here. But it's got a couple issues.

http://dl.dropbox.com/u/20459682/attack_calculator.cap

This is basically the calculator I'm going to be using for normal attacks in my game. To use it, you just input the values desired into each of the locations, and then click the "Attack!" button. Then it automatically calculates damage and shows you the values for each step of the calculation. Fun stuff!

One thing to mention is that because of the way the elemental detection works, the Attacker Element needs to be set to -1. Which brings us to our first bug...

BUG #1
I'm basically trying to use Find(Enemy Elements, Attack Element) > 0 to see if there's an element match in the EnElem string with the singular AtkElem. This works fine when:

Attack Element = "f"
Enemy Elements = "f"

but if we change it to

Attack Element = "f"
Enemy Elements = "f, w, z" or Enemy Elements = "fwz"

it seems like it returns 0 and doesn't modify the Attack Power.

BUG #2
I have a Critical Hit chance set up. The calculation is

Attack Luck >= random(1024)
--> Attack Power * 1.5

I've tried to rig it in any number of ways to get it to work, from trying to set the delays a little longer to making it automatically attempt to modify the damage by toggling off the Luck requirement, and no dice. At least it's not reading these dice.


Any thoughts, gentlemen? They would be much appreciated!

EDIT:
Just noticed now none of the modifications are actually working... what am I screwing up on?

EDIT #2:
So I did even further examining, looking over my events, still unable to figure out what I was doing wrong in the damage calculations and discovered... I was actually doing it right and it was working as intended. The bugs were actually in the display code, where it wasn't displaying the actual damage being done, just the attack power after Step 2. So the displayed calculations don't function properly but the actual damage done works correctly. If you take the enemy HP value in the last equation and subtract the number down at the bottom (the final enemy HP) it shows the proper damage was delivered.

Oh, oversights! TL222011-09-13 18:34:55
B
57
S
20
G
7
Posts: 305
Reputation: 8,779

Post » Tue Sep 13, 2011 7:30 pm



I wouldn't be ashamed. You managed to solve this issue. That's all that counts

(And to make you feel better: I downloaded the cap yesterday and did not stumble upon that. I was about to blame the wait actions. What a relief that I don't answer anything unless I'm at least 50% sure about a possible solution )
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Wed Sep 14, 2011 8:29 am

As Tulamide mentioned "Wait", when you're using "Wait", the lowest number you can use is 10ms, anything below is too small, but he would tell you better, he's wrote few posts about it where it's explained in detail.
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Wed Sep 14, 2011 4:46 pm

You know, I think I remember that explanation before. Something about ticks versus timedelta or something, right? Which made me wonder why this formula is even working right in the first place. So I got rid of the wait functions and tested it out and it still worked fine. Which means I don't have to add the waits in! Thanks for the reminder! It's nice that Construct does actually perform the events in order.

The updated cap, which uses an Array, which is what my game will be utilizing to keep track of stats.

http://dl.dropbox.com/u/20459682/attack_calculator.capTL222011-09-14 16:47:02
B
57
S
20
G
7
Posts: 305
Reputation: 8,779


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests