Set a skill in battle to a key

Status
Not open for further replies.

Aurorain

Overlord Illumise
Veteran
Joined
Dec 8, 2013
Messages
208
Reaction score
49
First Language
English
Primarily Uses
What I'm asking is how could I go about setting up a skill(like guard) to be performed only when a certain key is pressed on an actor's turn(and not happen until it's time to take their action)? It wouldn't appear on the command list, but when say 'A' is pressed, it'd take a turn for that character, and have them guard, or wait, or something. I know that through a conditional branch, it'd run something if a key is pressed, like what I'm asking for, but is there a way to have the effect run for the specific actor that uses it?  :unsure:

(Ah, and I'm using VX Ace.)
 
Last edited by a moderator:

ShadowLurk

Tanoshii~
Veteran
Joined
Feb 14, 2014
Messages
226
Reaction score
53
Primarily Uses
The simplest way to do this would be by scripting, as we cannot detect a player's turn selection just with eventing. (It is different if you made a full battle system using just eventing, but....)

This is one example.

class Scene_Battle < Scene_Base alias :create_actor_command_window_shiftguard :create_actor_command_window def create_actor_command_window create_actor_command_window_shiftguard @actor_command_window.set_handler:)SHIFT, method:)command_guard)) end endThis will set the Shift key to make the current actor assign guard as action.
 

Aurorain

Overlord Illumise
Veteran
Joined
Dec 8, 2013
Messages
208
Reaction score
49
First Language
English
Primarily Uses
I just tested this(as well as in a new project), and..it doesn't work. I mean, it doesn't result in a character guarding, or anything happening actually. I changed the key as well, but still nothing happened(unless I'm doing something wrong o-o).
 
Last edited by a moderator:

Ruiran

Veteran
Veteran
Joined
Nov 4, 2013
Messages
78
Reaction score
30
First Language
English
Primarily Uses
I would reccomend adding this 

class Window_ActorCommand < Window_Command def process_handling return unless open? && active Window_ActorCommand return call_handler:)guard) if handle?:)guard) && Input.trigger?:)X) endendYou can repeat this line : 

return call_handler:)guard) if handle?:)guard) && Input.trigger?:)X)Changing the "X" depending on the input key you need
 
Last edited by a moderator:

ShadowLurk

Tanoshii~
Veteran
Joined
Feb 14, 2014
Messages
226
Reaction score
53
Primarily Uses
RIght, forgot to give the other part of that code....

Code:
class Window_ActorCommand < Window_Command    def process_handling    return unless open? && active    return call_handler(:SHIFT) if handle?(:SHIFT) && Input.trigger?(:SHIFT)    super  end  end
 

Aurorain

Overlord Illumise
Veteran
Joined
Dec 8, 2013
Messages
208
Reaction score
49
First Language
English
Primarily Uses
I would reccomend using this 

class Window_ActorCommand < Window_Command def process_handling return unless open? && active Window_ActorCommand return call_handler:)guard) if handle?:)guard) && Input.trigger?:)X) endendYou can repeat this line : 

return call_handler:)guard) if handle?:)guard) && Input.trigger?:)X)Changing the "X" depending on the input key you need
This is..game-breaking. What I mean is that, it lets me only use the key to guard, and nothing else. Also, the windows in battle seem to get a little screwed up(the Fight/Escape menu is off-screen, and doesn't return). :l

RIght, forgot to give the other part of that code....

class Window_ActorCommand < Window_Command def process_handling return unless open? && active return call_handler:)SHIFT) if handle?:)SHIFT) && Input.trigger?:)SHIFT) super end end
Uhm..still nothing happens when I press the key to guard. o-o
 
Last edited by a moderator:

ShadowLurk

Tanoshii~
Veteran
Joined
Feb 14, 2014
Messages
226
Reaction score
53
Primarily Uses
It's meant to be used with the previous snippet...

Though, it is still kind of buggy.

Try this, this will correctly set guard when pressing Shift key:

Code:
class Window_ActorCommand < Window_Command    def process_handling    return unless open? && active    return process_key_shift if handle?(:SHIFT) && Input.trigger?(:SHIFT)    super  end    def process_key_shift    Sound.play_ok    Input.update    deactivate    call_shift_handler  end    def call_shift_handler    call_handler(:SHIFT)  endendclass Scene_Battle < Scene_Base    alias :create_actor_command_window_shiftguard :create_actor_command_window  def create_actor_command_window    create_actor_command_window_shiftguard    @actor_command_window.set_handler(:SHIFT, method(:command_guard))  end  end
 

Aurorain

Overlord Illumise
Veteran
Joined
Dec 8, 2013
Messages
208
Reaction score
49
First Language
English
Primarily Uses
Ah, okay(didn't know I had to use both snippets..I'm oblivious like that sometimes..). Thanks Shadow, this time it works just fine.  :)

This can be closed now.  ;)
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I've moved this thread to RGSS3 Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,570
Latest member
fgfhdfg
Top