Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Kingly Kounters
#11
The description of the error is 'varied'... based upon the size of your script.  By that, I mean the length of Kingly Kounters is 288 lines long for version 1.2 in its current form and line 210 is a comment.

IF... the value of 'countertarget' generated and added to all battlers (actor and enemy alike) within Game_Battler was set to a value of nil rather than an empty array  ( @countertargets = [] ), you would acquire a totally different message, stating that there was an undefined message of PUSH for nil:NilClass. 

So I will need to see 'your' complete version of the script as you have it to determine what your error is. This because your line 210 is not the same as that within the version 1.2 that I have.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png] [Image: liM4ikn.png] [Image: fdzKgZA.png] [Image: sj0H81z.png]
[Image: QL7oRau.png] [Image: uSqjY09.png] [Image: GAA3qE9.png] [Image: 2Hmnx1G.png] [Image: BwtNdKw.png%5B]
Above are clickable links

Reply }
#12
I'm not able to make the modifications to the script without not knowing what to do at all. I'm legit a caveman when it comes to this stuff. If I need to switch numbers or something, that'd be one thing. But adding lines here and there is confusing to me. So, I still have the default script. Is version 1.2 available to be copied completely in one go? Or is the original link still the first version?
Reply }
#13
It's version 1.2. When I did the prior bump, it was because it was replaced with 1.1. The top is current.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png] [Image: liM4ikn.png] [Image: fdzKgZA.png] [Image: sj0H81z.png]
[Image: QL7oRau.png] [Image: uSqjY09.png] [Image: GAA3qE9.png] [Image: 2Hmnx1G.png] [Image: BwtNdKw.png%5B]
Above are clickable links

Reply }
#14
Ok cool.

So I reapplied the script and now the same error occurs but on line 216.
Reply }
#15
Line 210 : NoMethodError occurred
Undefined method " " for nil:NilClass

Let's break this down....

for target in @target_battlers
  #
  # Ignore if dead
  next if target.dead?
  # Ignore if no countertargets
  next if target.countertargets == []
  #
  # Target now becomes active battler
  @active_battler = target
  # Acquire counterattack target
  target  = @active_battler.countertargets[0]
  # Erase countertarget array
  @active_battler.countertargets.clear
  # Set array of targeted battlers
  @target_battlers  = [target]

From what you described, 216 should be the line I highlighted.  Betcha didn't know we had the [ bgcolor ] bbcode, eh?

Now... the first part of this is that we have an array of @target_battlers to search through.  So it goes through each 'target' in the array... those targets being victimized battlers that were attacked.

The first test ( target.dead?) would cause a crash if we had no target victim battler itself.  So a nilClass for the target is a big nope.

Then the next test (target.countertarget == [] ) is to check if the victim target has an empty countertarget array... essentially checking if this victim was attacked BY an aggressive battler and is ready to attack it.  If the countertarget array is empty, then we skip to the next victim target in the whole @target_battler array... assuming there may be more than one.   Now, if there was no actual countertarget array to test... we would again have a crash.  But we don't. That means we have an array that exists. In fact, we wouldn't be able to even get that far and cut out on line 195 when trying to fill the array.  This I've confirmed, even whilst writing this just now.

The next thing we do after that is make the victim target the NEW Active battler.... so our former victim may now attack the guy who whapped him.  Simple thing there.


Then we get to... your line:    target  = @active_battler.countertargets[0]

We established that the victim and former 'target', now an active battler, did not have an empty countertarget array.  At least one battler must be in there.  And the system is choosing the first in the index (countertargets[0]).  So that should not be an issue.  And then we have the fact that we are taking the battler stuffed in the countertargets array and making it our hapless victim's new TARGET of attack.  So that too should not be an issue. The only time anything is pushed into this array IS in-fact line 195 that I previously mentioned would crash if no countertargets array is present.

I have now tried to BREAK the script and create the error.

Please post what you have in the upper config section from what should be line 61: module CounterAttack to line 84: end
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png] [Image: liM4ikn.png] [Image: fdzKgZA.png] [Image: sj0H81z.png]
[Image: QL7oRau.png] [Image: uSqjY09.png] [Image: GAA3qE9.png] [Image: 2Hmnx1G.png] [Image: BwtNdKw.png%5B]
Above are clickable links

Reply }
#16
Ok here is line 61-84:

module CounterAttack
# Creates the Actor Enemy Hash Arrays. Do not remove. ---------------------
ACTOR, ENEMY = {}, {} # Do not touch ---------------------------------------
# --------------------------------------------------------------------------

# Actor Counters
# ==============
# Define the actors perfoming counter attacks: the chance of a counter,
# the skill ID used (or 0 for melee), and optionally the SP cost.
#
# Chance Skill SPCost
#========== ====== ====== ======
ACTOR[2] = [ 0, 0] # Basil delivers melee 50%

# Enemy Counters
# ==============
# Define the enemies perfoming counter attacks: the chance of a counter,
# the skill ID used (or 0 for melee), and optionally the SP cost.
#
# Chance Skill SPCost
#========== ====== ====== ======
ENEMY[1] = [ 0, 7, true] # Ghosts use Fire 100%

