Trying to apply permanent statuses

Status
Not open for further replies.

HeroicJay

Veteran
Veteran
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 :old_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".
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,667
First Language
German
Primarily Uses
RMMV
Round 2: The game crashes upon the first move used. Excuse given? "SystemStackError occurred. stack level too deep"
In 99% of all cases, that error happens if a script is copied into the script manager twice - the rare other option is that you've created an iteration where the script calls itself.
I suggest checking the unnamed slots in your script editor to see if you've placed it somewhere else and forgot to name the slot, then placed it twice because you didn't see its name in the list.


If that is not the case, then check your script - especially why do you call the "old_clear_states" twice?
 

HeroicJay

Veteran
Veteran
Joined
Jun 23, 2014
Messages
322
Reaction score
177
First Language
English
Primarily Uses
RMMV
In 99% of all cases, that error happens if a script is copied into the script manager twice - the rare other option is that you've created an iteration where the script calls itself.

I suggest checking the unnamed slots in your script editor to see if you've placed it somewhere else and forgot to name the slot, then placed it twice because you didn't see its name in the list.

If that is not the case, then check your script - especially why do you call the "old_clear_states" twice?
Twice? I mean, yes, it's in the code twice, but it should never call old_clear_states twice in a single run of the method. The first one has a "return" immediately after it, after all. I could rework the code to remove that, but I must profess my doubts on that fixing it.

This project is relatively clean, and this wasn't copy/pasted or anything until I created this topic, so it's very unlikely this exists elsewhere. I'll check anyway...

EDIT: Removing one instance of old_clear_states did a whopping nothing, so that wasn't it.
 
Last edited by a moderator:

HeroicJay

Veteran
Veteran
Joined
Jun 23, 2014
Messages
322
Reaction score
177
First Language
English
Primarily Uses
RMMV
I have a lead: turns out Battler has its own version of clear_states. It does call BattleBase's (which I'm overriding) but then calls @result.clear_status_effects. That could be causing the error. Come to think of it, in my test battle, I'm doing the same actions every time, and round 2 should be killing the monster, which would wipe status effects...

EDIT: Yup. All I had to do was apply an @HP == 0 check.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
HeroicJay, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


That doesn't sound quite right, but as long as you've got it working the way you want it, who am I to argue? ;)


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,847
Messages
1,016,972
Members
137,561
Latest member
JaCrispy85
Top