Set Guard/Attack Skills

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
377
First Language
English
Primarily Uses
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:

CaeSera0

Villager
Member
Joined
Jun 5, 2013
Messages
5
Reaction score
0
First Language
English
Primarily Uses
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.
 

kerbonklin

Hiatus King
Veteran
Joined
Jan 6, 2013
Messages
1,728
Reaction score
281
First Language
English
Primarily Uses
RMMV
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.
  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:

CaeSera0

Villager
Member
Joined
Jun 5, 2013
Messages
5
Reaction score
0
First Language
English
Primarily Uses
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:

kerbonklin

Hiatus King
Veteran
Joined
Jan 6, 2013
Messages
1,728
Reaction score
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:

CaeSera0

Villager
Member
Joined
Jun 5, 2013
Messages
5
Reaction score
0
First Language
English
Primarily Uses
sorry I meant for the skills themselves
So instead of attack it would be Air Blade
 

TheObermotz1

Veteran
Veteran
Joined
Mar 5, 2014
Messages
34
Reaction score
17
First Language
German
Primarily Uses
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!
 

Kes

Global Moderators
Global Mod
Joined
Aug 3, 2012
Messages
21,442
Reaction score
10,856
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>
 

TheObermotz1

Veteran
Veteran
Joined
Mar 5, 2014
Messages
34
Reaction score
17
First Language
German
Primarily Uses
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!
 

Shoal

Warper
Member
Joined
Oct 27, 2019
Messages
3
Reaction score
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:

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
14,065
Reaction score
7,756
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.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,642
Reaction score
2,972
First Language
Tagalog
Primarily Uses
@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.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
1,853
Reaction score
408
First Language
English
Primarily Uses
RMVXA
change the guard command on level up
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:

Shoal

Warper
Member
Joined
Oct 27, 2019
Messages
3
Reaction score
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:

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
1,853
Reaction score
408
First Language
English
Primarily Uses
RMVXA
Would using yanfly's class system mess with this thing
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.
 

Shoal

Warper
Member
Joined
Oct 27, 2019
Messages
3
Reaction score
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. ^^'
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
1,853
Reaction score
408
First Language
English
Primarily Uses
RMVXA
i was using it exclusively in the class.
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:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

is it just me or have posts gotten way more boring ever sense the forum updated
Oh no, fatigue and procrastination setting in on my game. :( Must overcome it!!! Must continue on!!!
I have this issue where I get insomnia whenever I need an answer or solution to "x" situation, and can't sleep until I find it or I pass out exhausted...
Got MV on Steam during the Lunar New Year Sale! Happy Year of the Rat everyone!
Oh, stop with the Melodrama...

...Listen to it instead!

Forum statistics

Threads
93,621
Messages
914,019
Members
123,185
Latest member
OneLoveDrew
Top