Hello everyone!
I'm currently working on a passive berserk skill, like I described it
here, but to summarize it again: The skill is learned at a certain level and adds a state with the same name, which increases the ATK of the character by 1 % for every 2% HP under their MaxHP. If the character for example has only 1% HP left, the state multiplies the ATK-Value by 150%. So far, so good. Through the other thread I managed to get help on the basic "how to accomplish my goal" topic and luckily it's rather simple.
I'm using a combination of Yanflys "Lunatic States" and Victors "Passive States" scripts. The problem with this combination however is, that they are only partwise compatible. The issues I encountered were mainly with the applying and erasing of the states.
Here are the notetags used in the berserk-skill:
<passive state: 39>SceneManager.scene_is?(Scene_Battle);</passive state>Now for the berserk-state:
<apply effect: berserk_apply><erase effect: berserk_erase><shock effect: berserk_schock>And the code used in "Lunatic States" (only the part, which should be edited):
when /BERSERK_APPLY/i $game_variables[11] = 0 $game_variables[12] = user.mhp $game_variables[10] = user.atk $game_variables[11] = berserk_buff(user) user.add_param(2, $game_variables[11]) when /BERSERK_SCHOCK/i x = berserk_buff(user) user.add_param(2, x) $game_variables[11] += x if x < 0 when /BERSERK_ERASE/i user.add_param(2, -$game_variables[11]) $game_variables[12] = 0 $game_variables[10] = 0 $game_variables[11] = 0And at last the "berserk_buff(user)"-function i added at the bottom of Game_BattlerBase (note that it's the same class that contains the editable part of yanflys script):
def berserk_buff (user) x = $game_variables[10]*((1-(user.hp / $game_variables[12]))/2) x -= $game_variables[11] if $game_variables[11] > x x endAt first the problem seemed to be, that the state got applied correctly (I used a multiplication by 10 to see the increased ATK-Value in multiple battles, also the states icon was visible), but that was before I added the "apply" tag to the state. The problem with this first test was, that the "erase"-script wasn't called at the end of the battle (ATK remained at 999, even after I called user.add_param(2, -999) in the erase-script). After moving Yanflys script above Victors in the script editor however, I solved this problem. Then I proceeded to add the "apply"-tag to the state and implemented it, so that variables got initialised and the ATK-increase was calculated correctly. After doing so I tested, if the "apply"-script worked. It didn't. After bugfixing I noticed, that it didn't even get called (I added x = hdihedihuwdn.get_U(), at which point I expected an error-message, but it didn't appear at the start of the battle). After moving Yanflys script under Victors it didn't work either.
So my question to you is, do you know a way to fix this problem by editing either Yanflys or Victors script? I tried to find the incompatibility, but I'm a ruby beginner and couldn't find anything...
Any help would be greatly appreciated!
Note: I'm also using some other scripts, but since they have nothing to do with the apllying of states, I don't think the problem lies there. But here they are:
Galv's Cover (Substitute) Functionality,
Yanfly Engine Ace - Hide Menu Skills v1.01 .
Also since the problem lies between these two scripts, I didn't see the necessity of making a demo game. But if it helps you, just say so and I will make one!
EDIT: Of course I'm also using Victors "Basic Module". I inserted Yanflys script between this and the "Passive States" script