Hello! I tried looking around for any scripts or if anybody else has tried this, but I want to make a skill that applies the user's states onto the enemy. Such as, if the user is poisoned, by using the spell on an enemy, the enemy will be inflicted with poison. I don't know how difficult this actually is to do, but any help given is great 🙂 Thanks!
Skill that applies the user's states onto the enemy.
RPG Maker VXAce SupportBumping this
Hello,
There is a nice script by Yami to transfer states if you want to give it a try.
Otherwise you can go for this script I made:
You can set in the skill or item notetag :
or
You can also use script calls:
There is a nice script by Yami to transfer states if you want to give it a try.
Otherwise you can go for this script I made:
Ruby:
#==============================================================================
# Copy States
#------------------------------------------------------------------------------
# Author: Timtrack
# date: 04/12/2025
# Requires: none
#==============================================================================
# Description: provides a state transfer system to skills/items on hit, set in
# the notetags:
# <copy states>
# Or:
# <copy states: id1, id2,..>
#==============================================================================
# Term of use: free for commercial and free games, credit is not required
#==============================================================================
$imported = {} if $imported.nil?
$imported["TIM-CopyStates"] = true
#============================================================================
# TIM
#============================================================================
module TIM
module StateCopy
module REGEXP
ALL_STATES = /<copy states>/i
LIST_STATES = /<copy states:\s*(\d+(,\s*\d+)*)\s*>/i
end #REGEXP
end #StateCopy
end #TIM
#============================================================================
# DataManager
#============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias tim_statecopy_load_database load_database; end
def self.load_database
tim_statecopy_load_database
tim_statecopy_load_notetags
end
#--------------------------------------------------------------------------
# new method: tim_statecopy_load_notetags
#--------------------------------------------------------------------------
def self.tim_statecopy_load_notetags
[$data_skills, $data_items].each do |group|
group.each { |obj| obj.load_notetags_statecopy if obj }
end
end
end # DataManager
#============================================================================
# RPG::UsableItem
#============================================================================
class RPG::UsableItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :copy_states
attr_accessor :copy_states_list
#--------------------------------------------------------------------------
# common cache: load_notetags_statecopy
#--------------------------------------------------------------------------
def load_notetags_statecopy
@copy_states = false
@copy_states_list = nil
#---
self.note.split(/[\r\n]+/).each do |line|
case line
#---
when TIM::StateCopy::REGEXP::ALL_STATES
@copy_states = true
when TIM::StateCopy::REGEXP::LIST_STATES
@copy_states = true
@copy_states_list = $1.scan(/\d+/).map {|s| s.to_i}
end
end # self.note.split
#---
end
end #RPG::UsableItem
#==============================================================================
# Game_BattlerBase
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# new method: copy_states_to
#--------------------------------------------------------------------------
def copy_states_to(other, state_ids = nil)
return copy_all_states_to(other) unless state_ids
state_ids.each do |s|
other.add_state(s) if state?(s)
end
end
#--------------------------------------------------------------------------
# new method: copy_all_states_to
#--------------------------------------------------------------------------
def copy_all_states_to(other)
@states.each { |s| other.add_state(s) }
end
end #Game_BattlerBase
#==============================================================================
# Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# alias method: item_apply
#--------------------------------------------------------------------------
alias tim_copystate_item_apply item_apply
def item_apply(user, item)
tim_copystate_item_apply(user,item)
return unless @result.hit? && item.copy_states
item_effect_copy_states(user,item)
end
#--------------------------------------------------------------------------
# alias method: item_effect_copy_states
#--------------------------------------------------------------------------
def item_effect_copy_states(user,item)
user.copy_states_to(self, item.copy_states_list)
end
end #Game_Battler
You can set in the skill or item notetag :
<copy states> to copy all statesor
<copy states: a,b,c> to copy a list of specific statesYou can also use script calls:
user.copy_states_to(target, [state_ids])TYSM!!! your script worked!!
Original thread: https://forums.rpgmakerweb.com/threads/skill-that-applies-the-users-states-onto-the-enemy.181261/