I'm having some difficulties with the parameters as they seem to be a bit weird, not exactly as shown in the script call sheet. When viewing the parameters you need to use parenthesis like so.
$gameMessage.add(String($gameActors.actor(1).param(2)))
However when I try to edit the value using parenthesis I get an error. So I tried to use the brackets as shown in the script call sheet, like so
$gameActors.actor(1).param[2] = 1
I no longer get an error but the value doesn't change either. How do I set the value of the parameter?
Is there a way to simply set a value rather than add/subtract?
No wonder $gameActors.actor(1).param(2) = 1; throws you an error.
$gameActors.actor(1).param(2) is a function. And functions are immutable, so they cannot be assigned a value. You can only call a function.
However, the number in params is equivalent to this:
0 - mhp
1 - mmp
2 - atk
3 - def
4 - mat
5 - mdf
6 - spd
7 - luk
So since now we know that param 2 is attack, which is a property and not a function, we can change it like this:
$gameActors.actor(1).atk = 1;
I'm not going to go in too many confusing details, this is object oriented programming and I'm not sure what's your skill in Javascript. I don't want to confuse you too much as well.
I'll be damned, I completely forgot that you can change only hp, mp and tp.
So, if we simplify it to an unified command, in order to set the param to value x, you need to subtract value - x:
$gameActors.actor(1).addParam(paramId, Math.abs ($gameActors.actor(1).param(paramId) - number) * -1)
Well, that doesn't look too beautiful xD
EDIT: No, that's not correct... Doesn't work for number greater than parameter... So it's equivalent to
$gameActors.actor(1).addParam (paramId, $gameActors.actor(1).param(paramId) - number)
Necro-post notice: Guanto
It is also hi-jacking. Please start your own thread.
Moderator note: Closing