Set Guard/Attack Skills

Discussion in 'RGSS3 Scripts (RMVX Ace)' started by Vlue, Jul 22, 2012.

    Tags:
  1. Vlue

    Vlue Talent Extraordinaire Member

    Messages:
    589
    Likes Received:
    376
    Location:
    Canada
    First Language:
    English
    Set Guard/Attack Skills v1.0

    By V.M. of D.T.


    Introduction

    It's a script! Set different skills to be used when the guard or attack command are chosen for specific actors!

    Features

    - Set different skills to be used when the guard or attack command are chosen for specific actors!

    How to Use

    Place in, edit hashes as needed. Details in script.

    Script

    Convenient Pastebin: Here

    FAQ

    N/A

    Credit and Thanks

    - By V.M. of D.T.

    - Free to use in any project with credit given

    Author's Notes

    Banana banana banana.
     
    Last edited by a moderator: Aug 16, 2012
    #1
  2. CaeSera0

    CaeSera0 Villager Member

    Messages:
    5
    Likes Received:
    0
    First Language:
    English
    Either I'm just stupid or I'm just stupid, I have been starring at the script for a good 10mins and i still don't know what to edit.

    Please advise.
     
    #2
  3. kerbonklin

    kerbonklin Hiatus King Veteran

    Messages:
    1,728
    Likes Received:
    281
    First Language:
    English
    Primarily Uses:
    RMMV
    1. ACTOR_ATTACK_SKILL_ID = { 1 => 1,
    2.                           2 => 1,
    3.                           3 => 1,
    4.                         }
    Actor 1 uses Skill ID 1 when choosing Attack command. Change the skill ID to the skill of your choice.

    Actor 2 => Skill ID

    Actor 3 => Skill ID

    Feel free to add an extra 4 => "Skill ID," before the ending bracket on a next line if you need to add more actors.

    Same goes for 

    1. ACTOR_GUARD_SKILL_ID = { 1 => 2,
    2.                          2 => 2,
    3.                          3 => 2,
    4.                         }
     

    It's like the first thing in the script after the commented section. For future reference most scripts have their editable regions come first, immediately after the commented sections/instructions.
     
    Last edited by a moderator: Jun 14, 2013
    #3
    Vlue likes this.
  4. CaeSera0

    CaeSera0 Villager Member

    Messages:
    5
    Likes Received:
    0
    First Language:
    English
    ok got it to work now.

    now my next question is how do I change the name for each individual character, or is there another thread that has this answer?

    Thanks again
     
    Last edited by a moderator: Jun 17, 2013
    #4
  5. kerbonklin

    kerbonklin Hiatus King Veteran

    Messages:
    1,728
    Likes Received:
    281
    First Language:
    English
    Primarily Uses:
    RMMV
    ...You just do that through the Actor tab of the database?

    Or there's an event to change Actor Name whenever you want. (for mid-game purposes or something)
     
    Last edited by a moderator: Jun 17, 2013
    #5
  6. CaeSera0

    CaeSera0 Villager Member

    Messages:
    5
    Likes Received:
    0
    First Language:
    English
    sorry I meant for the skills themselves
    So instead of attack it would be Air Blade
     
    #6
  7. TheObermotz1

    TheObermotz1 Veteran Veteran

    Messages:
    34
    Likes Received:
    17
    First Language:
    German
    This is quite an old thread, but I'll try my luck.

    Your script states, that you can change the default attack for not just an actor, but weapons/armor as well. Could you give a brief explanation as to how I could do that, that would be nice. A certain weapon having it's own default attack would solve most of my problems I'm having with my battle system.
    I can't understand this code and trailing and erroring didn't get me very far.

    Thanks!
     
    #7
  8. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,977
    Likes Received:
    10,677
    First Language:
    English
    Primarily Uses:
    RMVXA
    I'm actually using an older version, but how I read the updated script it would be like this:

    First decide what attack you want to give it. For the sake of this example, we will say that you create a new skill in slot 73 (for example, it might add Fire to the attack)
    Make sure you have the damage formula you want as well plus any features you want, TP/MP cost etc. etc.

    Now go to your weapon tab and select the sword that you want to have this attack.
    In the note box type
    <Attack_Id 73>

    If you want another weapon to have a different attack, create a new one - let's assume it's the next slot down, i.e. slot 74.
    In the new weapon's note box you type
    <Attack_Id 74>
     
    #8
    TheObermotz1 likes this.
  9. TheObermotz1

    TheObermotz1 Veteran Veteran

    Messages:
    34
    Likes Received:
    17
    First Language:
    German
    There we go, now we got it! I was using the new script as well, but also the old instructions.

    Thanks a bunch, probably wouldn't have figured it out without you!
     
    #9
  10. Shoal

    Shoal Warper Member

    Messages:
    3
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    Hello, regarding this script, is it reasonably possible to also have it check the note text of skills? I'd like to be able to change the guard command on level up, preferably more than once.

    Sorry for the necro, thanks in advance
     
    Last edited: Oct 27, 2019
    #10
  11. mlogan

    mlogan Global Moderators Global Mod

    Messages:
    13,848
    Likes Received:
    7,666
    Location:
    Texas
    First Language:
    English
    Primarily Uses:
    RMMV
    @Shoal Necroposting in threads for things like scripts, which may need ongoing support, is okay. Just be aware Vlue has not been online here in 2 years and is unlikely to see your request. I recommend you post in Script Requests to see if perhaps someone could help add this function for you, if Vlue's terms of use allow modification.
     
    #11
    Engr. Adiktuzmiko likes this.
  12. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,967
    Location:
    Philippines
    First Language:
    Tagalog
    @Shoal I think you could actually event it, if you're fine with that anyway. Like make a guard skill specific for that actor which will serve as the "initiator". Then set it to be that actor's guard skill then make the skill run a common event which then utilizes the "Force Action" command to make the actor use the actual guard skill that corresponds to his level.

    Or if the only difference between the various guard skills is the guard state that they add, just add the correct state using the damage formula since you can use RGSS code in the damage formula, or add the state using a common event.
     
    #12
  13. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,741
    Likes Received:
    381
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    try this. Changes the guard skill at the level you specify.
    Code:
    #Set Guard/Attack Skills v1.3
    #----------#
    #Features: Let's you set different attack/guard actions for individual actors
    #
    #Usage:    Placed in note tags of actors, weapons, armors, classes:
    #          <Attack_Id skill_id level> - changes default attack if level matches
    #          <Guard_Id skill_id level>  - changes default guard if level matchs
    #
    #           e.g. <guard_id 44 15>
    #           guard skill is quick move at level 15
    #        Must be in order. You cannot put a lower level below the higher level
    #
    #          Weapons/Armors overrides Classes overides Actors.
    #       
    # addon by Roninator2
    #----------#
    #-- Script by: V.M of D.T
    class Game_Actor
      def guard_skill_id
        @equips.each do |item|
          next unless item.object
          return $1.to_i if item.object.note.upcase =~ /<GUARD_ID (\d+)>/
        end
        return $1.to_i if self.class.note.upcase =~ /<GUARD_ID (\d+)>/
        idg = actor.note.upcase =~ /<GUARD_ID (\d+)>/ ? $1.to_i : 2
        actor.note.upcase.each_line { |line|
          if line =~ /<GUARD_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
            if @level >= $2.to_i
              idg = $1.to_i
            end
          end
         }
        return idg
      end
      def attack_skill_id
        @equips.each do |item|
          next unless item.object
          return $1.to_i if item.object.note.upcase =~ /<ATTACK_ID (\d+)>/
        end
        return $1.to_i if self.class.note.upcase =~ /<ATTACK_ID (\d+)>/
        ida = actor.note.upcase =~ /<ATTACK_ID (\d+)>/ ? $1.to_i : 1
        actor.note.upcase.each_line { |line|
          if line =~ /<ATTACK_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
            if @level >= $2.to_i
              ida = $1.to_i
            end
          end
         }
        return ida
      end
    end
    
     
    Last edited: Oct 28, 2019
    #13
  14. Shoal

    Shoal Warper Member

    Messages:
    3
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    @Roninator2 Thank you!!! It's better than i was anticipating. ♥

    At some point i'm sure i will run into something that forces me to learn how to do more and different kinds of events but for now it's smooth sailing =3

    Edit:
    It seems the level defining part is breaking? I did some quick tests and the guard effect runs fine if i remove the level so that it's just guard id as originally.

    Would using yanfly's class system mess with this thing in particular?
     
    Last edited: Oct 30, 2019
    #14
  15. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,741
    Likes Received:
    381
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    I don't know, but the script is designed to have equipment notes overwrite -> class notes overwrite -> actors notes
    Do you have any of these attack or guard notes in your equipment or class?

    Also what I made only works for actors.
     
    #15
  16. Shoal

    Shoal Warper Member

    Messages:
    3
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    For the test, i was using it exclusively in the class. there are no other places where attack or guard notes exist yet, so the chance of conflict shouldn't exist and i tested it using the player character.

    I appreciate your help with this! at some point i'll do a better test with my other scripts disabled but time is not too plentiful for me atm. ^^'
     
    #16
  17. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,741
    Likes Received:
    381
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    So just like what I was saying, the add on I made is for actors only, not classes or equipment.
    If you specify using this script in a class then you do not need my add on.
    but I can try and rework it for classes.

    Try this
    Code:
    #Set Guard/Attack Skills v1.3.2
    #----------#
    #Features: Let's you set different attack/guard actions for individual actors
    #
    #Usage:    Placed in note tags of actors, weapons, armors, classes:
    #          <Attack_Id skill_id level> - changes default attack if level matches
    #          <Guard_Id skill_id level>  - changes default guard if level matchs
    #
    #           e.g. <guard_id 44 15>
    #           guard skill is quick move at level 15
    #
    #          Weapons/Armors overrides Classes overides Actors.
    #          Levels must be in a low to high order
    #           e.g. <guard_id 44 10>
    #           e.g. <guard_id 49 15>
    #         
    # addon by Roninator2
    #----------#
    #-- Script by: V.M of D.T
    class Game_Actor
      def guard_skill_id
        @equips.each do |item|
          next unless item.object
        iidg = item.object.note.upcase =~ /<GUARD_ID (\d+)>/i ? $1.to_i : 2
        item.object.note.upcase.each_line { |line|
          if line =~ /<GUARD_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
            if @level >= $2.to_i
              iidg = $1.to_i
            end
          end
         }
        return iidg if item.object.note.upcase =~ /<GUARD_ID (\d+)>/i
        return iidg if item.object.note.upcase =~ /<GUARD_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
        end
     
        cidg = self.class.note.upcase =~ /<GUARD_ID (\d+)>/ ? $1.to_i : 2
        self.class.note.upcase.each_line { |line|
          if line =~ /<GUARD_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
            if @level >= $2.to_i
              cidg = $1.to_i
            end
          end
         }
        return cidg if self.class.note.upcase =~ /<GUARD_ID (\d+)>/i
        return cidg if self.class.note.upcase =~ /<GUARD_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
        
        idg = actor.note.upcase =~ /<GUARD_ID (\d+)>/i ? $1.to_i : 2
        actor.note.upcase.each_line { |line|
          if line =~ /<GUARD_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
            if @level >= $2.to_i
              idg = $1.to_i
            end
          end
         }
        return idg
      end
     
      def attack_skill_id
        @equips.each do |item|
          next unless item.object
          iida = item.object.note.upcase =~ /<ATTACK_ID (\d+)>/i ? $1.to_i : 1
          item.object.note.upcase.each_line { |line|
            if line =~ /<ATTACK_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
              if @level >= $2.to_i
                iida = $1.to_i
              end
            end
           }
          return iida if item.object.note.upcase =~ /<ATTACK_ID (\d+)>/i
          return iida if item.object.note.upcase =~ /<ATTACK_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
        end
        
        cida = self.class.note.upcase =~ /<ATTACK_ID (\d+)>/i ? $1.to_i : 1
        self.class.note.upcase.each_line { |line|
          if line =~ /<ATTACK_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
            if @level >= $2.to_i
              cida = $1.to_i
            end
          end
         }
        return cida if self.class.note.upcase =~ /<ATTACK_ID (\d+)>/i
        return cida if self.class.note.upcase =~ /<ATTACK_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
        
        ida = actor.note.upcase =~ /<ATTACK_ID (\d+)>/i ? $1.to_i : 1
        actor.note.upcase.each_line { |line|
          if line =~ /<ATTACK_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
            if @level >= $2.to_i
              ida = $1.to_i
            end
          end
         }
        return ida
      end
    end
    
     
    Last edited: Nov 1, 2019
    #17

Share This Page