Hello, fellow RPG makers,
I've encountered a serious problem.
I wanted to create an item that based on which class equips it, gives different stats.
I achieved it with this code, using state 4 as a passive state.
<Custom Parameters>
if (user.isStateAffected (4) == true) {
atk = Math.floor($gameActors.actor(user.actorId()).param(3) * 25 / 100)
} else {
atk = 1000
}
</Custom Parameters>
There's nothing wrong with the syntax of the code I believe. However, the $gameActors.actor(user.actorId()).param(3) part is pretty hostile towards me. When I try to equip the item, it freezes the game and after a while the console tells me that maximum stacks have been reached, in other words the RAM is full.
As a result of that the game stops caring about the item effect anymore.
Interestingly enough, if I replace that part with a static number, everything works with no problems.
EDIT: I tried to simplify the code with user.param(3) * 25 / 100, but it achieves the exact same results 🙁
Ok, nevermind, I figured out the problem and the solution.
Solution first. I designated some variables to carry the values of heroes' attributes and made the item point to them. Now the problem...
Since the item overwrote the atk value by a portion of the attack value, it was an infinite recursion. So that means I have to do it through the variables to make the parameter a static number, not a recursion.
However, I will still have to do it differently to prevent the attack growing every moment...
I've encountered a serious problem.
I wanted to create an item that based on which class equips it, gives different stats.
I achieved it with this code, using state 4 as a passive state.
<Custom Parameters>
if (user.isStateAffected (4) == true) {
atk = Math.floor($gameActors.actor(user.actorId()).param(3) * 25 / 100)
} else {
atk = 1000
}
</Custom Parameters>
There's nothing wrong with the syntax of the code I believe. However, the $gameActors.actor(user.actorId()).param(3) part is pretty hostile towards me. When I try to equip the item, it freezes the game and after a while the console tells me that maximum stacks have been reached, in other words the RAM is full.
As a result of that the game stops caring about the item effect anymore.
Interestingly enough, if I replace that part with a static number, everything works with no problems.
EDIT: I tried to simplify the code with user.param(3) * 25 / 100, but it achieves the exact same results 🙁
Ok, nevermind, I figured out the problem and the solution.
Solution first. I designated some variables to carry the values of heroes' attributes and made the item point to them. Now the problem...
Since the item overwrote the atk value by a portion of the attack value, it was an infinite recursion. So that means I have to do it through the variables to make the parameter a static number, not a recursion.
However, I will still have to do it differently to prevent the attack growing every moment...