end
Reply }
#17
Um... allow me to point out that ... no counter will work?  Now, I will also say that I ran into no error messages with this. But no counter will work at all.  Allow me to set the example text below in Courier New so you can see...

  # Actor Counters
  # ==============
  # Define the actors perfoming counter attacks:  the chance of a counter,
  # the skill ID used (or 0 for melee), and optionally the SP cost.
  #
  #            Chance  Skill  SPCost
  #==========  ======  ======  ======
  ACTOR[2]  = [  0,    0]                # Basil delivers melee 0%

  # Enemy Counters
  # ==============
  # Define the enemies perfoming counter attacks:  the chance of a counter,
  # the skill ID used (or 0 for melee), and optionally the SP cost.
  #
  #            Chance  Skill  SPCost
  #==========  ======  ======  ======
  ENEMY[1]  = [  0,    7,      true]    # Ghosts use Fire 0% (never)



This is your config, spaced out and lined up... and the first value in the array is 'chance of performing'.  In both your cases, you have NONE.

Now... here's the kick.



  def counterattack_phase4_step5
    #
    # Cycle through targets
    for target in @target_battlers
      #
      # Next if no damage
      next if target.damage.nil?
      #
      # Next if paralyzed - 'Can't Move'
      next if target.restriction == 4
      #
      # Skip if no HP loss (healing ignored)
      next unless (target.damage).to_i > 0
      # Skip if attack was a counter
      next if @counterattack == true
      #
      # Define chance
      chance = 0

      # Determine counterattack chance for enemy/actor
      if target.is_a?(Game_Enemy)
        if CounterAttack::ENEMY.has_key?(target.id)
          chance = CounterAttack::ENEMY[target.id][0]
        end
      else
        if CounterAttack::ACTOR.has_key?(target.id)
          chance = CounterAttack::ACTOR[target.id][0]
        end
      end
      #
      # Skip if there is no chance of counter
      next if chance == 0

      # Skip if counterattack failed
      next if chance < rand(100)
      # Push active battler into array
      target.countertargets.push(@active_battler)
      #
    end 
    #
  end


Um... this was the section I fixed prior when you had actors or enemies attempting to attack when not defined.  Now let me explain something.

The first yellow block assumes that the counter has 0 chance of being performed.
The second and third yellow blocks are the 'chance of counter' per your actor or enemy*
And the fourth yellow block says 'If still no chance... just go to the next guy'

So if there is 0 chance of success... you go and check the next guy and never reach the ORANGE block which sets up your actor to even do the counter attack.  And (*) Your actors are, from your own config, never going to have a counter attack as their chance value is set to 0.

Insofar as the method with the error you are receiving....

(06-20-2022, 09:19 PM)DerVVulfman Wrote: for target in @target_battlers
  #
  # Ignore if dead
  next if target.dead?
  # Ignore if no countertargets
  next if target.countertargets == []

This I only just posted to you, but I don't have to go any further with the script than here.

The last line, I replied that if you have no defined counterattacks, you skip the battler.

So if you have 0 chance of a counter, you never have the counter pushed into the countertargets array shown in the orange block.  And this section says if you have no countertargets, skip.

In essence, in no way should you be having this error as you have no way for a counterattack to even be registered.

There has got to be something else in play.  There is nothing in the script itself that would cause your issue.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png] [Image: liM4ikn.png] [Image: fdzKgZA.png] [Image: sj0H81z.png]
[Image: QL7oRau.png] [Image: uSqjY09.png] [Image: GAA3qE9.png] [Image: 2Hmnx1G.png] [Image: BwtNdKw.png%5B]
Above are clickable links

Reply }
#18
Ok well I'm not sure what to do. I changed the Actor to something that is not currently in the party at all (actor 16 instead of 2), to see if it had something to do with that particular party member. Still as the same message. It seems to occur right after the enemy makes their first move.
Reply }
#19
You have to be using some other script that interferes with it, something interfering with actions called by update_phase4_step5 or update_phase4_step6 within Scene_Battle. Those two scripts 'aliased' so as to attach the counterattack code in question... leaving the original battle code intact. That would be the only answer I can see.

For further analysis, make a fresh and new project and merely paste the script from the spoiler in the first page post as it is and fight two ghosts (Troop 1). That's the base system afterall.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png] [Image: liM4ikn.png] [Image: fdzKgZA.png] [Image: sj0H81z.png]
[Image: QL7oRau.png] [Image: uSqjY09.png] [Image: GAA3qE9.png] [Image: 2Hmnx1G.png] [Image: BwtNdKw.png%5B]
Above are clickable links

Reply }
#20
(06-21-2022, 05:29 AM)DerVVulfman Wrote: You have to be using some other script that interferes with it, something interfering with actions called by update_phase4_step5 or update_phase4_step6 within Scene_Battle.  Those two scripts 'aliased' so as to attach the counterattack code in question... leaving the original battle code intact.  That would be the only answer I can see.

For further analysis, make a fresh and new project and merely paste the script from the spoiler in the first page post as it is and fight two ghosts (Troop 1). That's the base system afterall.

I would also suggest that kingray100 might want to post a list of custom scripts he has added to his game project so far. If he has not done so already. Confused

EDIT

I created a brand new project and tested Wulfo's script and only added some settings to allow blockhead Alex counterattack the ghosts and it ran smoothly. So if you were using the default BS or something that doesn't alter it heavily, it should be working fine.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }




Users browsing this thread: