- Joined
- Jun 23, 2014
- Messages
- 322
- Reaction score
- 177
- First Language
- English
- Primarily Uses
- RMMV
I'm trying to apply permanent statuses to both actors and enemies alike. Think like in Final Fantasy VI, where Interceptor was a permanent "status" applied to Shadow. These statuses should be applied to nearly all units, with a bit of randomness on the part of the enemies.
I can get the initial application down, but the trick is preventing the game from automatically removing them when hit with a cureall or something. I'm trying this:
alias
ld_clear_states :clear_states
def clear_states
if @states.nil?
old_clear_states
return
end
alignment = -1
if @states.include?(42)
alignment = 42
elsif @states.include?(43)
alignment = 43
elsif @states.include?(44)
alignment = 44
elsif @states.include?(45)
alignment = 45
elsif @states.include?(46)
alignment = 46
elsif @states.include?(47)
alignment = 47
elsif @states.include?(48)
alignment = 48
elsif @states.include?(49)
alignment = 49
end
old_clear_states
unless alignment == -1 then
self.add_state(alignment)
end
end
Works fine at first. I've tested against a "Recover All Heroes" event. And then I get into battle. Round 1: everything goes smoothly. Round 2: The game crashes upon the first move used. Excuse given? "SystemStackError occurred. stack level too deep"
I have no idea what would be causing this; the error makes me think "infinite loop", but what loop? I don't even know why this would be getting called on the second round of battle!
I know it must be that part of the code, because disabling it causes everything to work fine (except, of course, for curealls wiping the statuses.)
(BTW, I'm very well aware that the above code wouldn't work unless the statuses are mutually exclusive. That's deliberate. They are mutually exclusive.)
EDIT: I realize that I could just write my own custom cureall that would ignore those statuses every time - wouldn't even need to script for it - but dangit, sometimes you just want to be lazy and hit "Recover all: Entire Party".
I can get the initial application down, but the trick is preventing the game from automatically removing them when hit with a cureall or something. I'm trying this:
alias
def clear_states
if @states.nil?
old_clear_states
return
end
alignment = -1
if @states.include?(42)
alignment = 42
elsif @states.include?(43)
alignment = 43
elsif @states.include?(44)
alignment = 44
elsif @states.include?(45)
alignment = 45
elsif @states.include?(46)
alignment = 46
elsif @states.include?(47)
alignment = 47
elsif @states.include?(48)
alignment = 48
elsif @states.include?(49)
alignment = 49
end
old_clear_states
unless alignment == -1 then
self.add_state(alignment)
end
end
Works fine at first. I've tested against a "Recover All Heroes" event. And then I get into battle. Round 1: everything goes smoothly. Round 2: The game crashes upon the first move used. Excuse given? "SystemStackError occurred. stack level too deep"
I have no idea what would be causing this; the error makes me think "infinite loop", but what loop? I don't even know why this would be getting called on the second round of battle!
I know it must be that part of the code, because disabling it causes everything to work fine (except, of course, for curealls wiping the statuses.)
(BTW, I'm very well aware that the above code wouldn't work unless the statuses are mutually exclusive. That's deliberate. They are mutually exclusive.)
EDIT: I realize that I could just write my own custom cureall that would ignore those statuses every time - wouldn't even need to script for it - but dangit, sometimes you just want to be lazy and hit "Recover all: Entire Party".
Last edited by a moderator:

