RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

[VXA] Damage Formula with state as condition [SOLVED]

Started by dragon3025, September 04, 2012, 05:35:56 PM

0 Members and 1 Guest are viewing this topic.

dragon3025

I wasn't sure where to put this, so I hope it's in the right spot.

I'm using a script that allows weapons to have their own custom damage formulas (Kread-EX's "Custom Weapon Formulas"), and a script that allows me to make equipment give passive states (Yanfly's "Yanfly Engine Ace - Passive States"). I made it so equipping a quiver (a type of shield) gives the invisible state 75 (I made it visible for testing though). I wanted to make it so that if state 75 is inflicted, Bows will do more damage, (this way if the quiver is equipped, it does more damage). I used this formula for the Bow:

a.states.include?(75) ? (a.param_plus(2) + a.agi / 2) * 2 : a.atk * 2 - b.def * 2

I noticed that whether the state is inflicted or not, it'll always do the false result, I even used this formula to test it out:

a.states.include?(75) ? 1000 : 10

and it would always give around 10. So, is "a.states.include?(#)" the wrong way to do this? How do I detect whether a state is inflicted, and if you can make a condition that ask whether an armor type is equipped (not an equipment type), can you tell me how to do that?

wsensor

#1
Try
if a.state?(75);(a.param_plus(2) + a.agi / 2) * 2 ; else ; a.atk * 2 - b.def * 2

or slightly smaller.

if a.state?(75) ? a.param_plus(2) + a.agi / 2 * 2 : a.atk * 2 - b.def * 2

I think that should work. Not sure exactly what the a.param_plus(2) is supposed to do 0.o

On Fomar's site there are some tips/tutorials on using the damage formula box.
http://cobbtocs.co.uk/wp/?page_id=269

dragon3025

Quote from: wsensor on September 04, 2012, 11:11:42 PM
Try
if a.state?(75);(a.param_plus(2) + a.agi / 2) * 2 ; else ; a.atk * 2 - b.def * 2

or slightly smaller.

if a.state?(75) ? a.param_plus(2) + a.agi / 2 * 2 : a.atk * 2 - b.def * 2

I think that should work. Not sure exactly what the a.param_plus(2) is supposed to do 0.o

On Fomar's site there are some tips/tutorials on using the damage formula box.
http://cobbtocs.co.uk/wp/?page_id=269
a.param_plus(2) is the combined attack, (it's the 2nd of the parameter stats, with maxhp starting at 0), of the a's weapons and armor. I wanting to make it so that bows don't rely on the character's attack, but still rely on the character's agility.

Thanks for your help, the first one worked so I can use that, but the shorter version gave me this error, (I was using "100 : 10" for testing):

Quote
Script 'Custom Weapon Formulas' line 144: SyntaxError occurred.

unexpected $end, expecting keyword_then or ':' or '\n'
if a.state?(75) ? 100 : 10
Do you know why it's doing this?

Also, thanks for the link, I've seen the first link on that page, but I didn't see the other ones though, I'm take a look at those.

wsensor

I'm not sure whats causing the shorter one to error.
Hmm I have not messed to much with the damage formulas other than lowering max damage/defense in the formulas. For me its atk * 2 - def only so far I am trying to think of a way to make each weapon type unique in damage style.

dragon3025

Quote from: wsensor on September 05, 2012, 08:24:59 PM
I'm not sure whats causing the shorter one to error.
Hmm I have not messed to much with the damage formulas other than lowering max damage/defense in the formulas. For me its atk * 2 - def only so far I am trying to think of a way to make each weapon type unique in damage style.
Alright then, I can still use the longer version, with Kread-EX's script, I don't think I have to worry about space.

I found Final Fantasy XII weapon damage calculations interesting, because certain weapons use agility or magic in the damage calculation and some like guns ignore defense: http://finalfantasy.wikia.com/wiki/List_of_Final_Fantasy_XII_Weapons

Here's a link to Kread-Ex's script if you want to take a look at it: http://grimoirecastle.wordpress.com/2011/12/13/custom-weapon-formulas/

modern algebra

There shouldn't be an if in the shorter one. Ie, it should be:


a.state?(75) ? 100 : 10


Not:


if a.state?(75) ? 100 : 10

dragon3025

Quote from: modern algebra on September 05, 2012, 10:12:00 PM
There shouldn't be an if in the shorter one. Ie, it should be:


a.state?(75) ? 100 : 10


Not:


if a.state?(75) ? 100 : 10

Thanks, I didn't notice the if in the start of it, that error makes sense now.