Is it possible to modify a game variable from within the formula box? I've tried "\V[n] = " and "$gameVariable[n] = ", but neither works. Thanks!
Edit: The damage formula box, that is. I want to make skills that will modify game variables.
If you can't find a solution this way, you could always have it call a common event and change the variable through there.
Thanks, but the reason I want to use the damage formula box is that I want to modify variables based on the parameters of the character who uses a particular skill. AFAIK there isn't a way for a common event to "know" which player activated the skill that called it. I do appreciate the suggestion though!
I am facing the same puzzle!!!
I suggest that next version of MV can add more properties of a ad b to let us pass"tell" the value to a common event.
a.name
a.id
However, since a.gainHp(x) can work, I am thinking that there should be more "functions" that can be called like a.gainHp.
Where can we find the list?
$gameVariables.setValue(variableId, value);
To my knowledge, nothing in the script call list can let the common event "know" which player or enemy performed the skill.
Actually, "$gameVariables.setValue(variableId, value);" equals to V[x] = value;
The problem is that we can not set value to that except for "a.atk, b.mhp ...etc. "
So, i took a moment to find the place where those formulas are evaluated:
Game_Action.prototype.evalDamageFormula = function(target) { try { var item = this.item(); var a = this.subject(); var b = target; var v = $gameVariables._data; var sign = ([3, 4].contains(item.damage.type) ? -1 : 1); return Math.max(eval(item.damage.formula), 0) * sign; } catch (e) { return 0; }};So, you have:item: The item/skill used.
a: The actor using that item/skill.
b: The target of that item/skill.
v: The internal array of $gameVariables (forgot about that).
sign: Not sure, probably deciding if the item/skill heals or does damage.
You should still be able to call other game objects, like $gameTemp or $gameSystem.
/edit: If you want to store some information for a common event, you could abuse variables for this (the maker only lets you put numbers in there, but in a script you are free to do otherwise).
@ksjp17
when I was making a reply, and after having it completed, Iavra was posting.
it resulted from timing,
not because I purposely broke the rule.
ksjp17 can deleted all my posts. I don't mind.
but I must state clearly that I never do double posting on purpose!