Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Mimic skill, a skill that copies last action
332211
post Aug 22 2008, 04:03 AM
Post #1


Waiting for an epiphany
Group Icon

Group: Revolutionary
Posts: 180
Type: Scripter
RM Skill: Advanced




Mimic Skill


Version: 1.1
Released: 22nd of August 2008
Last Update: 3rd of Septemvber 2008

Description
Enables the criation of skill that copy the last action (attack, guard, wait, escape, use skill or use item)
1.2: enemies can also copy the use of items without getting the "can't copy - no item" message

Script

CODE
#--------------------------------------------------------------------------
# * Start configuration
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * module Mime
#--------------------------------------------------------------------------
module Mime
#Mime_skills = [skill_id] - skill that copy last action
Mime_skills = [83]
#Copy_only_actors
#true: copy last action made by a party member (if any)
#false: copy last action made (if any)
Copy_only_actors = false
end
#--------------------------------------------------------------------------
# * module Vocab
#--------------------------------------------------------------------------
# Cant copy message text
# %s = actor name
Vocab::CantCopy = "No previous action. %s failed to mimic."
# Cant copy message text: no item in the inventory
# %s = actor name; %s = item name
Vocab::No_item = "%s can't mimic last action, no %s in the inventory."
#--------------------------------------------------------------------------
# * End configuration
#--------------------------------------------------------------------------
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Aliasing - Battle Start Processing
#--------------------------------------------------------------------------
alias mime_process_battle_start process_battle_start
#--------------------------------------------------------------------------
# * Battle Start Processing
#--------------------------------------------------------------------------
def process_battle_start
mime_process_battle_start
@last_action = []
end
#--------------------------------------------------------------------------
# * Execute Battle Action
#--------------------------------------------------------------------------
def execute_action
case @active_battler.action.kind
when 0 # Basic
case @active_battler.action.basic
when 0 # Attack
execute_action_attack
if Mime::Copy_only_actors
@last_action = [0,0] if @active_battler.is_a?(Game_Actor)
else
@last_action = [0,0]
end
when 1 # Guard
execute_action_guard
if Mime::Copy_only_actors
@last_action = [0,1] if @active_battler.is_a?(Game_Actor)
else
@last_action = [0,1]
end
when 2 # Escape
execute_action_escape
if Mime::Copy_only_actors
@last_action = [0,2] if @active_battler.is_a?(Game_Actor)
else
@last_action = [0,2]
end
when 3 # Wait
execute_action_wait
if Mime::Copy_only_actors
@last_action = [0,3] if @active_battler.is_a?(Game_Actor)
else
@last_action = [0,3]
end
end
when 1 # Skill
if Mime::Mime_skills.include?(@active_battler.action.skill.id)
repeat_last_action
else
execute_action_skill
end
when 2 # Item
if @active_battler.is_a? Game_Actor
if $game_party.has_item?(@active_battler.action.item)
execute_action_item
else
cant_copy_action_no_item
end
else
execute_action_item
end
end
end
#--------------------------------------------------------------------------
# * Aliasing - Execute Battle Action: skill
#--------------------------------------------------------------------------
alias mime_execute_action_skill execute_action_skill
#--------------------------------------------------------------------------
# * Execute Battle Action: skill
#--------------------------------------------------------------------------
def execute_action_skill
mime_execute_action_skill
if Mime::Copy_only_actors
@last_action = [1,@active_battler.action.skill.id] if @active_battler.is_a?(Game_Actor)
else
@last_action = [1,@active_battler.action.skill.id]
end
end
#--------------------------------------------------------------------------
# * Aliasing - Execute Battle Action: item
#--------------------------------------------------------------------------
alias mime_execute_action_item execute_action_item
#--------------------------------------------------------------------------
# * Execute Battle Action: Item
#--------------------------------------------------------------------------
def execute_action_item
mime_execute_action_item
if Mime::Copy_only_actors
@last_action = [2,@active_battler.action.item.id] if @active_battler.is_a?(Game_Actor)
else
@last_action = [2,@active_battler.action.item.id]
end
end
#--------------------------------------------------------------------------
# * Repeat Battle Action
#--------------------------------------------------------------------------
def repeat_last_action
cant_copy_action if @last_action[0] == nil or @last_action[1] == nil
@active_battler.action.kind = @last_action[0]
@active_battler.action.basic = @last_action[1] if @last_action[0] == 0
@active_battler.action.set_skill(@last_action[1]) if @last_action[0] == 1
@active_battler.action.set_item(@last_action[1]) if @last_action[0] == 2
execute_action
end
#--------------------------------------------------------------------------
# * Can't Copy Action: no last action
#--------------------------------------------------------------------------
def cant_copy_action
text = sprintf(Vocab::CantCopy,@active_battler.name)
@message_window.add_instant_text(text)
wait(60)
end
#--------------------------------------------------------------------------
# * Can't Copy Action: no item
#--------------------------------------------------------------------------
def cant_copy_action_no_item
text = sprintf(Vocab::No_item,@active_battler.name,$data_items[@last_action[1]].name)
@message_window.add_instant_text(text)
wait(80)
end
end


See script for configuration/instructions

Notes
Haven't checked for if it's compatible, but should work with most scripts
Overwrites method "execute_action" in Scene_Battle
Post update suggestions.

Edit: updated to version 1.2, thanks to lahandi.

This post has been edited by 332211: Sep 3 2008, 03:10 PM


__________________________
Go to the top of the page
 
+Quote Post
   
lahandi
post Aug 25 2008, 06:23 PM
Post #2


Level 8
Group Icon

Group: Revolutionary
Posts: 111
Type: Artist
RM Skill: Skilled





I like the concept of this script smile.gif

I have a question. If I want to use this mimic skill as a enemy/monster skill, could it negates the need of Items? I mean if the last actor throw dynamite to the monster, can the monster (who has mimic skill) also throw dynamite to the actor?



__________________________
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 20th May 2013 - 01:06 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker