CANUSE (actor command)

deilin

Ranger/Elementalist
Veteran
Joined
Mar 13, 2012
Messages
1,188
Reaction score
172
First Language
English
This script enables ATTACK, GUARD and ITEM actor commands in battle based on actor id. you can disable lines and functions as you need.

WHY?

In my games, basic attacks are a free SKILL attacks.

in one of my games, an untrained character wouldn't know how to gurd effectively enough to do so.

In my current game, only one person can use items since they are the only one that can hold them in their "bag", disallowing other to use them.

Code:
#------------------------#CANUSE commands#Modifies what actor commands appear in battle based on#by DeiLin#------------------------module CANUSE  #leaving [] below will disallow all actors  CANATTACK = [] #actor ids that can use attack command  CANGUARD = [] #actor ids that can use guard command  CANITEM = [] #actor ids that can use item command  #Skill isn't included since it's based on RPG Maker VX ACE traitsend#------------------------#Don't modify below unless you know what you are doing.#------------------------class Game_Actor < Game_Battler  attr_reader   :actor_idendclass Window_ActorCommand < Window_Command  attr_reader   :actor  attr_reader   :actor_id  def make_command_list    return unless @actor    add_attack_command if CANUSE::CANATTACK.include?(actor.actor_id)   add_skill_commandsadd_guard_command if CANUSE::CANGUARD.include?(actor.actor_id)    add_item_command if CANUSE::CANITEM.include?(actor.actor_id)  endend
 
Last edited by a moderator:

deilin

Ranger/Elementalist
Veteran
Joined
Mar 13, 2012
Messages
1,188
Reaction score
172
First Language
English
Gah. Will fix display when home.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,820
Reaction score
623
First Language
English
Primarily Uses
RMVXA
Code fixed
Ruby:
#------------------------
#CANUSE commands
#Modifies what actor commands appear in battle based on
#by DeiLin
#------------------------
module CANUSE
    #leaving [] below will disallow all actors
    CANATTACK = []
    #actor ids that can use attack command
    CANGUARD = []
    #actor ids that can use guard command
    CANITEM = []
    #actor ids that can use item command
    #Skill isn't included since it's based on RPG Maker VX ACE traits
end
#------------------------
#Don't modify below unless you know what you are doing.
#------------------------
class Game_Actor < Game_Battler
    attr_reader   :actor_id
end

class Window_ActorCommand < Window_Command
    attr_reader   :actor
    attr_reader   :actor_id
    def make_command_list
        return unless @actor
        add_attack_command if CANUSE::CANATTACK.include?(actor.actor_id)
        add_skill_commands
        add_guard_command if CANUSE::CANGUARD.include?(actor.actor_id)
        add_item_command if CANUSE::CANITEM.include?(actor.actor_id)
    end
end
Well that was a silly mistake, but I corrected my error.
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

I've started up Pillars of Eternity. It's interesting how the game does a "select choice" cutscene using still image art for dramatic flair. I wonder if that might work for my RPGMaker project.
First steps on an interior castle map
The self-righteous indignation of family when you expect them to pay back money you've leant to them never ceases to amaze me.
Gamedev for relaxing? yes or no?
I've been having a rough couple of months and as such let down some friends of mine in the RPG Maker community. I still need time to get back to my normal self, but it's nice to be back, to read articles, and to design again (albeit at a slow pace). Hope to give updates on Kid Crescent soon.

Forum statistics

Threads
107,735
Messages
1,031,742
Members
139,870
Latest member
Berserk94
Top