yami's PCTB battle system error

Status
Not open for further replies.

hian

Biggest Boss
Veteran
Joined
Feb 26, 2013
Messages
603
Reaction score
459
First Language
Norwegian
Primarily Uses
Yami's predicted charge turn battle system crashes whenever a character counter-attacks.

The relevant script can be found here:

http://yamiworld.wordpress.com/rgss3/battle-scripts/yeas-add-on/pctb/

After googling it for a while, it seems many people have had this error, and that it's due to a faulty line dealing with forced actions I.E forced actions in general crash the game using the script.

Yami has discontinued his support for this script though, so I was wondering if someone could help me provide a fix?

I would be very grateful!
 

Archeia

Level 99 Demi-fiend
Developer
Joined
Mar 1, 2012
Messages
15,141
Reaction score
15,473
First Language
Filipino
Primarily Uses
RMMZ
Fix Force Actions

or this one

class Game_Battler < Game_BattlerBase def force_action(skill_id, target_index) action = Game_Action.new(self, true) action.set_skill(skill_id) if target_index == -2 action.target_index = last_target_index elsif target_index == -1 action.decide_random_target else action.target_index = target_index end @actions = [action] + @actions @pctb_forced = true endend
or try this one too.

module BattleManager #-------------------------------------------------------------------------- # * Force Action #-------------------------------------------------------------------------- def self.force_action(battler) @action_forced ||= [] @action_forced.push(battler) end #-------------------------------------------------------------------------- # * Get Next Action Subject #-------------------------------------------------------------------------- def self.next_subject loop do if @action_forced && !@action_forced.empty? battler = @action_forced.shift @action_forced = nil if @action_forced.empty? return battler end battler = @action_battlers.shift return nil unless battler next unless battler.index && battler.alive? unless battler.movable? battler.on_action_end next end return battler end endend
Try any of those 3 <_<;
 
Last edited by a moderator:

hian

Biggest Boss
Veteran
Joined
Feb 26, 2013
Messages
603
Reaction score
459
First Language
Norwegian
Primarily Uses
I am using the most recent Yanfly battle engine script, so the first fix is definitely not it.

As for the next two, where exactly am I supposed to put them?

Should they be put by themselves in a dedicated slot, or should I replace a command line

in another script? If so, where?

EDIT:

I figures out where to put the fix behind your second spoiler line, but haven't gotten around to testing it yet.

Some additional information -

This issue seems to specifically have to do with counter attacks, as the error

does not happen when I use force command event command in battles.

I tried to set up a battle in the database, and used the force command event command,

and made my actor attack at the beginning of the fight, and this had no issues what so ever.

It seems specifically to have to do with line 815.

#--------------------------------------------------------------------------
  # alias method: execute_action
  #--------------------------------------------------------------------------
  alias scene_battle_execute_action_pctb execute_action
  def execute_action
    scene_battle_execute_action_pctb
    unless BattleManager.action_forced?
      @subject.last_obj = @subject.current_action.item unless @subject.last_obj
    end
  end
815 is:

 @subject.last_obj = @subject.current_action.item unless @subject.last_obj
EDIT:

Okay, tested it now.

I put the fix the "Battle Manager" section, and it seems to have done the trick.

I'm just worried because I've heard a lot of people here say that you shouldn't tamper to much with the main modules, but I'm guessing it's okay in this instance?

In any case, it would seem that this battle engine is a bit unstable, and for that reason, I'd like to ask the mods not to close this yet, as it's very possible I'll be getting into more trouble in a moment or two.

In any case, I'm extreeeemely happy for your assistance!

Thanks a lot, man!

If this turns out to have been the solution to stabilize my battle engine, I just might have to put your name in the credits!
 
Last edited by a moderator:

Caxlb

Villager
Member
Joined
Jan 27, 2014
Messages
6
Reaction score
0
First Language
English
Primarily Uses
RMMV
I am having the same problem, but don't fully understand what you did to resolve it. Did you just copy the battlemanager module from the spoiler bar into rpg maker's core battle manager? If so, does it matter where in the battlemodule it is placed?
 

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
I, too, am having this issue, and was unable to find a resolution anywhere else in the forums or through search engines. Counterattacking and forced actions seem to work just fine, but when an enemy is killed with a counterattack, I get the following error and game crash:

Script 'Yami's PCTB System' line 816: NoMethodError occurred. Undefined method 'item' for nil:NilClass.

I tried pasting the Module BattleManager script that was linked above in various places, since Hian seems to have gotten that to work, but none of them have fixed the issue, and he did not indicate where he put it to successfully solve the problem.
 

demicrusaius

Warper
Member
Joined
Jul 7, 2014
Messages
4
Reaction score
0
First Language
English
Primarily Uses
Arg! All of the things! I didn't even know this was an issue until I discovered this forum, and yes, I am having the same problems as everyone else. All forced actions work fine, except enemies that are killed by counterattack. Tried all three fixes in various places and even overwritting the main module. I'm pretty close to abandoning this battle system altogether.
 

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
try replacing

@subject.last_obj = @subject.current_action.item unless @subject.last_objwith

Code:
@subject.last_obj = @subject.current_action.item unless @subject.last_obj || @subject.hidden? || @subject.confusion? || !@subject.movable?
 

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
Just tried it out in the battle test and it seems to work just fine, Xypher - thank you very much for your fix.
 

Lord Halo

Villager
Member
Joined
Mar 21, 2014
Messages
8
Reaction score
2
First Language
English
Primarily Uses
try replacing

@subject.last_obj = @subject.current_action.item unless @subject.last_objwith

@subject.last_obj = @subject.current_action.item unless @subject.last_obj || @subject.hidden? || @subject.confusion? || !@subject.movable?
Holy Crap! that's it! that is what i needed thanks!!!
 

Gawreluck

Warper
Member
Joined
May 11, 2015
Messages
1
Reaction score
0
First Language
English
Primarily Uses
im haveing a same type of error....when i start my battle test it stops and says "Script 'BattleManager' line192 no method error occurred undefind method empty for #<array0x93c8b0c> im not shure what to fix...i need help
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,367
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
Gawreluck, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

Please start a new topic, as most probably your error is something different from what was discussed here.

Have you saved the project? have you tested ingame instead of using the editors battletest? Remember to start a new game after new scripts have been added.

Locking this, as it's old and probably solved
 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,083
Members
137,583
Latest member
write2dgray
Top