The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX Ace => Topic started by: dragon3025 on September 04, 2012, 05:35:56 PM

Title: [VXA] Damage Formula with state as condition [SOLVED]
Post by: dragon3025 on September 04, 2012, 05:35:56 PM
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:

Code: [Select]
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:

Code: [Select]
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?
Title: Re: Damage Formula with state as condition
Post by: wsensor on September 04, 2012, 11:11:42 PM
Try
Code: [Select]
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
Title: Re: Damage Formula with state as condition
Post by: dragon3025 on September 05, 2012, 03:11:05 PM
Try
Code: [Select]
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.
Title: Re: Damage Formula with state as condition
Post by: 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.
Title: Re: Damage Formula with state as condition
Post by: dragon3025 on September 05, 2012, 08:40:37 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/
Title: Re: Damage Formula with state as condition
Post by: modern algebra on September 05, 2012, 10:12:00 PM
There shouldn't be an if in the shorter one. Ie, it should be:

Code: [Select]
a.state?(75) ? 100 : 10

Not:

Code: [Select]
if a.state?(75) ? 100 : 10
Title: Re: Damage Formula with state as condition
Post by: dragon3025 on September 06, 2012, 12:34:57 AM
There shouldn't be an if in the shorter one. Ie, it should be:

Code: [Select]
a.state?(75) ? 100 : 10

Not:

Code: [Select]
if a.state?(75) ? 100 : 10
Thanks, I didn't notice the if in the start of it, that error makes sense now.