Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Kingly Kounters
#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 }


Messages In This Thread
Kingly Kounters - by DerVVulfman - 04-06-2022, 10:07 PM
RE: Kingly Kounters - by kingray100 - 04-12-2022, 05:54 PM
RE: Kingly Kounters - by DerVVulfman - 04-12-2022, 09:52 PM
RE: Kingly Kounters - by kingray100 - 04-15-2022, 07:23 AM
RE: Kingly Kounters - by kingray100 - 06-01-2022, 07:09 PM
RE: Kingly Kounters - by DerVVulfman - 06-02-2022, 01:47 AM
RE: Kingly Kounters - by DerVVulfman - 06-14-2022, 02:51 AM
RE: Kingly Kounters - by kingray100 - 06-02-2022, 06:33 PM
RE: Kingly Kounters - by DerVVulfman - 06-03-2022, 02:12 AM
RE: Kingly Kounters - by kingray100 - 06-19-2022, 07:02 AM
RE: Kingly Kounters - by DerVVulfman - 06-19-2022, 01:26 PM
RE: Kingly Kounters - by kingray100 - 06-19-2022, 11:59 PM
RE: Kingly Kounters - by DerVVulfman - 06-20-2022, 01:17 AM
RE: Kingly Kounters - by kingray100 - 06-20-2022, 08:25 PM
RE: Kingly Kounters - by DerVVulfman - 06-20-2022, 09:19 PM
RE: Kingly Kounters - by kingray100 - 06-20-2022, 11:12 PM
RE: Kingly Kounters - by DerVVulfman - 06-21-2022, 02:11 AM
RE: Kingly Kounters - by DerVVulfman - 06-22-2022, 02:09 AM
RE: Kingly Kounters - by kingray100 - 06-21-2022, 05:22 AM
RE: Kingly Kounters - by DerVVulfman - 06-21-2022, 05:29 AM
RE: Kingly Kounters - by kyonides - 06-21-2022, 06:11 AM
RE: Kingly Kounters - by kingray100 - 06-21-2022, 03:50 PM
RE: Kingly Kounters - by kingray100 - 06-22-2022, 06:57 AM
RE: Kingly Kounters - by DerVVulfman - 06-22-2022, 07:33 PM
RE: Kingly Kounters - by kingray100 - 06-23-2022, 06:54 AM
RE: Kingly Kounters - by kyonides - 06-23-2022, 10:04 AM
RE: Kingly Kounters - by DerVVulfman - 06-23-2022, 03:20 PM
RE: Kingly Kounters - by kingray100 - 06-23-2022, 06:20 PM
RE: Kingly Kounters - by DerVVulfman - 06-23-2022, 08:53 PM
RE: Kingly Kounters - by kingray100 - 06-24-2022, 07:05 AM
RE: Kingly Kounters - by DerVVulfman - 06-25-2022, 02:08 AM



Users browsing this thread: