[Resolved] How to check if you've just attacked something

Started by Shek, November 27, 2013, 02:11:49 am

Previous topic - Next topic

Shek

Thanks so much KK for resolving this issue:

What this does:
Checks to see if you've hit an enemy with X character using a regular attack -> Performs an action (e.g. Call common event, change variable etc)

and

Checks to see if you've hit an enemy with X character using Y skill -> Performs an action (e.g. Call common event, change variable etc)


Original Post:

I'd like to set up a rage building system, I can't seem to figure out how to check with Blizz Abs if you've just attacked an enemy.  

What I am looking for:
Within a parallel common event:
Script/command to check if you've just attacked an enemy THEN IF TRUE -> perform a common event/or change a variable/switch
(Not any specific enemy, I just want you to build rage as you hit enemies, then you can expend rage to use special attacks)

But I have no idea how to check if you're hitting an enemy or not, it's gotta be simple; I'm just clueless.

KK20

This can apply to more than just BlizzABS:

class Game_Battler
 alias atk_ef attack_effect
 def attack_effect(attacker)
   result = atk_ef(attacker)
   if result && self.is_a?(Game_Enemy) && attacker.is_a?(Game_Actor)
     case attacker.id
     # DO WHAT YOU WANT HERE
     when 1 # Aluxes
       
     when 2 # Basil
       
       #etc....
     end
   end
   return result
 end
 
 alias skill_ef skill_effect
 def skill_effect(user, skill)
   result = skill_ef(user, skill)
   if result && self.is_a?(Game_Enemy) && user.is_a?(Game_Actor)
     case user.id
     # DO WHAT YOU WANT HERE
     when 1 # Aluxes
       
     when 2 # Basil
       
       #etc....
     end
   end
   return result
 end
end

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Shek

Splendid.  This is exactly what I was looking for!

Is there a quick way to make it so that the skills version also can differentiate between Skill.id?

+1

KK20

Directly below the when ID's, you do this:

      case user.id
      # DO WHAT YOU WANT HERE
      when 1 # Aluxes
        case skill.id
        when 1 # Heal
          # DO SOMETHING
        when 2 # Greater Heal
          # DO SOMETHING
        end
      when 2 # Basil
        case skill.id
        # You know what to do now...
        end
        #etc....
      end

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Shek

Thanks again sir! I will definitely put you in the credits of my game.  You have helped so much!

+1