Moderator note: Moving to RGSS3 Script Requests
Can you give me a more detailed example of what you're currently having to do so I can have a better idea of what it is you're after?
What would you want the tag to be, exactly?
Putting something like <State Attack> in a note box, and then it would add that state changing bit of the formula to any skill that's marked with it.
Though I'm still really fuzzy to how exactly tags work (aside from they go in a note box). Though I feel it might be a stretch to have the damage formula use it since it looks like its something scripts check for rather than the main stuff.
I'll see what I can come up with.
Ok, that works perfectly! I didn't actually think it would be that simple.
So i'm guessing anything under the def "x" gets stored as code. And then you can call it up in the damage formula by just typing it in there?
Yep, it's called a "method" or "function" 🙂 go try to have fun with it
Ok, functions are really great. Though something I've been trying to do is use a function to create a damage formula and a damage formula multiplier. Though I've been having a bit of trouble whenever I try to add variables in the mix - which causes attacks to always return no damage, even though they'd work in the formula box, though I guess I'd be better off asking somewhere else than here since the problems pretty much solved now.
when it returns no damage, it means it has error somewhere in your script. it's somewhat hard to debug since RM just handle the error by returning zero damage, and can't tell what was wrong with it
I definitely narrowed it down to the variables though. When def multiplier is just a number, it works fine.
But when I try to call a variable, or check if an actor has a state I have trouble, though maybe I've just been trying to call them wrong?
Been trying to call states with:
if a.state?(x);0.5;end;
and
variables (mainly weather for now):
if v[3] = 1;0.5;end;
Then they get added like this:
physdam(a,b)*(1+water+rain)
when water and rain, are just a single number the damage works fine. So it has to be the way I'm checking for variables/states.
Okay, game variables worked - weather checks are good to go.
Though I remember seeing somewhere around here (I think in the useful script calls thread) that said v[x] was okay to use instead - but looking at it now my weather common event is using game_variables[x] too so I don't know why I didn't try that sooner.
And I also managed to get the state check working - so the damage formula is working really good now.
Though something I've noticed now, is that weather checks seem to trigger weather instead of checking for it. Which is really strange, since it wasn't happening before.
That might be because you used = instead of ==.
= sets the variable.
== compares the variable with another.
Okay, that worked - but I'm now back to returning no damage. But honestly, I think that has something to do with the functions I've been testing - since I've noticed damage was only happening in the rain, which was pretty much constantly happening during test runs.
So I think it's something to do with the functions I've been testing out, and I don't know if trying to simplify what I have to put in the damage formula box is just making things even more complicated. Though I do know it works fine, when I don't bring up the variable checks, with = or == and it just reduces formula boxes to three variables and two function calls.
edit:
Honestly, at this point I do feel like it would be better to just make a new thread - since I simplified things a bit and found the "real" problem with the code.
Though it feels kind of weird to make a new one with this thread right here and all - though I do feel like it's probably Ok to close this, didn't really figure out how to use tags, but my problem got solved just fine, and functions have been a real game changer for me.
One last edit in case anyone was interested:
But I managed to fix the problem, which was really stupid on my part that I'm not even going to say what the problem was - though the whole "clean up" thing did get me to simplify things up quite a bit - so its not too big of a loss.
But yeah, formula's all good now. I'm sure there's a way to optimize it further, but I'm happy with it right now and I don't want to tempt fate.