Damage Calculation Bug

This forum is currently in read-only mode.
From the Asset Store
This sound pack features 117 game sounds : Axe,Punch Swing & Hit & Damage. This is a perfect collection for your game.
  • 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. <img src="smileys/smiley3.gif" border="0" align="middle">

    Any thoughts, gentlemen? They would be much appreciated! <img src="smileys/smiley4.gif" border="0" align="middle">

    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! <img src="smileys/smiley9.gif" border="0" align="middle">

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • <img src="smileys/smiley4.gif" border="0" align="middle" />

    I wouldn't be ashamed. You managed to solve this issue. That's all that counts <img src="smileys/smiley2.gif" border="0" align="middle" />

    (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 <img src="smileys/smiley41.gif" border="0" align="middle" /> )

  • 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.

  • 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.cap

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)