Script Call to Add State on Skill User

First off, I hope I'm in the right forum locale for this type of post. Sorry if not! May a thousand lashes fall upon my naked back!

Anyway - I'm trying to utilize a script call to add a state on the user of a skill. I have an attack that takes 1 target, deals no damage, and needs to put a state both on the target and the user. I was using the custom formula box to do this via a.add_state(id), but since it has to be an HP damaging skill to use the formula box at all, it registers the 0 damage as a null. Kind of ruins it.

My current workaround is to use a common event to change the state, but that necessitates different skills for both actors and enemies and is quite cumbersome since it only refers to actor ID and troop position.

Is there any piece of code I can throw into a script call to add a state to the user of the skill?

I guess while I'm asking, is there a way to do this for the target as well?

EDIT: Really, at the core of what I'm asking is... What are the real values that "a" and "b" in the custom formula box refer to?

Thanks, everyone!
You can add more than one "line" to the formula box if you separate them with semi-colons ( ; ). You want your actual damage formula to be last.


a.add_state(id); a.atk * 4 - b.def * 2


for example.


a and b are there so you can access that stats of both the user and the target of the action.


You can give this thread a read to see other uses of the formula box.
I can't use the custom formula box on a skill that doesn't deal any damage 'coz I don't want it to show up as having dealt no damage. Otherwise, just like you say, it's the simple matter of:

a.add_state(x); b.add_state(y); a.atk*4 - b.def*2;But you can only do something like this if you check one of the damage hp, recover mp, etc. options, and if you do that, then the ability is a "HP damaging" attack that hits for 0, or whatever. Chu know?

And I've read and re-read Fomar's guide. It's actually kind of what got me back into messing around with Ace! It's amazing.

I have a theory that the values of "a" and "b" are actually shorthand user-friendly variables storing a much beefier piece of information - and it's that piece that I could check/modify with a script call - and how powerful would that be?! HahaHA! (First the maker, then the WORLD!) I bet it's something in BattlerBase or Battler? I've been scouring the script, but I can't seem to be able to find it.

Thanks for your response, Yato! 😀

Does anybody know what the real values of "a" and "b" are?
you can use Yanfly's antifail to hide the no damage message...


a = user


b = target


and it's defined on the eval call for the damage on make_damage_value...


and to keep things like the RMVXAce way, Hime's scripts also uses those variables
Sorry, I misread your post as you couldn't figure out how to make the skill do damage while adding the state.

Anti-fail, like Shana suggested, might work, and Tsukihime also has a script for adding effects via the comment box instead of the damage formula. I'll dig it up here and link it. I've never used it myself, but it should do the job.

Here you go: Forumla Effects by Tsukihime.

All you should need to do is add the following to the notetag of the skill:

Code:
<formula effect>a.add_state(id)</formula effect>
yeah, try one of Hime's new scripts that makes you run things using notes instead of the damage formula.
Ahhh! That script is awesome. Tsukihime > universe.

This has definitely given me a huge workaround. Shana! Yato! You guys rock. xD

I would still nevertheless love to figure out how to use a script call to fiddle about with states - and I would love even more to know how to refer (outside the formula box) to the user and target of a skill! I found def make_damage_value in Game_Battler.. There's a reference to it a bit further down, and there's a reference to it in Game_Action...

def make_damage_value(user, item)I guess this is the method that I need to be talking to when I want to get the user/target? Now I'm probably tragically mistaken, and more than likely appear foolish - but here have been my attempts so far.

$game_battler.make_damage_value.user.addstate(x); # This gives me a NoMethodError, saying that 'make_damage_value' is undefined.$game_battler.make_damage_value(user)addstate(x); # This gives me a SyntaxError, saying there's an unexpected tIDENTIFIER, expecting $end.Hrmmm... These are the two errors I run into with each of my attempts. Is there a mighty wizard out there who might know how to access those elusive "user" and "target" values?
there is no $game_battler... battlers are normally either Game_Enemy or Game_Actor


so either $game_actors[id] or $game_troop.members[id] or $data_enemies[id] something


Also it depends on how/where you're gonna use them


Also, you can't call make_damage_value like that... you're the one who will be telling it who user is, so you cannot call it to find out who user is...
Wow! Such a quick response. I really appreciate the help, Shana. 😀

Okay, so I've been trying some of the things you suggested, and I've gotten one so far to work.

$game_actors[id].add_state(id);The errors were sneaky!

$game_actor[id].add_state(id); # No 's' on actor causes an error.$game_actor[id].addstate(id); # As does no underscore in addstate.Messing with enemies/troops is proving to be a lot more difficult.

This is awesome! Yet I quest on!

I guess the question still stands by the by - if anyone might know how to refer to the "a" and "b" of the custom formula box? I suppose if they're just arguments taken by the method "make_damage_value" then the only way I might access the information is to somehow get them with another method... I just feel like the values must be accessible if the custom formula box can mess with them in such shorthand!
it is $game_actors... yeah enemies are referenced based on their troop placement...

a and b are defined by the damage eval method for the BaseItem class... you're free to define them on your own, but it's all up to you... check Hime's skill related scripts learn how she manages to use a and b as variables for her tags. but as I told you, defining them on your own depends on WHERE you will be trying to define them 🙂

sample: If I just wanna extend make_damage_value, then I can do this:

Code:
alias mdv_try make_damage_valuedef make_damage_value(user,item)  mdv_try(user,item)  a = user  b = self  #do your other things hereend

Original thread: https://forums.rpgmakerweb.com/threads/script-call-to-add-state-on-skill-user.24242/