- Joined
- Feb 12, 2014
- Messages
- 28
- Reaction score
- 9
- First Language
- English
- Primarily Uses
I would like to create a flag that causes an entity to do the 'substitute' thing for an enemy, as opposed to an ally. (Reasons for this can include things like summons that protect the party, status effects that use baddies (or you!) as cover, etc. etc.)
I have been digging around a little bit in the scripts and I've done a lot of the work so far, but I definitely need help finishing the job.
class Game_Battler < Game_BattlerBase FLAG_ID_EnemySub = 4 endclass Scene_Battle #-------------------------------------------------------------------------- # * Invoke Skill/Item #-------------------------------------------------------------------------- def invoke_item(target, item) if rand < target.item_cnt(@subject, item) invoke_counter_attack(target, item) elsif rand < target.item_mrf(@subject, item) invoke_magic_reflection(target, item) else apply_item_effects(apply_substitute(target, item), item) else apply_item_effects(apply_enemysub(target, item), item) end @subject.last_target_index = target.index end #-------------------------------------------------------------------------- # * Apply EnemySubstitute #-------------------------------------------------------------------------- def apply_enemysub(target, item) if check_enemysub(target, item) enemysub = target.opponents_unit.substitute_battler if enemysub && target != enemysub @log_window.display_substitute(substitute, target) return enemysub end end target end endMy biggest concern right now is the conflict in "Invoke Skill / Item." Since both flags are checked automatically by the way the game handles their coding, won't it cause conflicts? I foresee something like both the EnemySub and the Substitute flag-carriers taking the damage, but I don't know what I'd do about that.
Secondly, I don't fully understand what's going on in the substitute code. I copy-pasted and tweaked the lines as appropriate, but I'm certain that won't work. (Also, it doesn't.) I am keying in on the line "if enemysub && target != enemysub" and thinking that's extraneous (that is, that was a line created to prevent substituters from substituting themselves), but I'm not certain.
Additionally, how would I go about telling the game to apply this flag to an actor / enemy / etc.? The usual 'flag drop-box' doesn't seem to update with the new flag option.
(Before any one tries this script as-is: it is pretty far away from working.)
I have been digging around a little bit in the scripts and I've done a lot of the work so far, but I definitely need help finishing the job.
class Game_Battler < Game_BattlerBase FLAG_ID_EnemySub = 4 endclass Scene_Battle #-------------------------------------------------------------------------- # * Invoke Skill/Item #-------------------------------------------------------------------------- def invoke_item(target, item) if rand < target.item_cnt(@subject, item) invoke_counter_attack(target, item) elsif rand < target.item_mrf(@subject, item) invoke_magic_reflection(target, item) else apply_item_effects(apply_substitute(target, item), item) else apply_item_effects(apply_enemysub(target, item), item) end @subject.last_target_index = target.index end #-------------------------------------------------------------------------- # * Apply EnemySubstitute #-------------------------------------------------------------------------- def apply_enemysub(target, item) if check_enemysub(target, item) enemysub = target.opponents_unit.substitute_battler if enemysub && target != enemysub @log_window.display_substitute(substitute, target) return enemysub end end target end endMy biggest concern right now is the conflict in "Invoke Skill / Item." Since both flags are checked automatically by the way the game handles their coding, won't it cause conflicts? I foresee something like both the EnemySub and the Substitute flag-carriers taking the damage, but I don't know what I'd do about that.
Secondly, I don't fully understand what's going on in the substitute code. I copy-pasted and tweaked the lines as appropriate, but I'm certain that won't work. (Also, it doesn't.) I am keying in on the line "if enemysub && target != enemysub" and thinking that's extraneous (that is, that was a line created to prevent substituters from substituting themselves), but I'm not certain.
Additionally, how would I go about telling the game to apply this flag to an actor / enemy / etc.? The usual 'flag drop-box' doesn't seem to update with the new flag option.
(Before any one tries this script as-is: it is pretty far away from working.)
Last edited by a moderator:

