Kingly Kounters
#1
Kingly Kounters
Version: 1.2


Introduction

Have you ever wanted your monsters to respond immediately to a brazen attack?  Do you feel that your quick and agile thief may wish to slice the brute who landed a blow?  Then feel free to use this script  to allow for devastating counter attacks. With this script,  you can define enemies and actors  that may respond to any successful strike.



Script
Here be the Script



Demo
Right here:  
.zip   Kingly Kounters.zip (Size: 921.72 KB / Downloads: 4)



Instructions

There's plenty of instructions in the script already



Compatibility

Designed for RPGMaker XP.  Compatible with AnimBat (script order within).



Terms of Use

Free for use, even in commercial games.  Only due credit is required. Mind you, due credit for kingray100 for the request is also a requisite.
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 }
#2
How do I implement the countering system to an enemy? I added the script, but I don't understand the instructions. Is there a variable I need to make? Or is there a button for countering or something? Lol
Reply }
#3
First... OOPS.  Minor correction in the config.  One list is for actors, the other for enemeis.  But I didn't change the 'text' to note the second is for enemies.  The values are correct... just the text describing them was borked.

As too defining the enemies that perform counter attacks, it's just that you add them to the list within the configuration section:  module CounterAttack.

Code:
  # Enemy 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
  #==========  ======  ======  ====== 
  ENEMY[1]  = [ 100,    7,      true]    # Ghosts use Fire 100%

This (now corrected) is the list that depicts the enemies that perform counter attacks.  Currently only one enemy is defined, an enemy with the ID of 1:  The Ghost.

Regarding [100, 7, true]...  let's go down the list shall we?

  • The ghost, if struck, will perform a counter attack 100% of the time.
  • The ghost, if delivering a counterattack, will use skill #7 (Fire).
  • And if using a skill counterattack, WILL use the ghost's SP because it's set to true.

If I wished to make another enemy like the IMP, I could define it thusly...

Code:
  #==========  ======  ======  ====== 
  ENEMY[7]  = [  50,   33]               # Imps use Venom 50% (no SP Loss)
Now THIS Imp has different characteristics, they are as follows:
  • The Imp, if struck, will perform a counter attack only 50% of the time
  • The Imp, if delivering a counter attack, will use skill #33 (Venom).
  • And if using a skill counterattack, the use of SP is not defined (true is optional)

And again, as the instructions imply... if the skill is set to 0, then the attack is a melee attack and not a skill.

Both actors and enemies can be configured this way. And once fonfigured... it's automatic. No on/off switch. The actual strike hitting the enemy (or actor) triggers the counterattack.
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 }
#4
Oh nice! I get it now! It works really nice! Thanks a million!
Reply }
#5
Ok so I discovered an issue.
So a couple things I noticed:

I was battling an enemy that counters 20% of the time with a basic attack. But I noticed that randomly my character 2 was auto attacking out of turn, even when he was paralyzed. That was weird.

But then the battle also crashed during testing with a message saying:

Line 221:No method error occured.
undefined method ' ' for nil:NilClass
Reply }
#6
Paralyzed!?  Ooh.  Status ailments to the rescue.  Yeah, that's something I had not considered.  So indeed, something will need to be done.

Insofar as your 'Character 2' attacking out of turn... Does he/she share a Database position index as an attacker?  By that, consider that the Sahagin is enemy #3 as well as Cyrus being actor #3.  I would have sworn this was not an issue at all, but if this is the case, let me know.

As to:
Line 221:No method error occured.
undefined method ' ' for nil:NilClass

... the system performs a few tests before a counter attack is performed.  And within in phase_4_step5, I have this bit of code

Code:
      # 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
      #

Initially, I thought it was adequate. But I figure one additional like would be worthwhile:

next if chance == 0

Place this before the line that reads
next if chance < rand(100)
And if no 'chance' for a combo attack still exists...  SKIP IT!

Currently, that is why I dub this script

BUMP
to version 1.1

Temporarily of course. I still need to consider the Restriction Level 4(Can't Move) for any Paralyze-styled status ailments.
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 }
#7
Oh wow I'm so sorry! The script has the actor 2 automatically having a 50% counterattack rate. For some reason, my mind wrote it off as a demonstration purpose type thing. I imagine that will fix the random counter attacking.
Also, I can't seem to find the line the " next if chance < rand(100)" is on, in order to insert the "next if chance == 0" before it.
Reply }
#8
Much Higher Up.... In the 180 lines within the counterattack_phase4_step5 method
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 }
#9
BUMP
to version 1.2

I stated that the previous version was temporary until I inserted a measure so a paralyzed person cannot respond with a counter attack.  And as of now, a simple line was added (and comments of course) to add that measure into the system.

The new line now exists on line 170, below the 'next if target.damage.nil?' statement within the counterattack_phase4_step5 method.  And it is a simple statement as you can see below:

next if target.restriction == 4

Nothing of the configuration system needed change, so one could just rip and replace the whole engine below the config section if you like.

Happy gaming.
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 }
#10
Ok so another error keeps popping up while I am in battle and crashing the game. It says this:

Line 210 : NoMethodError occurred
Undefined method " " for nil:NilClass
Reply }




Users browsing this thread: 6 Guest(s)