Hime-Works / Requests

Bug reports and requests that may require longer discussions and is not suitable to leave on the blog
http://himeworks.com/
GNU General Public License v2.0
7 stars 9 forks source link

about "Feature Conditions" script #252

Closed formica5699 closed 9 years ago

formica5699 commented 9 years ago

Nice to meet you, I have a problem using your "Feature Conditions" script and It would be grateful if you helping me.

Basically, I want to get parameters down for certain actor (say "Eric") , depending on the number of actor in Scene_Battle. then I can say "Eric" get most vulnerable when leaved alone.

example here: example1

result: error1

I just can't understand why this happens. Could you fix this problem?

It works perfectly when setting the notebox like these: example2

example3

HimeWorks commented 9 years ago

The problem here is that features are accessed during initialization sequence, which means if you try to access the actor while it's being initialized, the game will be thrown into a recursive loop.

When you try to access a party's members, it will collect all of the actors, which requires the actors to be initialized, and therefore infinite loop

Since you are just checking for party size, add this script

class Game_Party
  def size
    @actors.size
  end
end

And then use this as the condition

$game_party.size
formica5699 commented 9 years ago

Thanks a lot. I learned a thing again.