can anybody with slight programming knowledge answer this real quick

ok so i have learned you can be a little bit more creative with the damage formula for skills in the game. Basically for the damage of a move i have a.atk *3.5-b.def

i am thinking i am starting to like if statements does anybody know how i would do an if statement to get what i want? I want it to be like if actor is in state 30 then the damage formula becomes a.atk *5-b.def

I was reading a tutorial on using if statements but was not sure on how to do it to achieve the forumula can anybody tell me what i would put in to get that result or if its even possible?

also is there any way that you can have a skill use its own accuracy? like my actors hit is 90% but i want the skill to have a 50% chance of hitting is that possible?

I use battle engine symphony if that helps.
I've moved this thread to VX Ace Support. Please be sure to post your threads in the correct forum next time. Thank you.


You can have a single-line if/then/else statement in the following format:

Code:
if ? then : else
So if you want the damage formula to be a.atk * 5 - b.def when the player has state 30, and a.atk * 3.5 - b.def otherwise, you could write it like this:
Code:
a.state?(30) ? (a.atk * 5 - b.def) : (a.atk * 3.5 - b.def)
or since it's only the constant that changes, like this:
Code:
 a.atk * (a.state?(30) ? 5 : 3.5) - b.def
If you're just starting to get into this and find it interesting, then you should definitely check out this thread, which is pinned at the top of the Ace Tutorials forum.
yeah im really getting into this what do the ? marks define or do?

I like knowing what something does and translating it in my mind ad i read it

you have

a.state?(30) ? (a.atk * 5 - b.def) : (a.atk * 3.5 - b.def)

in my mind im reading it as actors state is 30 i dont see where the if and the else are in that formula. so i guess : symbolizes else but i dont see what states the "if" in that formula if you could point that out i would be very grateful.

Oh yeah and is there away to make the accuracy of a move have a value that is seperate from the actors hit % as a side bar question i had lol.
It's a shortcut way of saying this:

if a.state?(30) a.atk * 5 - b.defelse a.atk * 3.5 - b.defendso ? means "do this if true" and : means "do this if false"

Code:
condition ? action for true : action for false
a.state?(30) means "does the actor have state 30?"I don't know about the other question. Skills have a success % which, I guess, would affect the "accuracy". I haven't really looked into that part much so there may be something more appropriate.

Another way to do the above, rather than changing the damage formula, is to have the state give a temporary increase to the actor's ATK parameter. That would affect ALL skills though (including the basic Attack), not on a skill-by-skill basis.
hmm ok wow i like learning about this stuff i was intimidated by it at first but this is interesting i bet there is a load of cool things you can do with formulas thanks shaz. if sets the condition and the ? gives the command am i interpreting it correctly by saying that?

would leaving out the ? create an error or do they absolutley have to be there because they confuse me when i am reading the formula.
What comes before the ? is the condition. What comes between the ? and the : is the command that's executed if the condition is true. What comes after the : is the command that's executed if the condition is false.


Have a look through that thread I linked. There's a lot of really cool stuff in there.
Hmm ok thanks i will be dissecting that thread you linked to for a while but before i do that do you know if its possible to have a moves accuracy be completely independent of the actors hit %

Like if i wanted a skill to have a 50% chance of hitting the target 
I don't know. Might get you to put that in a different thread with appropriate title, since it's a new question.


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/can-anybody-with-slight-programming-knowledge-answer-this-real-quick.21798/