I increase my str the dmg only increases 1 point per str point which is not right. the math is supposed to be att + str + 100% so essentially str should double my dmg but its not.
In every one of your codes, you make the SAME MISTAKE. You haven't just forgotten order of operations, you straight up forgot algebra in general. Did you even make it through algebra? That's fine if you never did, but then this is all beyond anything you were taught. So I'm going back to the first post here as well.
Code:
global.dmg=global.str + 120/100 * global.att
so my damage should be my strength plus 20% of my att
That's str plus 120% of your att, not 20%. That is a
huge difference.
damage = global.dmg - def+(110/100*def)
As was pointed out already, you were adding defense back into damage. If you added parentheses, it would become damage minus 210% of def.
if i make "damage" = to global.dmg the resulting damage is 6.20
How'd you get 6.2?
5 + 120/100*5 - 5 + 110/100*5 = 11.5
even ignoring str or att, that's still 5.5 or 6.5, not a .2 anywhere.
I am assuming by now you took that line of code out of the Create Event where it doesn't belong, also.
global.dmg - def+110/100*def; should subtract 10% of def from global damage
Same as your att/str code, you say "10%" but your code says 110%. Again, huge difference.
att = wepdmg+global.str+200/100*wepdmg
That's 300% of wepdmg.
global.dmg is based on global.str + 20% of att
global.dmg=global.str + 120/100*att
I shouldn't flog a dead horse, but just to hammer it in: that's 120% of att.
I am running into another problem with my att vs def equation...
everything works frine program wise, but I have a code for increasing damage based on str and att combined, if my attack increases my damage increases a decent amount, but when
I increase my str the dmg only increases 1 point per str point which is not right. the math is supposed to be att + str + 100% so essentially str should double my dmg but its not.
code in objcontroller create event:
Code:
expreq=100;
global.ap=0;
global.str=5;
global.dex=5;
global.mag=5;
global.hp=20;
global.mp=20;
global.mdef=0;
global.def=0;
global.lvl=1;
wepdmg=1
global.att = wepdmg+global.str+200/100*wepdmg
global.hexp=0;
global.dmg=global.att + 140/100*global.str
instance_create_depth(mouse_x,mouse_y,0,objcursor);
instance_create_depth(94,318,0,objbutstr);
instance_create_depth(655,400,1,objslime);
Code for step event for objcontroller:
Code:
if global.hexp > expreq {
global.lvl +=1;
global.ap+=5
wepdmg+=2
expreq = expreq + 100.01/100* expreq
global.att = wepdmg+global.str+200/100*wepdmg
global.dmg=global.att + 200/100*global.str
}
I added the bottom to lines :
Code:
global.att = wepdmg+global.str+200/100*wepdmg
global.dmg=global.att + 200/100*global.str
to see if it would change, but im not sure mathematically what I'm doing wrong to get global.str to affect damage by a %, it should be increasing the amount of dmg by a % instead of 1 point per strength.
This is not part of a real game yet, just a damage/defense generator for a future game I will be programming. I am a graphics artist and a story writer mostly, so math and programming are not my strong suite.
sorry for all the posts, thanks for any help
So many things wrong here...
Once again, you put your damage calculations in a Create Event, even after Tsuriko told you not to.
wepdmg+global.str+200/100*wepdmg is global.str plus 300% of wepdmg, as I pointed out earlier. That's fine in and of itself, but now you have said it's supposed to be 200% str, even though your code says 200% wepdmg.
global.str to affect damage by a %, it should be increasing the amount of dmg by a %
This is actually a completely different formula. In order for str to be a % of wepdmg, you need to multiply wepdmg by str.
global.att = wepdmg * n * (str * a + b) / 100
where n, a, and b are arbitrary modifiers; a multiplicatively increases str's effect, so str increases wepdmg by a%; b increases wepdmg by b%, and n increases wepdmg by a further n00%..
And to actually do this...
...the formula would be
global.att=wepdmg<<str
global.att = wepdmg+global.str+200/100*wepdmg global.dmg=global.att + 200/100*global.str
These two lines together are just
global.dmg = 3*(wepdmg + str)