RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VXA] Damage Formula with state as condition [SOLVED]

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 55
RMRK Junior
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?
« Last Edit: September 06, 2012, 12:35:26 AM by dragon3025 »

**
Rep:
Level 84
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
« Last Edit: September 04, 2012, 11:14:19 PM by wsensor »

**
Rep: +0/-0Level 55
RMRK Junior
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.

**
Rep:
Level 84
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.

**
Rep: +0/-0Level 55
RMRK Junior
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/

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
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

**
Rep: +0/-0Level 55
RMRK Junior
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.