I know about scopes, but I can choose one of these scope - one ally or one ally (dead). I want to make item that can work with both options, but this program cannot do it, I guess there's a way to make custom scope with some script that allow use item on dead or alive ally in same time. Can y'all help me and propose any script (if it exist), or create one.
I need script that allow item to revive and heal chosen ally, no matter, they're dead or alive.
RPG Maker VXAce SupportWhile it is possible (Tsukihime once wrote a script that allowed much more freedom in targeting, but unfortunately it got lost), have you considered simply tricking the engine?
basically make an item calling a common event, and have that common event apply effects targeted to both dead and alive actors to the selected target, overriding the restriction.
basically make an item calling a common event, and have that common event apply effects targeted to both dead and alive actors to the selected target, overriding the restriction.
I haven't tried, I don't even know Ruby's language. I thought this program can make common event for character that I can choose, not the character that I chosed with some item.
it's a bit tricky, but it can be done.
basically you need to create an invisible "target" state - no effect, no text, no icon.
the item then has two effects: it gives that invisible state to the target, and calls a common event.
in the common event then you check each actor for the one who has the state. once you found that actor, you apply the effects you want and then remove the state (to prevent it from confusing the next use of the item)
basically you need to create an invisible "target" state - no effect, no text, no icon.
the item then has two effects: it gives that invisible state to the target, and calls a common event.
in the common event then you check each actor for the one who has the state. once you found that actor, you apply the effects you want and then remove the state (to prevent it from confusing the next use of the item)
I don't think this (the common eventing) will be possible. I tried a common event (I have a different method for identifying the target), in which there's reviving and hp add for a dead target, and only add hp for the living one, but it seems that when you set the scope as One Ally (Dead), then the living one is not recognized. Also, if you have a dead actor in the party and you use that item on a living one, it will automatically revive the dead one. I don't have enough scripting knowledge to know if this is possible to work around by a script.
(Also, @Andar, did you mean the scope change script by Tsukihime? I think that one only works for toggling all/one, and inverting ally/enemy, not what is needed here.)
(Also, @Andar, did you mean the scope change script by Tsukihime? I think that one only works for toggling all/one, and inverting ally/enemy, not what is needed here.)
@EntangledPear no, the script I meant completely disabled the scope and replaced it with ruby code filtering, and it was only posted on this forum, never on her website.
and due to the changes to the forum software that post has been lost years ago.
and due to the changes to the forum software that post has been lost years ago.
I see. That's too bad, sounds like a useful script.
Do you remember when? Maybe there is a slight chance the wayback machine will have it in a previous save.
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Target Dead Ally For Item ║ Version: 1.00 ║
# ║ Author: Roninator2 ║ ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function: ║ Date Created ║
# ║ ╠════════════════════╣
# ║ Include dead ally for item ║ 25 Oct 2022 ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions: ║
# ║ Place note tag on the item you wish to alter ║
# ║ ║
# ║ <select any ally> ║
# ║ ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates: ║
# ║ 2022-Oct-25 - Initial publish ║
# ║ ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use: ║
# ║ Free for all uses in RPG Maker VX Ace - except nudity ║
# ╚══════════════════════════════════════════════════════════╝
module R2_Target_Dead_Ally_Item
REGEX = /<select[-_ ]any[-_ ]ally>/i # regex code for script
end
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_r2scp_ally_dead load_database; end
def self.load_database
load_database_r2scp_ally_dead
load_notetags_r2_scp_itm_ally_1a
end
#--------------------------------------------------------------------------
# new method: load_notetags
#--------------------------------------------------------------------------
def self.load_notetags_r2_scp_itm_ally_1a
for r2scpad in $data_items
next if r2scpad.nil?
r2scpad.load_notetags_r2_scp_itm_ally_1a
end
end
end # DataManager
#==============================================================================
# ■ RPG::Skill
#==============================================================================
class RPG::UsableItem < RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :scope_ally_inc_dead
#--------------------------------------------------------------------------
# common cache: load_notetags
#--------------------------------------------------------------------------
def load_notetags_r2_scp_itm_ally_1a
@scope_ally_inc_dead = false
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when R2_Target_Dead_Ally_Item::REGEX
@scope_ally_inc_dead = true
end
} # self.note.split
#---
end
end
class Game_Action
#--------------------------------------------------------------------------
# * OVERWRITE - Target dead allies for item
#--------------------------------------------------------------------------
def targets_for_friends
if item.for_user?
[subject]
elsif item.scope_ally_inc_dead
[friends_unit.pick_target(@target_index)]
elsif item.for_dead_friend?
if item.for_one?
[friends_unit.smooth_dead_target(@target_index)]
else
friends_unit.dead_members
end
elsif item.for_friend?
if item.for_one?
[friends_unit.smooth_target(@target_index)]
else
friends_unit.alive_members
end
end
end
end
class Game_Unit
#--------------------------------------------------------------------------
# * Pick Target
#--------------------------------------------------------------------------
def pick_target(index)
member = members[index]
end
end
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# * Pick Target
#--------------------------------------------------------------------------
alias r2_item_test_any_ally_782f item_test
def item_test(user, item)
return true if item.scope_ally_inc_dead
r2_item_test_any_ally_782f(user, item)
end
end
Thank you very much, this works, but when I applied this script, few enemies (I've tested default enemies) can't take damage on allies (my own enemies can take damage on allies), this is can be attributed to an fallibility?
I only tested with the default scripts.
I did not see any issues.
Try placing this script above your custom scripts.
Or tell me what scripts you have as there may be an incompatibility.
Also I assume you mean 'enemies can't damage the player actors', or enemies can't damage other enemies?
I didn't understand your second question, in first question you mean main character and his allies, right? I tested this script in a hurry, I think this is an fallibility conditioned by specifications of enemies.
I only had one question.
You're using big fancy words so your meaning is a little lost to me.
I don't know what the problem is. Please explain.
When I fighting, some enemies trying to hit allies, but allies evading and enemies miss. I'm trying to say that enemies haven't hit the allies. I think this is random, because with other enemies I have not problems. Also I can say, we are both talking off topic. Anyway, this script is working great, but for now I need some testers of this script, I'll talk about it with friends of mine.
Original thread: https://forums.rpgmakerweb.com/threads/i-need-script-that-allow-item-to-revive-and-heal-chosen-ally-no-matter-theyre-dead-or-alive.152224/